| 1 | #include <Debug.au3>
|
|---|
| 2 |
|
|---|
| 3 | _DebugSetup("Debug Out", False, 1)
|
|---|
| 4 | _DebugOut("Debug start")
|
|---|
| 5 |
|
|---|
| 6 | ;-----------------------------------------------------------------------
|
|---|
| 7 | ; Setup Outlook environment
|
|---|
| 8 | ;-----------------------------------------------------------------------
|
|---|
| 9 | $olApp = ObjCreate("Outlook.Application")
|
|---|
| 10 | $olNameSpace = $olApp.GetNameSpace("MAPI")
|
|---|
| 11 | Dim $archive = $olNameSpace.PickFolder
|
|---|
| 12 |
|
|---|
| 13 | ;-----------------------------------------------------------------------
|
|---|
| 14 | ; Save number of mails to Drafts folder
|
|---|
| 15 | ;-----------------------------------------------------------------------
|
|---|
| 16 | $timestamp = @HOUR & ":" & @MIN & ":" & @SEC
|
|---|
| 17 | Dim $Mail
|
|---|
| 18 | for $i = 1 to 10
|
|---|
| 19 | _DebugOut("Adding mail #" & $i)
|
|---|
| 20 | $Mail = $olApp.CreateItem(0)
|
|---|
| 21 | $Mail.Subject = "Test mail (" & $timestamp & ") [" & $i & "]"
|
|---|
| 22 | $Mail.HTMLBody = "<HTML><p>test</p></HTML>"
|
|---|
| 23 | $Mail.save()
|
|---|
| 24 | Sleep(1000)
|
|---|
| 25 | Next
|
|---|
| 26 |
|
|---|
| 27 | ;-----------------------------------------------------------------------
|
|---|
| 28 | ; Delete all items using a FOR..IN..NEXT loop
|
|---|
| 29 | ;-----------------------------------------------------------------------
|
|---|
| 30 | $oParentFld = $Mail.Parent
|
|---|
| 31 | $iteration = 0
|
|---|
| 32 | For $j in $oParentFld.Items
|
|---|
| 33 | $iteration += 1
|
|---|
| 34 | _DebugOut("Deleting mail, loop " & $iteration)
|
|---|
| 35 | $j.Delete
|
|---|
| 36 | Sleep(1000)
|
|---|
| 37 | Next
|
|---|
| 38 |
|
|---|
| 39 | _DebugOut("Loop has finished, " & $oParentFld.Items.Count & " items remaining in folder.")
|
|---|