Search code examples
c#interopoutlook-redemption

MAPI_E_INVALID_ENTRYID when getting contact from Outlook via Redemption


I'd like to retrieve a contact with a known EntryID in a specific folder from outlook/exchange using Redemption.

The following code calls GetMessageFromID on an RDOSession object. I only want contacts from the standard Contacts folder, so I use the second argument to limit the search space.

RDOFolder folder = Session.GetDefaultFolder(rdoDefaultFolders.olFolderContacts);
RDOContactItem i = Session.GetMessageFromID(syncRow.SyncId, folder.EntryID, null) as RDOContactItem;

Whenever I do this redemption throws a COM exception: Error in IMAPISession.OpenMsgStore: MAPI_E_INVALID_ENTRYID. What am I doing wrong?


Solution

  • GetMessageFromID takes 2 entry ids as parameters (1 required, 1 optional) - the message entry id and the store entry id. It looks like you are passing a folder entry id instead of a store entry id.