PRB: Cannot Store PR_ENTRYID in a Fixed Length FieldID: Q230749
|
When you encounter this problem, you have difficulty storing the PR_ENTRYID property into a fixed length field.
The size of an EntryID is implementation specific and not defined. Therefore, defining a fixed length field for storing a variable size EntryID, in a database for example, would be impossible.
You can use the PR_SOURCE_KEY property to calculate the PR_ENTRYID on a message or folder. Because PR_SOURCE_KEY is always a 22-byte property on Exchange Server, you can define the size of a field in the database in order to store this property. The PR_SOURCE_KEY can then be used to calculate the PR_ENTRYID through the use of the EntryIDFromSourceKey API.
For a message, you will also need the PR_SOURCE_KEY of the containing folder to calculate the message's PR_ENTRYID.
//Get the SourceKey on the newly created Message
hr = HrGetOneProp(lpMessage, PR_SOURCE_KEY, &lpMessageSK);
//Get the SourceKey on the message's containing folder
hr = HrGetOneProp(lpMessageCont, PR_SOURCE_KEY, &lpMessageFoldSK);
//Get the EntryID from the PR_SOURCE_KEYs that we just
//retrieved.
ULONG ulSizeOfEntryIDSK = 0;
LPENTRYID lpEntryIDSK = 0;
LPEXCHANGEMANAGESTORE lpXManageStore = 0;
ULONG lpulEntryIDResults = 0;
//Get a pointer to the IExchangeManageStore Interface off the store,
//through QueryInterface.
hr = lpDefStore->QueryInterface(IID_IExchangeManageStore,
(LPVOID*)&lpXManageStore);
//Run EntryIDFromSourceKey to get the message or folders EntryID
hr = lpXManageStore->EntryIDFromSourceKey(lpMessageFoldSK->Value.bin.cb,
lpMessageFoldSK->Value.bin.lpb,
lpMessageSK->Value.bin.cb,
lpMessageSK->Value.bin.lpb,
&ulSizeOfEntryIDSK,
&lpEntryIDSK);
This behavior is by design.
The PR_SOURCE_KEY property is not valid for messages and folders in Exchange Personal Message Stores(.PST).
The IExchangeManageStore(IID_IExchangeManageStore) GUID can be found in the EDKGUID.h header file.
For more information on PR_SOURCE_KEY property and the EntryIDFromSourceKey API, please refer to the Microsoft Developer Network.
Additional query words: MAPI PR_SOURCE_KEY PR_ENTRYID EntryID EntryIDFromSourceKey kbDSupport kbGrpMsg kbMsg kbVC600 kbMAPI
Keywords : kbMAPI kbMsg kbVC600 kbGrpMsg kbDSupport
Version : WINDOWS:1.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: June 10, 1999