Machinegon
Machinegon

Reputation: 1885

Outlook copy a mailitem to another folder

I'm trying to copy a MailItem inside a mailbox into another folder of a different mailbox with vbscript. Here's my Code

'Example \\Mailbox1\folder\mail item to \\Mailbox2\Folder\mail item
 For Each item in objFolder.Items
   Dim objCopiedItem : Set objCopiedItem = item.Copy
   Call objCopiedItem.Move(objPSTFolder.FolderPath)
 Next

Obviously, it does not work. The destination folder is inside another mailbox, and the path looks valid when I debug. What's wrong with that?

Upvotes: 0

Views: 1205

Answers (1)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66215

MailItem.Move() takes MAPIFolder object as an argument, not a string.

Don't you get an error when you run that script? Do you have "on error resume next" in your code?

Upvotes: 1

Related Questions