Moving Messages using EntryID and StoreID

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I am pretty good with MS Access and VBA, but a complete novice programatically manipulating Outlook
Using code samples found on-line and in help, I managed to import mail messages into Access where I can parse the body and populate database fields

Once I have sucessfully "parsed" the message, I want to move the original message to a different Outlook folder. When I imported the message, I included the EntryID and StoreID....hoping I can use it to move the message

How do I now find and move the message to a new Outlook Folder

Any help will be greatly appreciated
Triscuit
 
You can use the EntryID and StoreID to retrieve the original message using
the GetItemFromID method:

Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
Set objItem = objNS.GetItemFromID(strYourEntryID, strYourStoreID)
Set objMovedItem = objItem.Move(objFolder)

Of course, you'll have to provide the code to get the IDs from your Access
table and get the objFolder object for the destination folder. To get a
non-default folder, you need to walk the folder hierarchy using the Folders
collections or use a function that does that for you. See
http://www.slipstick.com/dev/code/getfolder.htm

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Triscuit said:
Hi, I am pretty good with MS Access and VBA, but a complete novice
programatically manipulating Outlook.
Using code samples found on-line and in help, I managed to import mail
messages into Access where I can parse the body and populate database
fields.
Once I have sucessfully "parsed" the message, I want to move the original
message to a different Outlook folder. When I imported the message, I
included the EntryID and StoreID....hoping I can use it to move the message.
 
Sue
Thank-you so much for your prompt assistance. It was exactly what I needed.
!! SWEET, totally SWEET !

For anybody who is interested, below is my final sub

Public Sub dmlMoveMessage(strMessageEntryID As String, strMessageStoreID As String

Dim objOL As Outlook.Applicatio
Dim objNS As Outlook.NameSpac
Dim objItem As Objec
Dim objMovedItem As Objec
Dim objDestMailFolder As Outlook.MAPIFolde
Dim strDestEntryID As Strin
Dim strDestStoreID As Strin

strDestEntryID = "0000000054880E16602BD147AAA12F6DF4D0A7E2E28F0000
strDestStoreID= "0000000038A1BB1005E5101AA1BB08002B2A56C200006D737073742E646C6C00000000004E495441F9BFB80100AA0037D96E000000453A5C4D61696C5C444D4C2D4C6F63616C2E70737400

Set objOL = CreateObject("Outlook.Application"
Set objNS = objOL.GetNamespace("MAPI"
Set objDestMailFolder = objOL.GetNamespace("Mapi").GetFolderFromID(strDestEntryID, strDestStoreID
Set objItem = objNS.GetItemFromID(strMessageEntryID, strMessageStoreID
Set objMovedItem = objItem.Move(objDestMailFolder

End Su
 
Back
Top