OL2003: Open Mailitem

  • Thread starter =?ISO-8859-15?Q?Ren=E9_Panzeri?=
  • Start date
?

=?ISO-8859-15?Q?Ren=E9_Panzeri?=

Hi

I try to open a mailitem out of a database with the following code

Dim appOutlook As Outlook.Application
Dim olNamespace As Outlook.NameSpace
Dim olElement As Outlook.MailItem
Dim olInspector As Object


Set appOutlook = New Outlook.Application
Set olNamespace = appOutlook.GetNamespace("MAPI")
-> Set olElement = olNamespace.GetItemFromID(EntryID)
Set olInspector = olElement.GetInspector

olInspector.Display


set olElement brings error -520879615 "unknown error"

Thanks for your help

René
 
S

Sue Mosher [MVP-Outlook]

If this item is in any store other than the default store, you will need to specify the StoreID parameter as well as the EntryID parameter for GetItemFromID.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
?

=?ISO-8859-15?Q?Ren=E9_Panzeri?=

Hi Sue

Thanks for your help.

All mails are stored in a Access-2003-Database with exactly the same
fields as in MS Outlook. How can i get the StoreID for a database-path?

I tried the following but this ended with error 13:

Set myFolder =
appOutlook.Session.GetDefaultFolder("c:\myDatabasePath\Mails\")
myStoreID = myFolder.StoreID

Thank you
René




If this item is in any store other than the default store, you will need
to specify the StoreID parameter as well as the EntryID parameter for
GetItemFromID.
 
S

Sue Mosher [MVP-Outlook]

I don't understand what you're trying to do with GetDefaultFolder.

GetItemFromID opens items stored in Outlook, not items stored in a database. You could iterate all the stores in Namespace.Folders and then use each StoreID in turn to try to return these items for which you have only an EntryID.

The better longterm solution might be to store both the EntryID and the StoreID in the database.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and 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