StoreID

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?
 
L

Leon Mayne

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
 
S

Sue Mosher [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top