I accepted a VB code solution to an earlier question:
Here is the code in its entirety:
WScript.Echo "Outlook has been reset on this computer."
Const olFolderInbox = 6
Const olFolderDeletedItems = 3
Dim olkApp, olkRootFolder, intFolders
Set olkApp = GetObject(, "Outlook.Application")
Set olkRootFolder = olkApp.Session.GetDefaultF
For intFolders = olkRootFolder.Folders.Coun
t To 1 Step -1
'Empty Deleted Items now that we're all done
Set olkRootFolder = Nothing
Set olkApp = Nothing
Sub ClearFolder(olkFolder As Outlook.MAPIFolder)
Select Case olkFolder.Name
'If it's one of Outlook's default folders, thenw e clean it up.
Case "Calendar", "Contacts", "Drafts", "Deleted Items", "Inbox", "Journal", "Junk E-mail", "Notes", "Outbox", "Sent Items", "Tasks"
'Delete the items
For intIndex = olkFolder.Items.Count To 1 Step -1
'Delete the sub-folders
For intIndex = olkFolder.Folders.Count To 1 Step -1
'If it's not a default folder, then delete it and all it's contents
Although the code looked exactly what I needed, I didn't test it because, in the meantime, an alternative solution had been developed by another team within my organisation. Unfortunately, I have now found that their 'in-house' solution actually doesn't do the job properly and I need to use the VB solution given.
However, I have tried running the code but it fails with a VBScript compilation error, which I don't have the knowledge to fix. The error reported is:
Error: Expected ')'
Can anyone help with this please?