|
|
|
date: 29 May 2006 05:43:59 -0700,
group: microsoft.public.exchange2000.general
back
Extended MAPI GetMailboxTable problem
hi,
here is my problem statement:
I am using Extended MAPI with c# (I have MAPI33 Wrapper) to log on to
an exchange server from my local machine and then loop through all the
mailboxes there (accessing some required mailboxes properties)
I create a session : MAPI.LogonEx(IntPtr.Zero, null, null,
MAPI.FLAGS.Extended | MAPI.FLAGS.LogonUI | MAPI.FLAGS.NewSession |
MAPI.FLAGS.ExplicitProfile, out session);
The profile i submit was created with my supplying the Exchange Server
name in the Profile Creation wizard ( I hope thats the correct thing to
do!!)
then :
IMAPITable mailboxTable = null;
IExchangeManageStore mngStore = null;
hr =
mngStore.GetMailboxTable("/cn=Configuration/cn=Servers/cn=addevdc01.devtenethealth.net",
out mailboxTable, 0);
if (hr != Error.Success) throw new Exception("Error: "+ hr.ToString());
Tags[] itags = new Tags[] {Tags.PR_ENTRYID, Tags.PR_LAST_LOGON_TIME,
Tags.PR_DISPLAY_NAME};
mailboxTable.SetColumns(itags, IMAPITable.FLAGS.Default);
hr = mailboxTable.QueryRows(2, 0, out rows);
if (hr != Error.Success) throw new Exception("Error: "+ hr.ToString());
mailboxTable.Dispose();
but obviously, I get "object reference not set to iunstance of an
object" error while calling GetMailboxTable since, mngStore object is
not initialised.
How can i overcome this? and get a list of all mailboxes on my remote
server
Just another thing to check is the ServerDN is pass through in the
GetMailboxTable??? I hope that is correct too!!!!
date: 29 May 2006 05:43:59 -0700
author: tarun
Re: Extended MAPI GetMailboxTable problem
I also understand that before calling GetMailboxTable , i need to call
hr = session.GetMsgStoresTable(0, out tblMsgStores); // tblMsgStores
is IMAPITABLE
hr = tblMsgStores.QueryRows(50, 0, out rows);
hr = session.OpenMsgStore(_Handle, lfolderEid, Guid.Empty, 0, out mdb)
//I am getting the folderEid correctly, mdb is IMSGSTORE
but I am not getting anything in the "mdb" object . Further, I cant
locate any method "QueryInterface" for this MDB object which I think
would initialize mngStore(IExchangeManageStore) to call GetMailboxTable
For your information my reference for this whole issue is
http://support.microsoft.com/?kbid=259570 .............. .though I m
writing my code in C# (the link is in C++)
Thanks in advance!!
date: 29 May 2006 06:06:32 -0700
author: tarun
|
|