"message changed" problem

C

clc

Hi,

I'm creating a new or editing an existing journalitem programmatically using C++ and Outlook Object Model using OL 2003 on XP.

My code (shortened for readability)

Assume I have a valid polApp (= _ApplicationPtr) and polNS (= _NameSpacePtr)

_JournalItemPtr pItem = (_JournalItemPtr) polApp->CreateItem( olJournalItem );

or

_JournalItemPtr pItem = polApp->polNS->GetItemFromID( vItemID, vStoreID );
....
pItem->Subject = CComBSTR(_T("My new subject")) ;
pItem->Save();
pItem->Close(olSave);

So far so cool right? And this works except that it seams like it leaves the item open. Meaning that if I open the same message in outlook, edit it and try to save it, I get the message

"This message has been modified by another user" And I can only create a copy or exit and loose my edit....

Any ideas?

Thank you!
Ben
 
Top