PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Moving Messages using EntryID and StoreID

Reply

Moving Messages using EntryID and StoreID

 
Thread Tools Rate Thread
Old 16-02-2004, 01:41 AM   #1
=?Utf-8?B?VHJpc2N1aXQ=?=
Guest
 
Posts: n/a
Default Moving Messages using EntryID and StoreID


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
  Reply With Quote
Old 16-02-2004, 02:11 AM   #2
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Moving Messages using EntryID and StoreID

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
http://www.outlookcode.com/jumpstart.aspx

"Triscuit" <anonymous@discussions.microsoft.com> wrote in message
news:2737C7F0-3685-4B50-89C4-79881F15958B@microsoft.com...
> 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



  Reply With Quote
Old 16-02-2004, 03:41 AM   #3
=?Utf-8?B?VHJpc2N1aXQ=?=
Guest
 
Posts: n/a
Default Re: Moving Messages using EntryID and StoreID - Thanks Sue

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

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off