StoreID

  • Thread starter Thread starter Leon Mayne
  • Start date Start date
L

Leon Mayne

Hello,
I have the below code:

Set objCDO = CreateObject("MAPI.Session")
objCDO.Logon "", "", False, False
Set oOL = CreateObject("Outlook.Application")
For x = 1 To oOL.ActiveExplorer.Selection.Count
strID = oOL.ActiveExplorer.Selection.Item(x).EntryID
'Now get the item as a CDO Message
Set objMessage = objCDO.GetMessage(strID)
' Do stuff
Next

Which works fine if I am getting the message from the default container, but
if not, I get an error (obviously). So I need to specify the StoreID of the
current message thus:
Set objMessage = objCDO.GetMessage(strID, strStoreID)
but I can't find out how to get the current StoreID. Can anyone help?
 
Leon Mayne said:
if not, I get an error (obviously). So I need to specify the StoreID of the
current message thus:

Aha! Got it.
If anyone's interested for the future:
strStoreID = oOL.ActiveExplorer.Selection.Item(x).Parent.StoreID
 
The StoreID is a property of the item's Parent folder.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
Back
Top