Hi Julien,

I've now made sure that I associate ALL objects with the
store/provider that corresponds to the default folder at the root of
its hierarchy. With that change, all the previously working logic to
access Calendar (i.e. EMSDB-based) continues to work fine, and also, I
can now OpenFolder the OAB folders (i.e. NSPI-based).

Unfortunately, the subsequent GetContentTable call fails with
MAPI_E_NO_ACCESS. I wonder if this is because OAB files are in some
way "hidden", but that's just a guess. I did notice that the online
docs for this function seem to have been cut'n'paste from
GetHierarchyTable, so I'm not sure if there are some flags I can try?

The code is equivalent to this:

        if (MAPI_E_SUCCESS != OpenFolder(m_connection->store(m_id),
m_id.second, &m_object)) {
                error() << "cannot open folder" << m_id << mapiError();
                return false;
        }
        if (MAPI_E_SUCCESS != GetContentsTable(&m_object, &m_contents, 0, 
NULL)) {
                error() << "cannot get content table" << mapiError();
                return false;
        }

The error seems to be returned by the call to emsmdb_transaction_wrapper():

128             status = emsmdb_transaction_wrapper(session, mem_ctx,
mapi_request, &mapi_response);
(gdb)
129             OPENCHANGE_RETVAL_IF(!NT_STATUS_IS_OK(status),
MAPI_E_CALL_FAILED, mem_ctx);
(gdb)
130             OPENCHANGE_RETVAL_IF(!mapi_response->mapi_repl,
MAPI_E_CALL_FAILED, mem_ctx);
(gdb)
131             retval = mapi_response->mapi_repl->error_code;
(gdb)
132             OPENCHANGE_RETVAL_IF(retval, retval, mem_ctx);
(gdb) p retval
$6 = MAPI_E_NO_ACCESS

Any thoughts, or pointers to docs welcome!

Thanks, Shaheed


On 6 February 2012 11:13, Julien Kerihuel <j.kerih...@openchange.org> wrote:
> Hi Shaheed,
>
> Sorry for the lack of replies to your previous emails. They were on the
> top of my "to be replied" list, but several other urgent matters came
> into the pipe.
>
> On Sun, 2012-02-05 at 22:54 +0000, Shaheed Haque wrote:
>> First, I realised that I need to use GetDefaultPublicFolder() instead
>> of GetDefaultFolder() to find the id for olFolderPublicOfflineAB (for
>> example), and in order to do that, I need to have called
>> OpenPublicFolder() instead of OpenMsgStore().
>
> Correct.
>
>
>> This seemed to work and I was able to find the various folders under
>> olFolderPublicOfflineAB, but then I realised that olFolderContacts was
>> broken. I was able to overcome that by passing in a different "store"
>> variable to the second call:
>>
>>       if (MAPI_E_SUCCESS != OpenMsgStore(m_session, &m_store)) {
>>               ...
>>       }
>>       if (MAPI_E_SUCCESS != OpenPublicFolder(m_session, &m_storeOther)) {
>>               ...
>>       }
>
> That is exactly what you have to do.
>
> If you plan on opening both the store of a user AND public folders, then
> you have to use 2 different objects in the exact same way you did in
> previous code snipset.
>
>> At this point, calls to GetDefaultPublicFolder (for
>> olFolderPublicOfflineAB) and and GetDefaultFolder (for
>> olFolderContacts) both worked. Unfortunately, OpenFolder on the
>> olFolderPublicOfflineAB no longer works.
>
> Are you passing the correct object to OpenFolder?
>
> If you try to open a public folder using the mailbox store object, it
> won't work. You need to pass the public folder's one.
>
> Kind Regards,
> Julien.
>
> _______________________________________________
> devel mailing list
> devel@lists.openchange.org
> http://mailman.openchange.org/listinfo/devel
>
_______________________________________________
devel mailing list
devel@lists.openchange.org
http://mailman.openchange.org/listinfo/devel

Reply via email to