Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook Fails to Delete Message After it is Moved

Status
Not open for further replies.

JohnnyProd

Technical User
Sep 25, 2001
12
0
0
US
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top