Discussion:
Listing all Mailboxes in Exchange Server using MAPI irrespective of whether they have resources or not
(too old to reply)
deena
2007-06-18 06:13:35 UTC
Permalink
Hi all,

I was able to list some of the names of the mailboxes in Exchange
Server but could not list all the mail boxes in that Server. From the
previous posts in Exchange Group discussion, they directed to refer
the article Q194627 in MSDB Library, That article does not help in
listing all the users. But if I was logging into a user, that user was
additonally listed when next time I am executing the exe.

Any suggestions on this regard will be greatly appreciated.

Thanks in advance.
deenad
dummy
2007-06-18 08:36:03 UTC
Permalink
It is normal - code from Q194627, specially GetMailboxTable, return
MAILBOXES that EXISTS.. If some mail user (exchange account) never was
logged into Exchange, or was never recieved mail - mailbox is not created
and not listed... Check this: send a small e-mail - with 2 words to all
exchange recipients... wait 5 or 10 min (exchange server need time to
deliver mesage to all recipient) then run your application... you will see
all EXISTING mailboxes..
Post by deena
Hi all,
I was able to list some of the names of the mailboxes in Exchange
Server but could not list all the mail boxes in that Server. From the
previous posts in Exchange Group discussion, they directed to refer
the article Q194627 in MSDB Library, That article does not help in
listing all the users. But if I was logging into a user, that user was
additonally listed when next time I am executing the exe.
Any suggestions on this regard will be greatly appreciated.
Thanks in advance.
deenad
deena
2007-06-18 12:39:28 UTC
Permalink
Hi dummy,

Thanks for your reply. I would like to know a way how to list all
mailboxes(users) eventhough some of the the users were not logged in
or no mail was sent to them. I referenced Q194627 article(MSDN
Library) in my previous post as I thought that this article would be
able to resolve the issue but not..

Hope someone would come up with the solution.

Thanks in advance
deenad
Post by dummy
It is normal - code from Q194627, specially GetMailboxTable, return
MAILBOXES that EXISTS.. If some mail user (exchange account) never was
logged into Exchange, or was never recieved mail - mailbox is not created
and not listed... Check this: send a small e-mail - with 2 words to all
exchange recipients... wait 5 or 10 min (exchange server need time to
deliver mesage to all recipient) then run your application... you will see
all EXISTING mailboxes..
Post by deena
Hi all,
I was able to list some of the names of the mailboxes in Exchange
Server but could not list all the mail boxes in that Server. From the
previous posts in Exchange Group discussion, they directed to refer
the article Q194627 in MSDB Library, That article does not help in
listing all the users. But if I was logging into a user, that user was
additonally listed when next time I am executing the exe.
Any suggestions on this regard will be greatly appreciated.
Thanks in advance.
deenad
dummy
2007-06-18 20:57:26 UTC
Permalink
Open GAL (GLOBALL ADDRESS LIST) and create restriction by property
PR_EMS_AB_HOME_MDB or PR_EMS_AB_HOME_MTA
Post by deena
Hi dummy,
Thanks for your reply. I would like to know a way how to list all
mailboxes(users) eventhough some of the the users were not logged in
or no mail was sent to them. I referenced Q194627 article(MSDN
Library) in my previous post as I thought that this article would be
able to resolve the issue but not..
Hope someone would come up with the solution.
Thanks in advance
deenad
Post by dummy
It is normal - code from Q194627, specially GetMailboxTable, return
MAILBOXES that EXISTS.. If some mail user (exchange account) never was
logged into Exchange, or was never recieved mail - mailbox is not created
and not listed... Check this: send a small e-mail - with 2 words to all
exchange recipients... wait 5 or 10 min (exchange server need time to
deliver mesage to all recipient) then run your application... you will see
all EXISTING mailboxes..
Post by deena
Hi all,
I was able to list some of the names of the mailboxes in Exchange
Server but could not list all the mail boxes in that Server. From the
previous posts in Exchange Group discussion, they directed to refer
the article Q194627 in MSDB Library, That article does not help in
listing all the users. But if I was logging into a user, that user was
additonally listed when next time I am executing the exe.
Any suggestions on this regard will be greatly appreciated.
Thanks in advance.
deenad
dummy
2007-06-18 21:00:48 UTC
Permalink
Also PLEASE, note that there are differences between USERS and MAILBOXES...

Users can > that MAILBOXES
Post by deena
Hi dummy,
Thanks for your reply. I would like to know a way how to list all
mailboxes(users) eventhough some of the the users were not logged in
or no mail was sent to them. I referenced Q194627 article(MSDN
Library) in my previous post as I thought that this article would be
able to resolve the issue but not..
Hope someone would come up with the solution.
Thanks in advance
deenad
Post by dummy
It is normal - code from Q194627, specially GetMailboxTable, return
MAILBOXES that EXISTS.. If some mail user (exchange account) never was
logged into Exchange, or was never recieved mail - mailbox is not created
and not listed... Check this: send a small e-mail - with 2 words to all
exchange recipients... wait 5 or 10 min (exchange server need time to
deliver mesage to all recipient) then run your application... you will see
all EXISTING mailboxes..
Post by deena
Hi all,
I was able to list some of the names of the mailboxes in Exchange
Server but could not list all the mail boxes in that Server. From the
previous posts in Exchange Group discussion, they directed to refer
the article Q194627 in MSDB Library, That article does not help in
listing all the users. But if I was logging into a user, that user was
additonally listed when next time I am executing the exe.
Any suggestions on this regard will be greatly appreciated.
Thanks in advance.
deenad
deena
2007-06-19 08:44:43 UTC
Permalink
Hi dummy,

Thanks for pointing out my ignorance between users and mailboxes.

After following the steps(Opening GAL...), the restrict method of
LPMAPITABLE fails with the error E_INVALIDARG.
From this I believe that one of the argument of the restrict method
was wrong.

Here is the code
SPropValue spv;
spv.ulPropTag = PR_EMS_AB_HOME_MTA;
spv.Value.b = TRUE;

SRestriction sres;
sres.rt = RES_PROPERTY;
sres.res.resProperty.relop = RELOP_EQ;
sres.res.resProperty.ulPropTag = PR_EMS_AB_HOME_MTA;
sres.res.resProperty.lpProp = &spv;

Can you please direct me where i am going wrong??

Thanks
deenad
Also PLEASE, note that there are differences between USERS and MAILBOXES...
Users can > that MAILBOXES
Post by deena
Hi dummy,
Thanks for your reply. I would like to know a way how to list all
mailboxes(users) eventhough some of the the users were not logged in
or no mail was sent to them. I referenced Q194627 article(MSDN
Library) in my previous post as I thought that this article would be
able to resolve the issue but not..
Hope someone would come up with the solution.
Thanks in advance
deenad
Post by dummy
It is normal - code from Q194627, specially GetMailboxTable, return
MAILBOXES that EXISTS.. If some mail user (exchange account) never was
logged into Exchange, or was never recieved mail - mailbox is not created
and not listed... Check this: send a small e-mail - with 2 words to all
exchange recipients... wait 5 or 10 min (exchange server need time to
deliver mesage to all recipient) then run your application... you will see
all EXISTING mailboxes..
Post by deena
Hi all,
I was able to list some of the names of the mailboxes in Exchange
Server but could not list all the mail boxes in that Server. From the
previous posts in Exchange Group discussion, they directed to refer
the article Q194627 in MSDB Library, That article does not help in
listing all the users. But if I was logging into a user, that user was
additonally listed when next time I am executing the exe.
Any suggestions on this regard will be greatly appreciated.
Thanks in advance.
deenad
Henry Gusakovsky
2007-06-19 21:42:34 UTC
Permalink
PR_EMS_AB_HOME_MTA is a string property and not BOOL
so
SPropValue spv;
spv.ulPropTag = PR_EMS_AB_HOME_MTA;
spv.Value.b = TRUE;
this code is wrong.

Regards
Henry
Post by deena
Hi dummy,
Thanks for pointing out my ignorance between users and mailboxes.
After following the steps(Opening GAL...), the restrict method of
LPMAPITABLE fails with the error E_INVALIDARG.>From this I believe that one of the argument of the restrict method
was wrong.
Here is the code
SPropValue spv;
spv.ulPropTag = PR_EMS_AB_HOME_MTA;
spv.Value.b = TRUE;
SRestriction sres;
sres.rt = RES_PROPERTY;
sres.res.resProperty.relop = RELOP_EQ;
sres.res.resProperty.ulPropTag = PR_EMS_AB_HOME_MTA;
sres.res.resProperty.lpProp = &spv;
Can you please direct me where i am going wrong??
Thanks
deenad
Post by dummy
Also PLEASE, note that there are differences between USERS and MAILBOXES...
Users can > that MAILBOXES
Post by deena
Hi dummy,
Thanks for your reply. I would like to know a way how to list all
mailboxes(users) eventhough some of the the users were not logged in
or no mail was sent to them. I referenced Q194627 article(MSDN
Library) in my previous post as I thought that this article would be
able to resolve the issue but not..
Hope someone would come up with the solution.
Thanks in advance
deenad
Post by dummy
It is normal - code from Q194627, specially GetMailboxTable, return
MAILBOXES that EXISTS.. If some mail user (exchange account) never was
logged into Exchange, or was never recieved mail - mailbox is not created
and not listed... Check this: send a small e-mail - with 2 words to all
exchange recipients... wait 5 or 10 min (exchange server need time to
deliver mesage to all recipient) then run your application... you will see
all EXISTING mailboxes..
Post by deena
Hi all,
I was able to list some of the names of the mailboxes in Exchange
Server but could not list all the mail boxes in that Server. From the
previous posts in Exchange Group discussion, they directed to refer
the article Q194627 in MSDB Library, That article does not help in
listing all the users. But if I was logging into a user, that user was
additonally listed when next time I am executing the exe.
Any suggestions on this regard will be greatly appreciated.
Thanks in advance.
deenad
deena
2007-06-20 09:03:58 UTC
Permalink
Thanks for your reply Henry, Where do i find the type of the PROPERTY
i.e whether it was string or bool or ULONG.

SPropValue spv;
spv.ulPropTag = PR_EMS_AB_HOME_MTA;
//spv.Value.b = TRUE;
spv.Value.lpsz = "/o=../ou=../cn=.."

Even the above code fails in a way that no users were returned, the
output value (no of rows returned) is Zero. Without applying
restriction based on PR_EMS_AB_HOME_MTA, I was able to get all the
users in that Exchange Server

Thanks
deenad
Post by Henry Gusakovsky
PR_EMS_AB_HOME_MTA is a string property and not BOOL
so
SPropValue spv;
spv.ulPropTag = PR_EMS_AB_HOME_MTA;
spv.Value.b = TRUE;
this code is wrong.
Regards
Henry
Post by deena
Hi dummy,
Thanks for pointing out my ignorance between users and mailboxes.
After following the steps(Opening GAL...), the restrict method of
LPMAPITABLE fails with the error E_INVALIDARG.>From this I believe that one of the argument of the restrict method
was wrong.
Here is the code
SPropValue spv;
spv.ulPropTag = PR_EMS_AB_HOME_MTA;
spv.Value.b = TRUE;
SRestriction sres;
sres.rt = RES_PROPERTY;
sres.res.resProperty.relop = RELOP_EQ;
sres.res.resProperty.ulPropTag = PR_EMS_AB_HOME_MTA;
sres.res.resProperty.lpProp = &spv;
Can you please direct me where i am going wrong??
Thanks
deenad
Post by dummy
Also PLEASE, note that there are differences between USERS and MAILBOXES...
Users can > that MAILBOXES
Post by deena
Hi dummy,
Thanks for your reply. I would like to know a way how to list all
mailboxes(users) eventhough some of the the users were not logged in
or no mail was sent to them. I referenced Q194627 article(MSDN
Library) in my previous post as I thought that this article would be
able to resolve the issue but not..
Hope someone would come up with the solution.
Thanks in advance
deenad
Post by dummy
It is normal - code from Q194627, specially GetMailboxTable, return
MAILBOXES that EXISTS.. If some mail user (exchange account) never was
logged into Exchange, or was never recieved mail - mailbox is not created
and not listed... Check this: send a small e-mail - with 2 words to all
exchange recipients... wait 5 or 10 min (exchange server need time to
deliver mesage to all recipient) then run your application... you will see
all EXISTING mailboxes..
Post by deena
Hi all,
I was able to list some of the names of the mailboxes in Exchange
Server but could not list all the mail boxes in that Server. From the
previous posts in Exchange Group discussion, they directed to refer
the article Q194627 in MSDB Library, That article does not help in
listing all the users. But if I was logging into a user, that user was
additonally listed when next time I am executing the exe.
Any suggestions on this regard will be greatly appreciated.
Thanks in advance.
deenad
deena
2007-06-20 10:04:51 UTC
Permalink
Hi all,

Thanks for your reply Henry, Where do i find the type of the PROPERTY
i.e whether it was string or bool or ULONG.

char tempValue[] = "/o=.../ou=.../cn=...";
SPropValue spv;
spv.ulPropTag = PR_EMS_AB_HOME_MTA;
//spv.Value.b = TRUE;
spv.Value.lpszA = (LPTSTR)tempValue;

Even the above code fails in a way that no users were returned, the
output value (no of rows returned) is Zero. Without applying
restriction based on PR_EMS_AB_HOME_MTA, I was able to get all the
users in that Exchange Server.

Any suggestions..

Thanks
deenad
Post by Henry Gusakovsky
PR_EMS_AB_HOME_MTA is a string property and not BOOL
so
SPropValue spv;
spv.ulPropTag = PR_EMS_AB_HOME_MTA;
spv.Value.b = TRUE;
this code is wrong.
Regards
Henry
Post by deena
Hi dummy,
Thanks for pointing out my ignorance between users and mailboxes.
After following the steps(Opening GAL...), the restrict method of
LPMAPITABLE fails with the error E_INVALIDARG.>From this I believe that one of the argument of the restrict method
was wrong.
Here is the code
SPropValue spv;
spv.ulPropTag = PR_EMS_AB_HOME_MTA;
spv.Value.b = TRUE;
SRestriction sres;
sres.rt = RES_PROPERTY;
sres.res.resProperty.relop = RELOP_EQ;
sres.res.resProperty.ulPropTag = PR_EMS_AB_HOME_MTA;
sres.res.resProperty.lpProp = &spv;
Can you please direct me where i am going wrong??
Thanks
deenad
Post by dummy
Also PLEASE, note that there are differences between USERS and MAILBOXES...
Users can > that MAILBOXES
Post by deena
Hi dummy,
Thanks for your reply. I would like to know a way how to list all
mailboxes(users) eventhough some of the the users were not logged in
or no mail was sent to them. I referenced Q194627 article(MSDN
Library) in my previous post as I thought that this article would be
able to resolve the issue but not..
Hope someone would come up with the solution.
Thanks in advance
deenad
Post by dummy
It is normal - code from Q194627, specially GetMailboxTable, return
MAILBOXES that EXISTS.. If some mail user (exchange account) never was
logged into Exchange, or was never recieved mail - mailbox is not created
and not listed... Check this: send a small e-mail - with 2 words to all
exchange recipients... wait 5 or 10 min (exchange server need time to
deliver mesage to all recipient) then run your application... you will see
all EXISTING mailboxes..
Post by deena
Hi all,
I was able to list some of the names of the mailboxes in Exchange
Server but could not list all the mail boxes in that Server. From the
previous posts in Exchange Group discussion, they directed to refer
the article Q194627 in MSDB Library, That article does not help in
listing all the users. But if I was logging into a user, that user was
additonally listed when next time I am executing the exe.
Any suggestions on this regard will be greatly appreciated.
Thanks in advance.
deenad
Henry Gusakovsky
2007-06-20 12:53:33 UTC
Permalink
Post by deena
Hi all,
Thanks for your reply Henry, Where do i find the type of the PROPERTY
i.e whether it was string or bool or ULONG.
look at the define of PR_EMS_AB_HOME_MTA in emsabtag.h
it is defined as
#define PR_EMS_AB_HOME_MTA PROP_TAG( PT_TSTRING, 0x8007)
first field is type of the property.
So every MAPI property has definition something like this.

Regards
Henry
Post by deena
char tempValue[] = "/o=.../ou=.../cn=...";
SPropValue spv;
spv.ulPropTag = PR_EMS_AB_HOME_MTA;
//spv.Value.b = TRUE;
spv.Value.lpszA = (LPTSTR)tempValue;
Even the above code fails in a way that no users were returned, the
output value (no of rows returned) is Zero. Without applying
restriction based on PR_EMS_AB_HOME_MTA, I was able to get all the
users in that Exchange Server.
Any suggestions..
Thanks
deenad
Post by Henry Gusakovsky
PR_EMS_AB_HOME_MTA is a string property and not BOOL
so
SPropValue spv;
spv.ulPropTag = PR_EMS_AB_HOME_MTA;
spv.Value.b = TRUE;
this code is wrong.
Regards
Henry
Post by deena
Hi dummy,
Thanks for pointing out my ignorance between users and mailboxes.
After following the steps(Opening GAL...), the restrict method of
LPMAPITABLE fails with the error E_INVALIDARG.>From this I believe that one of the argument of the restrict method
was wrong.
Here is the code
SPropValue spv;
spv.ulPropTag = PR_EMS_AB_HOME_MTA;
spv.Value.b = TRUE;
SRestriction sres;
sres.rt = RES_PROPERTY;
sres.res.resProperty.relop = RELOP_EQ;
sres.res.resProperty.ulPropTag = PR_EMS_AB_HOME_MTA;
sres.res.resProperty.lpProp = &spv;
Can you please direct me where i am going wrong??
Thanks
deenad
Post by dummy
Also PLEASE, note that there are differences between USERS and MAILBOXES...
Users can > that MAILBOXES
Post by deena
Hi dummy,
Thanks for your reply. I would like to know a way how to list all
mailboxes(users) eventhough some of the the users were not logged in
or no mail was sent to them. I referenced Q194627 article(MSDN
Library) in my previous post as I thought that this article would be
able to resolve the issue but not..
Hope someone would come up with the solution.
Thanks in advance
deenad
Post by dummy
It is normal - code from Q194627, specially GetMailboxTable, return
MAILBOXES that EXISTS.. If some mail user (exchange account) never was
logged into Exchange, or was never recieved mail - mailbox is not created
and not listed... Check this: send a small e-mail - with 2 words to all
exchange recipients... wait 5 or 10 min (exchange server need time to
deliver mesage to all recipient) then run your application... you will
see
all EXISTING mailboxes..
Post by deena
Hi all,
I was able to list some of the names of the mailboxes in Exchange
Server but could not list all the mail boxes in that Server. From the
previous posts in Exchange Group discussion, they directed to refer
the article Q194627 in MSDB Library, That article does not help in
listing all the users. But if I was logging into a user, that user was
additonally listed when next time I am executing the exe.
Any suggestions on this regard will be greatly appreciated.
Thanks in advance.
deenad
deena
2007-06-21 05:16:54 UTC
Permalink
Hi Henry,

Thanks for pointing out the declaration.
On the other question, I do feel that the filter can be done in my
native code itself.

Once again Thanks for all your help.
deena:> Hi all,
Post by deena
Thanks for your reply Henry, Where do i find the type of the PROPERTY
i.e whether it was string or bool or ULONG.
look at the define of PR_EMS_AB_HOME_MTA in emsabtag.h
it is defined as
#define PR_EMS_AB_HOME_MTA PROP_TAG( PT_TSTRING, 0x8007)
first field is type of the property.
So every MAPI property has definition something like this.
Regards
Henry
Post by deena
char tempValue[] = "/o=.../ou=.../cn=...";
SPropValue spv;
spv.ulPropTag = PR_EMS_AB_HOME_MTA;
//spv.Value.b = TRUE;
spv.Value.lpszA = (LPTSTR)tempValue;
Even the above code fails in a way that no users were returned, the
output value (no of rows returned) is Zero. Without applying
restriction based on PR_EMS_AB_HOME_MTA, I was able to get all the
users in that Exchange Server.
Any suggestions..
Thanks
deenad
Post by Henry Gusakovsky
PR_EMS_AB_HOME_MTA is a string property and not BOOL
so
SPropValue spv;
spv.ulPropTag = PR_EMS_AB_HOME_MTA;
spv.Value.b = TRUE;
this code is wrong.
Regards
Henry
Post by deena
Hi dummy,
Thanks for pointing out my ignorance between users and mailboxes.
After following the steps(Opening GAL...), the restrict method of
LPMAPITABLE fails with the error E_INVALIDARG.>From this I believe that one of the argument of the restrict method
was wrong.
Here is the code
SPropValue spv;
spv.ulPropTag = PR_EMS_AB_HOME_MTA;
spv.Value.b = TRUE;
SRestriction sres;
sres.rt = RES_PROPERTY;
sres.res.resProperty.relop = RELOP_EQ;
sres.res.resProperty.ulPropTag = PR_EMS_AB_HOME_MTA;
sres.res.resProperty.lpProp = &spv;
Can you please direct me where i am going wrong??
Thanks
deenad
Post by dummy
Also PLEASE, note that there are differences between USERS and MAILBOXES...
Users can > that MAILBOXES
Post by deena
Hi dummy,
Thanks for your reply. I would like to know a way how to list all
mailboxes(users) eventhough some of the the users were not logged in
or no mail was sent to them. I referenced Q194627 article(MSDN
Library) in my previous post as I thought that this article would be
able to resolve the issue but not..
Hope someone would come up with the solution.
Thanks in advance
deenad
Post by dummy
It is normal - code from Q194627, specially GetMailboxTable, return
MAILBOXES that EXISTS.. If some mail user (exchange account) never was
logged into Exchange, or was never recieved mail - mailbox is not created
and not listed... Check this: send a small e-mail - with 2 words to all
exchange recipients... wait 5 or 10 min (exchange server need time to
deliver mesage to all recipient) then run your application... you will
see
all EXISTING mailboxes..
Post by deena
Hi all,
I was able to list some of the names of the mailboxes in Exchange
Server but could not list all the mail boxes in that Server. From the
previous posts in Exchange Group discussion, they directed to refer
the article Q194627 in MSDB Library, That article does not help in
listing all the users. But if I was logging into a user, that user was
additonally listed when next time I am executing the exe.
Any suggestions on this regard will be greatly appreciated.
Thanks in advance.
deenad
Loading...