JohnnyProd
Technical User
I have written a .VBS script which opens An Outlook application, searches for specific messages, imports the body of the message into an Access database, and then moves the message into another folder. The problem I am having is that when I move the emaail message from one Public Folder to another Public Folder, the message is sometimes not removed from the folder it was moved from. This is causing problems because the next time my .vbs script runs, it wants to import the same data. Anyone else ever come across this? Here are some snippets of my code in case anyone can recognize an error...
Set oOutlook = CreateObject("Outlook.Application"
Set oNs = oOutlook.GetNamespace("MAPI"
Set publicFolder = oNs.Folders("Public Folders"
Set allPublicFoldersFolder = publicFolder.Folders("All Public Folders"
Set MyFolder = allPublicFoldersFolder.Folders("MyPublicFolder"
Set Messages = MyFolder.Items
Set MySecondFolder = allPublicFoldersFolder.Folders("MySecondFolder"
....
For Each oMessage In Messages
...
oMessage.move(MySecondFolder)
...
Next
Set oOutlook = CreateObject("Outlook.Application"
Set oNs = oOutlook.GetNamespace("MAPI"
Set publicFolder = oNs.Folders("Public Folders"
Set allPublicFoldersFolder = publicFolder.Folders("All Public Folders"
Set MyFolder = allPublicFoldersFolder.Folders("MyPublicFolder"
Set Messages = MyFolder.Items
Set MySecondFolder = allPublicFoldersFolder.Folders("MySecondFolder"
....
For Each oMessage In Messages
...
oMessage.move(MySecondFolder)
...
Next