Move message to folder

  • Thread starter Thread starter Carrie
  • Start date Start date
C

Carrie

I'm having some trouble writing code to move the currently
selected e-mail to a specific destination folder (an Inbox
subfolder named "Vendor"). I can get the following code to
work, but obviously I still have to pick the destination
folder:
Set oInboxItems = bjNS.GetDefaultFolder
(olFolderInbox).Items
Set olns = Item.Application.GetNamespace("MAPI")
Set objTargetFolder = Outlook.Session.PickFolder
Set objCurItem = oInboxItems.Item(1)
objCurItem.Move objTargetFolder

If I set the specific destination folder nothing happens:
Set oInboxItems = objNS.GetDefaultFolder
(olFolderInbox).Items
Set olns = Item.Application.GetNamespace("MAPI")
Set objTargetFolder = objInbox.Folders("Vendor")
Set objCurItem = oInboxItems.Item(1)
objCurItem.Move objTargetFolder

What am I doing wrong? Thanks in advance for any
suggestions!
 
Carrie said:
I'm having some trouble writing code to move the currently
selected e-mail to a specific destination folder (an Inbox
subfolder named "Vendor"). I can get the following code to
work, but obviously I still have to pick the destination
folder:
Set oInboxItems = bjNS.GetDefaultFolder
(olFolderInbox).Items
Set olns = Item.Application.GetNamespace("MAPI")
Set objTargetFolder = Outlook.Session.PickFolder
Set objCurItem = oInboxItems.Item(1)
objCurItem.Move objTargetFolder

If I set the specific destination folder nothing happens:
Set oInboxItems = objNS.GetDefaultFolder
(olFolderInbox).Items
Set olns = Item.Application.GetNamespace("MAPI")
Set objTargetFolder = objInbox.Folders("Vendor")
Set objCurItem = oInboxItems.Item(1)
objCurItem.Move objTargetFolder

What am I doing wrong? Thanks in advance for any
suggestions!


objCurItem .Move Application.GetNamespace("MAPI").Folders("Personal
Folders").Folders("Vendor")


--
John Blessing
http://www.LbeHelpdesk.com - Help Desk software at affordable prices
http://www.free-helpdesk.com - Completely free help desk software !
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook
http://www.lbesync.com - Synchronize two Outlook Personal Folders
 
Change the line
objCurItem.Move objTargetFolder
to
set objCurItem = objCurItem.Move(objTargetFolder)
objCurItem.Save

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Back
Top