How do I create a user ser with mailbox and get the email ..

Huw

Distinguished
May 29, 2004
8
0
18,510
Archived from groups: microsoft.public.active.directory.interfaces,microsoft.public.adsi.general,microsoft.public.win2000.active_directory (More info?)

Hi,

I'm trying to create a user and a mailbox through AD interfaces.

I create the user fine, and then create the mailbox using CreateMailbox on
the IMailboxStore interface, this also works fine.

After that, I need to get the email address for the user back from the
object so I can store it.

When I try to get the value back by either getting the "mail" property or
calling get_EmailAddress on the IAdsUser object, then it always returns
E_ADS_PROPERTY_NOT_FOUND.

I found an article on the net suggesting setting the
msExchUserAccountControl property to 0 before calling CreateMailbox, but
that didn't work either. I've also tried GetInfo and tried getting hold of
the object again in the hope it refreshes itself.

It seems like there is a delay before the email address is populated. Does
anyone have any idea how to "flush" these values through so I can read the
email address immediately?

Thanks,
Huw
 
G

Guest

Guest
Archived from groups: microsoft.public.active.directory.interfaces,microsoft.public.adsi.general,microsoft.public.win2000.active_directory (More info?)

When you call createmailbox you don't actually create the mailbox, you populate
data in the directory. When the RUS notices the change and is able to process it
it will look the object over and stamp the rest of the attributes including
the mail attribute. Depending on which DC the RUS is looking at this could vary
how long it takes to get to the point that the object is "stamped" and then how
long before you see the change (the stamped attributes have to replicate back to
the DC you are using).

Basically you can't force it on the spot. You have to wait. If you understand
your recipient policies you can probably generate the email address yourself
that would be created. If you have multiple policies or a complicated policy
this is more difficult.

joe

--
Joe Richards Microsoft MVP Windows Server Directory Services
www.joeware.net


Huw wrote:
> Hi,
>
> I'm trying to create a user and a mailbox through AD interfaces.
>
> I create the user fine, and then create the mailbox using CreateMailbox on
> the IMailboxStore interface, this also works fine.
>
> After that, I need to get the email address for the user back from the
> object so I can store it
>
> When I try to get the value back by either getting the "mail" property or
> calling get_EmailAddress on the IAdsUser object, then it always returns
> E_ADS_PROPERTY_NOT_FOUND.
>
> I found an article on the net suggesting setting the
> msExchUserAccountControl property to 0 before calling CreateMailbox, but
> that didn't work either. I've also tried GetInfo and tried getting hold of
> the object again in the hope it refreshes itself.
>
> It seems like there is a delay before the email address is populated. Does
> anyone have any idea how to "flush" these values through so I can read the
> email address immediately?
>
> Thanks,
> Huw
>
>