On Tue, 2009-03-10 at 13:39 +0100, Paolo Abeni wrote: > hello, > > Porting a win32 mapi application to openchange, I have the need to > open many message stores within the same session. Currently, when I > open and close a 2nd mailbox, I start to get strange failures on the > operation performed on the first one. I.E. in the following code the > last libmapi call (the creation of the second message) fails. > > mapi_object_t store; > char* prof =0; > mapi_session* data=0; > mapi_object_store_t* str; > mapi_object_t inbox; > mapi_object_t sto2; > mapi_object_t msg2, msg1; > > GetDefaultProfile(&prof); > MapiLogonEx(&data, prof, 0); > > OpenUserMailbox(data, 0, &store); > > str = (mapi_object_store_t*) store.private_data; > OpenFolder(&store, str->fid_inbox, &inbox); > CreateMessage(&inbox, &msg1); > > OpenUserMailbox(data, data->profile->username, &sto2); > mapi_object_release(&sto2); > > // this operartion fails, even if all the previous ones has been > successful > CreateMessage(&inbox, &msg2); > > the CreateMessage() call return MAPI_E_CALL_FAILED and the nt status > code reported internally is 0xC0000023 (NT_STATUS_BUFFER_TOO_SMALL) . > I'm I doing something wrong ?!? It's allowed to open multiple time the > same message store ?!? > > Thanks in advance for any reply,
Hi Paulo,
The "store" opaque object returned by OpenUserMailbox, OpenMsgStore or
OpenPublicFolders is the first object you retrieve and which all further
MAPI calls depend on. Unless I'm wrong, this "should" mean this object
is supposed to be unique and only one active store object can be used
within a given session.
I have doubled checked libmapi's internals and there's no code which
would impact on the code pasted above but Exchange internal behavior.
OpenChange can however open multiple mailboxes/stores at the same time,
but each of them needs to be opened within a separated session (using
MapiLogonEx), which means different connections:
mapi_object_t store;
char* prof =0;
struct mapi_session *data,*data2=NULL;
mapi_object_store_t* str;
mapi_object_t inbox;
mapi_object_t sto2;
mapi_object_t msg2, msg1;
GetDefaultProfile(&prof);
MapiLogonEx(&data, prof, 0);
mapi_object_init(&store);
OpenUserMailbox(data, 0, &store);
str = (mapi_object_store_t*) store.private_data;
mapi_object_init(&inbox);
OpenFolder(&store, str->fid_inbox, &inbox);
mapi_object_init(&msg1);
CreateMessage(&inbox, &msg1);
MapiLogonEx(&data2, prof, 0);
mapi_object_init(&sto2);
OpenUserMailbox(data2, data2->profile->username, &sto2);
mapi_object_release(&sto2);
mapi_object_init(&msg2);
CreateMessage(&inbox, &msg2);
Cheers,
Julien.
---
Julien Kerihuel
[email protected]
OpenChange Project Manager
GPG Fingerprint: 0B55 783D A781 6329 108A B609 7EF6 FE11 A35F 1F79
signature.asc
Description: This is a digitally signed message part
_______________________________________________ devel mailing list [email protected] http://mailman.openchange.org/listinfo/devel
