DaBozUK

I've read the MSDN docs for IMessage SaveChanges() method:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/mapi...

and it says you use KEEP_OPEN_READWRITE to keep the item open after
saving changes, and if that fails with MAPI_E_OBJECT_CHANGED you should
retry with FORCE_SAVE.

And it appears if you call SaveChanges with KEEP_OPEN_READWRITE
followed later by another identical call, then you get the
MAPI_E_OBJECT_CHANGED error.

But in the real world of coding, if you have some complex logic it's
quite likely you'll refactor code into several methods which could be
setting properties and custom properties and you cannot necessarily
guarantee the order of each method or whether they are called at all.

In this case, SaveChanges with KEEP_OPEN_READWRITE could happen many
times, once or not all. (Is this making sense so far )

So what's the correct way round this problem I've seen examples where
KEEP_OPEN_READWRITE and FORCE_SAVE are or'ed together without checking
for MAPI_E_OBJECT_CHANGED:
http://support.microsoft.com/kb/308281

Is that right If so, the official reference documentation is a bit
misleading.

It might be worth saying at this point, that code that was fine with
Outlook 2003 is now throwing up MAPI_E_OBJECT_CHANGED with Outlook
2007. I'm going to investigate why further, but I thought I'd ask for
advice on the correct usage in the meantime.

Apologies if this is a bit rambling.

Boz



Re: Visual Studio Tools for Office MAPI - Proper use of IMessage SaveChanges() flags?

Sue Mosher - Outlook MVP

You might want to ask this in one of the discussion forums for Extended MAPI issues (see http://www.outlookcode.com/d/mapi.htm#discuss). Since ExMAPI isn't supported in .NET languages, it's a bit beyond the scope of this forum.



Re: Visual Studio Tools for Office MAPI - Proper use of IMessage SaveChanges() flags?

DaBozUK

I'll ask there, but I chose this particular forum in the MSDN Forums after searching for "MAPI" and discovering a large number of results.

Do the MSDN Forums only apply to .NET languages now

Boz





Re: Visual Studio Tools for Office MAPI - Proper use of IMessage SaveChanges() flags?

Sue Mosher - Outlook MVP

No, but this particular forum is for Visual Studio Tools for Office, which is a .NET programming application.



Re: Visual Studio Tools for Office MAPI - Proper use of IMessage SaveChanges() flags?

DaBozUK

Sorry, misread the forum description. Looks like Microsoft don't have a forum for MAPI. Nice.

Boz





Re: Visual Studio Tools for Office MAPI - Proper use of IMessage SaveChanges() flags?

Sue Mosher - Outlook MVP

Not an MSDN forum, but newsgroups, as listed on the page I suggested.