![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
I have the script below to perform a hard delete on items in the deleted
items folder. I have it scheduled aa a task but it only deletes 10 or 20 emails. ' Antonio Gonzalez 3.2.2006, 3.6.2006 ' This is a sample script, provided as is without warranty. ' Sample scripts are not intended to run in a production environment. ' ' Microsof Corporation. Option Explicit Const cdoDefaultFolderCalendar = 0 Const cdoDefaultFolderContacts = 5 Const cdoDefaultFolderDeletedItems = 4 Const cdoDefaultFolderInbox = 1 Const cdoDefaultFolderJournal = 6 Const cdoDefaultFolderNotes = 7 Const cdoDefaultFolderOutbox = 2 Const cdoDefaultFolderSentItems = 3 Const cdoDefaultFolderTasks = 8 Dim ie_application, document Dim cdo_session, cdo_folder, cdo_items, cdo_item Dim servername, profilename, profileinfo, vbsLineFeed vbsLineFeed = Chr(10) Set ie_application = WScript.CreateObject("InternetExplorer.Application ") With (ie_application) .Top = 45 .Left = 45 .Width = 500 .Height = 250 .Resizable = False .StatusBar = True .AddressBar = False .ToolBar = False .MenuBar = False Do While (.Busy) WScript.Sleep 500 Loop .Navigate "about:blank" .Visible = True Set document = .Document End With document.open document.writeln "html" document.writeln "head" document.writeln "titleSRX060227604215/title" document.writeln "script language=""javascript""" document.writeln "!--" document.writeln "defaultStatus = document.title" document.writeln "' --" document.writeln "/script" document.writeln "/head" document.writeln "body bgcolor=""#ffffff""" document.body.style.cursor = "wait" document.writeln "pProcessing request, please wait.../p" ie_application.StatusText = "Connecting to server..." servername = "sbke2kdev01" profilename = "PowersB" profileinfo = servername & vbsLineFeed & profilename Set cdo_session = WScript.CreateObject("MAPI.Session") cdo_session.Logon "", "", False, False, 0, True, profileinfo Set cdo_folder = cdo_session.GetDefaultFolder(cdoDefaultFolderDelet edItems) Set cdo_items = cdo_folder.Messages For Each cdo_item In cdo_items document.writeln "* " ie_application.StatusText = "Deleting: " & cdo_item.Subject '& " from " & cdo_folder.Name cdo_item.Delete False Next cdo_session.Logoff Set cdo_item = Nothing Set cdo_items = Nothing Set cdo_folder = Nothing Set cdo_session = Nothing document.writeln "pRequest completed successfully./p" document.body.style.cursor = "default" document.writeln "/body" document.writeln "/html" document.close WScript.Sleep 4000 ie_application.Quit |
#2
|
|||
|
|||
![]()
Do not use "for" or r"for each" loop, loop from count down to 1 instead:
for i = cdo_items.count to 1 step -1 .... Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "billp" wrote in message ... I have the script below to perform a hard delete on items in the deleted items folder. I have it scheduled aa a task but it only deletes 10 or 20 emails. ' Antonio Gonzalez 3.2.2006, 3.6.2006 ' This is a sample script, provided as is without warranty. ' Sample scripts are not intended to run in a production environment. ' ' Microsof Corporation. Option Explicit Const cdoDefaultFolderCalendar = 0 Const cdoDefaultFolderContacts = 5 Const cdoDefaultFolderDeletedItems = 4 Const cdoDefaultFolderInbox = 1 Const cdoDefaultFolderJournal = 6 Const cdoDefaultFolderNotes = 7 Const cdoDefaultFolderOutbox = 2 Const cdoDefaultFolderSentItems = 3 Const cdoDefaultFolderTasks = 8 Dim ie_application, document Dim cdo_session, cdo_folder, cdo_items, cdo_item Dim servername, profilename, profileinfo, vbsLineFeed vbsLineFeed = Chr(10) Set ie_application = WScript.CreateObject("InternetExplorer.Application ") With (ie_application) .Top = 45 .Left = 45 .Width = 500 .Height = 250 .Resizable = False .StatusBar = True .AddressBar = False .ToolBar = False .MenuBar = False Do While (.Busy) WScript.Sleep 500 Loop .Navigate "about:blank" .Visible = True Set document = .Document End With document.open document.writeln "html" document.writeln "head" document.writeln "titleSRX060227604215/title" document.writeln "script language=""javascript""" document.writeln "!--" document.writeln "defaultStatus = document.title" document.writeln "' --" document.writeln "/script" document.writeln "/head" document.writeln "body bgcolor=""#ffffff""" document.body.style.cursor = "wait" document.writeln "pProcessing request, please wait.../p" ie_application.StatusText = "Connecting to server..." servername = "sbke2kdev01" profilename = "PowersB" profileinfo = servername & vbsLineFeed & profilename Set cdo_session = WScript.CreateObject("MAPI.Session") cdo_session.Logon "", "", False, False, 0, True, profileinfo Set cdo_folder = cdo_session.GetDefaultFolder(cdoDefaultFolderDelet edItems) Set cdo_items = cdo_folder.Messages For Each cdo_item In cdo_items document.writeln "* " ie_application.StatusText = "Deleting: " & cdo_item.Subject '& " from " & cdo_folder.Name cdo_item.Delete False Next cdo_session.Logoff Set cdo_item = Nothing Set cdo_items = Nothing Set cdo_folder = Nothing Set cdo_session = Nothing document.writeln "pRequest completed successfully./p" document.body.style.cursor = "default" document.writeln "/body" document.writeln "/html" document.close WScript.Sleep 4000 ie_application.Quit |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Deleted Items Folder | AAH | Outlook Express | 5 | March 10th 06 09:56 PM |
Deleted email not going to Deleted Items folder | techie_comps | Outlook - General Queries | 1 | February 27th 06 04:59 PM |
Deleted items not emptying | David H | Outlook Express | 4 | February 11th 06 11:26 AM |
Recover deleted messages after emptying deleted items folder | Gail | Outlook Express | 2 | January 30th 06 05:18 PM |
Message goes to Deleted Items folder instead of Inbox folder | needhelp | Outlook Express | 3 | January 17th 06 04:49 PM |