|
|
|
date: Sat, 27 May 2006 14:46:02 -0700,
group: microsoft.public.exchange2000.development
back
particulars of MailEnable
Hi,
I have an ASP.NET web application that is creating contact objects in AD. At
the time of contact creation, I want to enable emails to that contact. I have
read about MailEnable from IMailRecipient, and that seems to be the thing to
call. The documentation states that it sets the properties: ProxyAddresses,
SMTPEmail and X400Email.
Mostly that works, but there does seem to be some timing involved. During a
debug session, if I wait long enough between creating the AD contact and
calling MailEnable, it fails (lets say 30 seconds). If I step straight
through the code, no problem.
In addition to that timing issue, I have a couple of other questions that
the documentation and code samples don't seem to cover:
1) How do I set up an alternate email address? I wouldn't call MailEnable on
each address, would I? Must I set ProxyAddresses manually? Should the
alternate email be "smtp:" instead of "SMTP:"?
2)Related to above, does MailEnable particularly set the primary (SMTP:)
email address of ProxyAddresses?
3) What if I want to modify an email address later (either primary or
alternate)? I always seem to get an error when calling MailEnable on an
existing contact with existing primary and alternate email addresses. For
existing contacts, I've tried just setting ProxyAddresses and skipping the
call to MailEnable, but it doesn't update other properties, such as Email on
the General tab and Email on the Exchange General tab (in AD Properties).
In short, I guess I need more details on when to call MailEnable, what other
calls to make or properties to set, and in what order, when both creating and
modifying an AD contact.
Thanks very much for any help,
date: Sat, 27 May 2006 14:46:02 -0700
author: T Ray Humphrey
Re: particulars of MailEnable
Hello,
when you mail-enable a contact or user, the RUS (Recipient update service)
will set the necessary attributes. This will, however, take some time (I
believe up to two minutes).
It will set the proxyAddresses according to the recipient policies defined
in the system manager.
> 1) How do I set up an alternate email address? I wouldn't call MailEnable
> on
> each address, would I? Must I set ProxyAddresses manually? Should the
> alternate email be "smtp:" instead of "SMTP:"?
You should create another recipient policy or modify an existing one.
And those secondary emails would get a smtp: prefix instead an SMTP: prefix,
since the all-upper-case entry defines the default address.
> 2)Related to above, does MailEnable particularly set the primary (SMTP:)
> email address of ProxyAddresses?
Yes
> 3) What if I want to modify an email address later (either primary or
> alternate)? I always seem to get an error when calling MailEnable on an
> existing contact with existing primary and alternate email addresses. For
> existing contacts, I've tried just setting ProxyAddresses and skipping the
> call to MailEnable, but it doesn't update other properties, such as Email
> on
> the General tab and Email on the Exchange General tab (in AD Properties).
You should change the recipient policy. The RUS will take care of the rest.
> In short, I guess I need more details on when to call MailEnable, what
> other
> calls to make or properties to set, and in what order, when both creating
> and
> modifying an AD contact.
Just call mailenable when creating the object.
Best regards,
Henning Krause
"T Ray Humphrey" wrote in message
news:BFF263F7-AD96-4682-A13D-1A0850904441@microsoft.com...
> Hi,
> I have an ASP.NET web application that is creating contact objects in AD.
> At
> the time of contact creation, I want to enable emails to that contact. I
> have
> read about MailEnable from IMailRecipient, and that seems to be the thing
> to
> call. The documentation states that it sets the properties:
> ProxyAddresses,
> SMTPEmail and X400Email.
>
> Mostly that works, but there does seem to be some timing involved. During
> a
> debug session, if I wait long enough between creating the AD contact and
> calling MailEnable, it fails (lets say 30 seconds). If I step straight
> through the code, no problem.
>
> In addition to that timing issue, I have a couple of other questions that
> the documentation and code samples don't seem to cover:
> 1) How do I set up an alternate email address? I wouldn't call MailEnable
> on
> each address, would I? Must I set ProxyAddresses manually? Should the
> alternate email be "smtp:" instead of "SMTP:"?
> 2)Related to above, does MailEnable particularly set the primary (SMTP:)
> email address of ProxyAddresses?
> 3) What if I want to modify an email address later (either primary or
> alternate)? I always seem to get an error when calling MailEnable on an
> existing contact with existing primary and alternate email addresses. For
> existing contacts, I've tried just setting ProxyAddresses and skipping the
> call to MailEnable, but it doesn't update other properties, such as Email
> on
> the General tab and Email on the Exchange General tab (in AD Properties).
>
> In short, I guess I need more details on when to call MailEnable, what
> other
> calls to make or properties to set, and in what order, when both creating
> and
> modifying an AD contact.
>
> Thanks very much for any help,
date: Sun, 28 May 2006 01:38:31 +0200
author: Henning Krause
Re: particulars of MailEnable
Thanks for your prompt response. I see I need to provide information I didn't
before.
The web application is the front-end for an Exchange hosted solution. It is
used by administrators to manage users, groups, and contacts in their
assigned OU. It acts a bit like the Property pages in AD, exposing only those
attributes I allow them to manage. I'm aware of the RUS and its creation of
addresses for me. But I must allow my users to set any alternate address they
like, as well as change primary and alternate addresses at will. I don't
think the RUS would help me here.
"Henning Krause" wrote:
> Hello,
>
> when you mail-enable a contact or user, the RUS (Recipient update service)
> will set the necessary attributes. This will, however, take some time (I
> believe up to two minutes).
>
> It will set the proxyAddresses according to the recipient policies defined
> in the system manager.
>
> > 1) How do I set up an alternate email address? I wouldn't call MailEnable
> > on
> > each address, would I? Must I set ProxyAddresses manually? Should the
> > alternate email be "smtp:" instead of "SMTP:"?
> You should create another recipient policy or modify an existing one.
>
> And those secondary emails would get a smtp: prefix instead an SMTP: prefix,
> since the all-upper-case entry defines the default address.
>
> > 2)Related to above, does MailEnable particularly set the primary (SMTP:)
> > email address of ProxyAddresses?
> Yes
>
>
> > 3) What if I want to modify an email address later (either primary or
> > alternate)? I always seem to get an error when calling MailEnable on an
> > existing contact with existing primary and alternate email addresses. For
> > existing contacts, I've tried just setting ProxyAddresses and skipping the
> > call to MailEnable, but it doesn't update other properties, such as Email
> > on
> > the General tab and Email on the Exchange General tab (in AD Properties).
> You should change the recipient policy. The RUS will take care of the rest.
>
> > In short, I guess I need more details on when to call MailEnable, what
> > other
> > calls to make or properties to set, and in what order, when both creating
> > and
> > modifying an AD contact.
> Just call mailenable when creating the object.
>
> Best regards,
> Henning Krause
>
> "T Ray Humphrey" wrote in message
> news:BFF263F7-AD96-4682-A13D-1A0850904441@microsoft.com...
> > Hi,
> > I have an ASP.NET web application that is creating contact objects in AD.
> > At
> > the time of contact creation, I want to enable emails to that contact. I
> > have
> > read about MailEnable from IMailRecipient, and that seems to be the thing
> > to
> > call. The documentation states that it sets the properties:
> > ProxyAddresses,
> > SMTPEmail and X400Email.
> >
> > Mostly that works, but there does seem to be some timing involved. During
> > a
> > debug session, if I wait long enough between creating the AD contact and
> > calling MailEnable, it fails (lets say 30 seconds). If I step straight
> > through the code, no problem.
> >
> > In addition to that timing issue, I have a couple of other questions that
> > the documentation and code samples don't seem to cover:
> > 1) How do I set up an alternate email address? I wouldn't call MailEnable
> > on
> > each address, would I? Must I set ProxyAddresses manually? Should the
> > alternate email be "smtp:" instead of "SMTP:"?
> > 2)Related to above, does MailEnable particularly set the primary (SMTP:)
> > email address of ProxyAddresses?
> > 3) What if I want to modify an email address later (either primary or
> > alternate)? I always seem to get an error when calling MailEnable on an
> > existing contact with existing primary and alternate email addresses. For
> > existing contacts, I've tried just setting ProxyAddresses and skipping the
> > call to MailEnable, but it doesn't update other properties, such as Email
> > on
> > the General tab and Email on the Exchange General tab (in AD Properties).
> >
> > In short, I guess I need more details on when to call MailEnable, what
> > other
> > calls to make or properties to set, and in what order, when both creating
> > and
> > modifying an AD contact.
> >
> > Thanks very much for any help,
>
>
date: Sat, 27 May 2006 19:40:02 -0700
author: T Ray Humphrey
Re: particulars of MailEnable
1a. You would set the additional proxyAddresses values.
1b. Yes, they should be prefixed with smtp: in lowercase, uppercase
denotes primary address.
2. Yes, it is based off the Recipient Policy that applied to the user.
3. If you want to change the primary address you should change the other
attributes as well.
In general, the CDOEXM interfaces for Exchange enabling objects (either
mailbox or mail enabled) pretty much suck ass. They are a light attempt
at giving functionality. As you may have surmised, MSFT doesn't actually
use those methods in their own tools such as ESM or ADUC. They use MAPI
calls and then put together these mechanisms for people outside of MSFT
to use though they don't have full functionality.
Allegedly this is all fixed in E12 as they toss out CDOEXM and WMI
interfaces and replace it with MONAD (or PowerShell if you prefer) but I
heard the exact same thing when E2K3 was coming out, it is all fixed!
--
Joe Richards Microsoft MVP Windows Server Directory Services
Author of O'Reilly Active Directory Third Edition
www.joeware.net
---O'Reilly Active Directory Third Edition now available---
http://www.joeware.net/win/ad3e.htm
T Ray Humphrey wrote:
> Hi,
> I have an ASP.NET web application that is creating contact objects in AD. At
> the time of contact creation, I want to enable emails to that contact. I have
> read about MailEnable from IMailRecipient, and that seems to be the thing to
> call. The documentation states that it sets the properties: ProxyAddresses,
> SMTPEmail and X400Email.
>
> Mostly that works, but there does seem to be some timing involved. During a
> debug session, if I wait long enough between creating the AD contact and
> calling MailEnable, it fails (lets say 30 seconds). If I step straight
> through the code, no problem.
>
> In addition to that timing issue, I have a couple of other questions that
> the documentation and code samples don't seem to cover:
> 1) How do I set up an alternate email address? I wouldn't call MailEnable on
> each address, would I? Must I set ProxyAddresses manually? Should the
> alternate email be "smtp:" instead of "SMTP:"?
> 2)Related to above, does MailEnable particularly set the primary (SMTP:)
> email address of ProxyAddresses?
> 3) What if I want to modify an email address later (either primary or
> alternate)? I always seem to get an error when calling MailEnable on an
> existing contact with existing primary and alternate email addresses. For
> existing contacts, I've tried just setting ProxyAddresses and skipping the
> call to MailEnable, but it doesn't update other properties, such as Email on
> the General tab and Email on the Exchange General tab (in AD Properties).
>
> In short, I guess I need more details on when to call MailEnable, what other
> calls to make or properties to set, and in what order, when both creating and
> modifying an AD contact.
>
> Thanks very much for any help,
date: Mon, 29 May 2006 10:25:51 -0400
author: Joe Richards [MVP]
Re: particulars of MailEnable
Hi Joe,
Thank you for saying out load that CDOEXM sucks. I was trying to be polite
on this forum because I thought I might offend someone, but I have spent WAY
TOO much time trying to guess which property to set: write a test program,
set a property, go to ESM and see what's changed. It's not as if the
documentation has any information beyond the briefest description and the
very vanilla example.
I modified my test program to call MailEnable only when creating contacts.
Otherwise, I set ProxyAddresses to change emails, using SMTP: and smtp: as
appropriate. I also set the SMTPEmail property, which seems to drive the
E-mail field on the General tab in ADUC for the contact. I don't know if that
property is critical for sending emails, but for consistency, it's right to
update it.
The one field I can't find a property for is the E-mail field on the
Exchange General tab. When I change ProxyAddresses, that does not update.
This property seems like it might be critical for sending emails. Do you know
the magic property?
Thanks so much for your help. And here's hoping that CDOEXM dies a quick and
painful death!
Ray
"Joe Richards [MVP]" wrote:
> 1a. You would set the additional proxyAddresses values.
> 1b. Yes, they should be prefixed with smtp: in lowercase, uppercase
> denotes primary address.
>
> 2. Yes, it is based off the Recipient Policy that applied to the user.
>
> 3. If you want to change the primary address you should change the other
> attributes as well.
>
> In general, the CDOEXM interfaces for Exchange enabling objects (either
> mailbox or mail enabled) pretty much suck ass. They are a light attempt
> at giving functionality. As you may have surmised, MSFT doesn't actually
> use those methods in their own tools such as ESM or ADUC. They use MAPI
> calls and then put together these mechanisms for people outside of MSFT
> to use though they don't have full functionality.
>
> Allegedly this is all fixed in E12 as they toss out CDOEXM and WMI
> interfaces and replace it with MONAD (or PowerShell if you prefer) but I
> heard the exact same thing when E2K3 was coming out, it is all fixed!
>
>
> --
> Joe Richards Microsoft MVP Windows Server Directory Services
> Author of O'Reilly Active Directory Third Edition
> www.joeware.net
>
>
> ---O'Reilly Active Directory Third Edition now available---
>
> http://www.joeware.net/win/ad3e.htm
>
>
>
> T Ray Humphrey wrote:
> > Hi,
> > I have an ASP.NET web application that is creating contact objects in AD. At
> > the time of contact creation, I want to enable emails to that contact. I have
> > read about MailEnable from IMailRecipient, and that seems to be the thing to
> > call. The documentation states that it sets the properties: ProxyAddresses,
> > SMTPEmail and X400Email.
> >
> > Mostly that works, but there does seem to be some timing involved. During a
> > debug session, if I wait long enough between creating the AD contact and
> > calling MailEnable, it fails (lets say 30 seconds). If I step straight
> > through the code, no problem.
> >
> > In addition to that timing issue, I have a couple of other questions that
> > the documentation and code samples don't seem to cover:
> > 1) How do I set up an alternate email address? I wouldn't call MailEnable on
> > each address, would I? Must I set ProxyAddresses manually? Should the
> > alternate email be "smtp:" instead of "SMTP:"?
> > 2)Related to above, does MailEnable particularly set the primary (SMTP:)
> > email address of ProxyAddresses?
> > 3) What if I want to modify an email address later (either primary or
> > alternate)? I always seem to get an error when calling MailEnable on an
> > existing contact with existing primary and alternate email addresses. For
> > existing contacts, I've tried just setting ProxyAddresses and skipping the
> > call to MailEnable, but it doesn't update other properties, such as Email on
> > the General tab and Email on the Exchange General tab (in AD Properties).
> >
> > In short, I guess I need more details on when to call MailEnable, what other
> > calls to make or properties to set, and in what order, when both creating and
> > modifying an AD contact.
> >
> > Thanks very much for any help,
>
date: Wed, 31 May 2006 05:41:02 -0700
author: T Ray Humphrey
Re: particulars of MailEnable
Do you mean the Alias field on the Exchange general tab?
That is the mailnickname attribute.
--
Joe Richards Microsoft MVP Windows Server Directory Services
Author of O'Reilly Active Directory Third Edition
www.joeware.net
---O'Reilly Active Directory Third Edition now available---
http://www.joeware.net/win/ad3e.htm
T Ray Humphrey wrote:
> Hi Joe,
> Thank you for saying out load that CDOEXM sucks. I was trying to be polite
> on this forum because I thought I might offend someone, but I have spent WAY
> TOO much time trying to guess which property to set: write a test program,
> set a property, go to ESM and see what's changed. It's not as if the
> documentation has any information beyond the briefest description and the
> very vanilla example.
>
> I modified my test program to call MailEnable only when creating contacts.
> Otherwise, I set ProxyAddresses to change emails, using SMTP: and smtp: as
> appropriate. I also set the SMTPEmail property, which seems to drive the
> E-mail field on the General tab in ADUC for the contact. I don't know if that
> property is critical for sending emails, but for consistency, it's right to
> update it.
>
> The one field I can't find a property for is the E-mail field on the
> Exchange General tab. When I change ProxyAddresses, that does not update.
> This property seems like it might be critical for sending emails. Do you know
> the magic property?
>
> Thanks so much for your help. And here's hoping that CDOEXM dies a quick and
> painful death!
>
> Ray
>
> "Joe Richards [MVP]" wrote:
>
>> 1a. You would set the additional proxyAddresses values.
>> 1b. Yes, they should be prefixed with smtp: in lowercase, uppercase
>> denotes primary address.
>>
>> 2. Yes, it is based off the Recipient Policy that applied to the user.
>>
>> 3. If you want to change the primary address you should change the other
>> attributes as well.
>>
>> In general, the CDOEXM interfaces for Exchange enabling objects (either
>> mailbox or mail enabled) pretty much suck ass. They are a light attempt
>> at giving functionality. As you may have surmised, MSFT doesn't actually
>> use those methods in their own tools such as ESM or ADUC. They use MAPI
>> calls and then put together these mechanisms for people outside of MSFT
>> to use though they don't have full functionality.
>>
>> Allegedly this is all fixed in E12 as they toss out CDOEXM and WMI
>> interfaces and replace it with MONAD (or PowerShell if you prefer) but I
>> heard the exact same thing when E2K3 was coming out, it is all fixed!
>>
>>
>> --
>> Joe Richards Microsoft MVP Windows Server Directory Services
>> Author of O'Reilly Active Directory Third Edition
>> www.joeware.net
>>
>>
>> ---O'Reilly Active Directory Third Edition now available---
>>
>> http://www.joeware.net/win/ad3e.htm
>>
>>
>>
>> T Ray Humphrey wrote:
>>> Hi,
>>> I have an ASP.NET web application that is creating contact objects in AD. At
>>> the time of contact creation, I want to enable emails to that contact. I have
>>> read about MailEnable from IMailRecipient, and that seems to be the thing to
>>> call. The documentation states that it sets the properties: ProxyAddresses,
>>> SMTPEmail and X400Email.
>>>
>>> Mostly that works, but there does seem to be some timing involved. During a
>>> debug session, if I wait long enough between creating the AD contact and
>>> calling MailEnable, it fails (lets say 30 seconds). If I step straight
>>> through the code, no problem.
>>>
>>> In addition to that timing issue, I have a couple of other questions that
>>> the documentation and code samples don't seem to cover:
>>> 1) How do I set up an alternate email address? I wouldn't call MailEnable on
>>> each address, would I? Must I set ProxyAddresses manually? Should the
>>> alternate email be "smtp:" instead of "SMTP:"?
>>> 2)Related to above, does MailEnable particularly set the primary (SMTP:)
>>> email address of ProxyAddresses?
>>> 3) What if I want to modify an email address later (either primary or
>>> alternate)? I always seem to get an error when calling MailEnable on an
>>> existing contact with existing primary and alternate email addresses. For
>>> existing contacts, I've tried just setting ProxyAddresses and skipping the
>>> call to MailEnable, but it doesn't update other properties, such as Email on
>>> the General tab and Email on the Exchange General tab (in AD Properties).
>>>
>>> In short, I guess I need more details on when to call MailEnable, what other
>>> calls to make or properties to set, and in what order, when both creating and
>>> modifying an AD contact.
>>>
>>> Thanks very much for any help,
date: Wed, 31 May 2006 17:54:55 -0400
author: Joe Richards [MVP]
Re: particulars of MailEnable
No, Joe, the Alias field is at the top of the tab. Since our application
manages email for many domains, we generate a value for that at contact
creation time, it never changes, and we don't expose it to the user.
The E-mail field is right under it. In my testing, I modified ProxyAddresses
and SMTPEmail in CDOEXM calls (not using ADUC/ESM). If I look at the
properties of that contact in ADUC now, the ProxyAddresses and SMTPEmail are
as I set them, but the E-mail field on the Exchange General tab still shows
an old "SMTP:BlahBlah@WoofWoof.com". So modifying the properties that I did
had no effect on this field.
Continued thanks,
Ray
"Joe Richards [MVP]" wrote:
> Do you mean the Alias field on the Exchange general tab?
>
> That is the mailnickname attribute.
>
>
>
> --
> Joe Richards Microsoft MVP Windows Server Directory Services
> Author of O'Reilly Active Directory Third Edition
> www.joeware.net
>
>
> ---O'Reilly Active Directory Third Edition now available---
>
> http://www.joeware.net/win/ad3e.htm
>
>
>
> T Ray Humphrey wrote:
> > Hi Joe,
> > Thank you for saying out load that CDOEXM sucks. I was trying to be polite
> > on this forum because I thought I might offend someone, but I have spent WAY
> > TOO much time trying to guess which property to set: write a test program,
> > set a property, go to ESM and see what's changed. It's not as if the
> > documentation has any information beyond the briefest description and the
> > very vanilla example.
> >
> > I modified my test program to call MailEnable only when creating contacts.
> > Otherwise, I set ProxyAddresses to change emails, using SMTP: and smtp: as
> > appropriate. I also set the SMTPEmail property, which seems to drive the
> > E-mail field on the General tab in ADUC for the contact. I don't know if that
> > property is critical for sending emails, but for consistency, it's right to
> > update it.
> >
> > The one field I can't find a property for is the E-mail field on the
> > Exchange General tab. When I change ProxyAddresses, that does not update.
> > This property seems like it might be critical for sending emails. Do you know
> > the magic property?
> >
> > Thanks so much for your help. And here's hoping that CDOEXM dies a quick and
> > painful death!
> >
> > Ray
> >
> > "Joe Richards [MVP]" wrote:
> >
> >> 1a. You would set the additional proxyAddresses values.
> >> 1b. Yes, they should be prefixed with smtp: in lowercase, uppercase
> >> denotes primary address.
> >>
> >> 2. Yes, it is based off the Recipient Policy that applied to the user.
> >>
> >> 3. If you want to change the primary address you should change the other
> >> attributes as well.
> >>
> >> In general, the CDOEXM interfaces for Exchange enabling objects (either
> >> mailbox or mail enabled) pretty much suck ass. They are a light attempt
> >> at giving functionality. As you may have surmised, MSFT doesn't actually
> >> use those methods in their own tools such as ESM or ADUC. They use MAPI
> >> calls and then put together these mechanisms for people outside of MSFT
> >> to use though they don't have full functionality.
> >>
> >> Allegedly this is all fixed in E12 as they toss out CDOEXM and WMI
> >> interfaces and replace it with MONAD (or PowerShell if you prefer) but I
> >> heard the exact same thing when E2K3 was coming out, it is all fixed!
> >>
> >>
> >> --
> >> Joe Richards Microsoft MVP Windows Server Directory Services
> >> Author of O'Reilly Active Directory Third Edition
> >> www.joeware.net
> >>
> >>
> >> ---O'Reilly Active Directory Third Edition now available---
> >>
> >> http://www.joeware.net/win/ad3e.htm
> >>
> >>
> >>
> >> T Ray Humphrey wrote:
> >>> Hi,
> >>> I have an ASP.NET web application that is creating contact objects in AD. At
> >>> the time of contact creation, I want to enable emails to that contact. I have
> >>> read about MailEnable from IMailRecipient, and that seems to be the thing to
> >>> call. The documentation states that it sets the properties: ProxyAddresses,
> >>> SMTPEmail and X400Email.
> >>>
> >>> Mostly that works, but there does seem to be some timing involved. During a
> >>> debug session, if I wait long enough between creating the AD contact and
> >>> calling MailEnable, it fails (lets say 30 seconds). If I step straight
> >>> through the code, no problem.
> >>>
> >>> In addition to that timing issue, I have a couple of other questions that
> >>> the documentation and code samples don't seem to cover:
> >>> 1) How do I set up an alternate email address? I wouldn't call MailEnable on
> >>> each address, would I? Must I set ProxyAddresses manually? Should the
> >>> alternate email be "smtp:" instead of "SMTP:"?
> >>> 2)Related to above, does MailEnable particularly set the primary (SMTP:)
> >>> email address of ProxyAddresses?
> >>> 3) What if I want to modify an email address later (either primary or
> >>> alternate)? I always seem to get an error when calling MailEnable on an
> >>> existing contact with existing primary and alternate email addresses. For
> >>> existing contacts, I've tried just setting ProxyAddresses and skipping the
> >>> call to MailEnable, but it doesn't update other properties, such as Email on
> >>> the General tab and Email on the Exchange General tab (in AD Properties).
> >>>
> >>> In short, I guess I need more details on when to call MailEnable, what other
> >>> calls to make or properties to set, and in what order, when both creating and
> >>> modifying an AD contact.
> >>>
> >>> Thanks very much for any help,
>
date: Wed, 31 May 2006 15:20:02 -0700
author: T Ray Humphrey
Re: particulars of MailEnable
What version of Exchange? I am looking at the Exchange General Tab in
Exchange Server 2003 and I see a field for MailBox Store and one for
Alias. Other than that I have three buttons for setting delivery
options, etc.
--
Joe Richards Microsoft MVP Windows Server Directory Services
Author of O'Reilly Active Directory Third Edition
www.joeware.net
---O'Reilly Active Directory Third Edition now available---
http://www.joeware.net/win/ad3e.htm
T Ray Humphrey wrote:
> No, Joe, the Alias field is at the top of the tab. Since our application
> manages email for many domains, we generate a value for that at contact
> creation time, it never changes, and we don't expose it to the user.
>
> The E-mail field is right under it. In my testing, I modified ProxyAddresses
> and SMTPEmail in CDOEXM calls (not using ADUC/ESM). If I look at the
> properties of that contact in ADUC now, the ProxyAddresses and SMTPEmail are
> as I set them, but the E-mail field on the Exchange General tab still shows
> an old "SMTP:BlahBlah@WoofWoof.com". So modifying the properties that I did
> had no effect on this field.
>
> Continued thanks,
> Ray
>
> "Joe Richards [MVP]" wrote:
>
>> Do you mean the Alias field on the Exchange general tab?
>>
>> That is the mailnickname attribute.
>>
>>
>>
>> --
>> Joe Richards Microsoft MVP Windows Server Directory Services
>> Author of O'Reilly Active Directory Third Edition
>> www.joeware.net
>>
>>
>> ---O'Reilly Active Directory Third Edition now available---
>>
>> http://www.joeware.net/win/ad3e.htm
>>
>>
>>
>> T Ray Humphrey wrote:
>>> Hi Joe,
>>> Thank you for saying out load that CDOEXM sucks. I was trying to be polite
>>> on this forum because I thought I might offend someone, but I have spent WAY
>>> TOO much time trying to guess which property to set: write a test program,
>>> set a property, go to ESM and see what's changed. It's not as if the
>>> documentation has any information beyond the briefest description and the
>>> very vanilla example.
>>>
>>> I modified my test program to call MailEnable only when creating contacts.
>>> Otherwise, I set ProxyAddresses to change emails, using SMTP: and smtp: as
>>> appropriate. I also set the SMTPEmail property, which seems to drive the
>>> E-mail field on the General tab in ADUC for the contact. I don't know if that
>>> property is critical for sending emails, but for consistency, it's right to
>>> update it.
>>>
>>> The one field I can't find a property for is the E-mail field on the
>>> Exchange General tab. When I change ProxyAddresses, that does not update.
>>> This property seems like it might be critical for sending emails. Do you know
>>> the magic property?
>>>
>>> Thanks so much for your help. And here's hoping that CDOEXM dies a quick and
>>> painful death!
>>>
>>> Ray
>>>
>>> "Joe Richards [MVP]" wrote:
>>>
>>>> 1a. You would set the additional proxyAddresses values.
>>>> 1b. Yes, they should be prefixed with smtp: in lowercase, uppercase
>>>> denotes primary address.
>>>>
>>>> 2. Yes, it is based off the Recipient Policy that applied to the user.
>>>>
>>>> 3. If you want to change the primary address you should change the other
>>>> attributes as well.
>>>>
>>>> In general, the CDOEXM interfaces for Exchange enabling objects (either
>>>> mailbox or mail enabled) pretty much suck ass. They are a light attempt
>>>> at giving functionality. As you may have surmised, MSFT doesn't actually
>>>> use those methods in their own tools such as ESM or ADUC. They use MAPI
>>>> calls and then put together these mechanisms for people outside of MSFT
>>>> to use though they don't have full functionality.
>>>>
>>>> Allegedly this is all fixed in E12 as they toss out CDOEXM and WMI
>>>> interfaces and replace it with MONAD (or PowerShell if you prefer) but I
>>>> heard the exact same thing when E2K3 was coming out, it is all fixed!
>>>>
>>>>
>>>> --
>>>> Joe Richards Microsoft MVP Windows Server Directory Services
>>>> Author of O'Reilly Active Directory Third Edition
>>>> www.joeware.net
>>>>
>>>>
>>>> ---O'Reilly Active Directory Third Edition now available---
>>>>
>>>> http://www.joeware.net/win/ad3e.htm
>>>>
>>>>
>>>>
>>>> T Ray Humphrey wrote:
>>>>> Hi,
>>>>> I have an ASP.NET web application that is creating contact objects in AD. At
>>>>> the time of contact creation, I want to enable emails to that contact. I have
>>>>> read about MailEnable from IMailRecipient, and that seems to be the thing to
>>>>> call. The documentation states that it sets the properties: ProxyAddresses,
>>>>> SMTPEmail and X400Email.
>>>>>
>>>>> Mostly that works, but there does seem to be some timing involved. During a
>>>>> debug session, if I wait long enough between creating the AD contact and
>>>>> calling MailEnable, it fails (lets say 30 seconds). If I step straight
>>>>> through the code, no problem.
>>>>>
>>>>> In addition to that timing issue, I have a couple of other questions that
>>>>> the documentation and code samples don't seem to cover:
>>>>> 1) How do I set up an alternate email address? I wouldn't call MailEnable on
>>>>> each address, would I? Must I set ProxyAddresses manually? Should the
>>>>> alternate email be "smtp:" instead of "SMTP:"?
>>>>> 2)Related to above, does MailEnable particularly set the primary (SMTP:)
>>>>> email address of ProxyAddresses?
>>>>> 3) What if I want to modify an email address later (either primary or
>>>>> alternate)? I always seem to get an error when calling MailEnable on an
>>>>> existing contact with existing primary and alternate email addresses. For
>>>>> existing contacts, I've tried just setting ProxyAddresses and skipping the
>>>>> call to MailEnable, but it doesn't update other properties, such as Email on
>>>>> the General tab and Email on the Exchange General tab (in AD Properties).
>>>>>
>>>>> In short, I guess I need more details on when to call MailEnable, what other
>>>>> calls to make or properties to set, and in what order, when both creating and
>>>>> modifying an AD contact.
>>>>>
>>>>> Thanks very much for any help,
date: Wed, 31 May 2006 18:41:13 -0400
author: Joe Richards [MVP]
Re: particulars of MailEnable
Ahh. You are probably looking at a User. The Exchange General tab is
different for a contact. Therein lies the beginnings of my problem...
Ray
"Joe Richards [MVP]" wrote:
> What version of Exchange? I am looking at the Exchange General Tab in
> Exchange Server 2003 and I see a field for MailBox Store and one for
> Alias. Other than that I have three buttons for setting delivery
> options, etc.
>
>
>
> --
> Joe Richards Microsoft MVP Windows Server Directory Services
> Author of O'Reilly Active Directory Third Edition
> www.joeware.net
>
>
> ---O'Reilly Active Directory Third Edition now available---
>
> http://www.joeware.net/win/ad3e.htm
>
>
>
> T Ray Humphrey wrote:
> > No, Joe, the Alias field is at the top of the tab. Since our application
> > manages email for many domains, we generate a value for that at contact
> > creation time, it never changes, and we don't expose it to the user.
> >
> > The E-mail field is right under it. In my testing, I modified ProxyAddresses
> > and SMTPEmail in CDOEXM calls (not using ADUC/ESM). If I look at the
> > properties of that contact in ADUC now, the ProxyAddresses and SMTPEmail are
> > as I set them, but the E-mail field on the Exchange General tab still shows
> > an old "SMTP:BlahBlah@WoofWoof.com". So modifying the properties that I did
> > had no effect on this field.
> >
> > Continued thanks,
> > Ray
> >
> > "Joe Richards [MVP]" wrote:
> >
> >> Do you mean the Alias field on the Exchange general tab?
> >>
> >> That is the mailnickname attribute.
> >>
> >>
> >>
> >> --
> >> Joe Richards Microsoft MVP Windows Server Directory Services
> >> Author of O'Reilly Active Directory Third Edition
> >> www.joeware.net
> >>
> >>
> >> ---O'Reilly Active Directory Third Edition now available---
> >>
> >> http://www.joeware.net/win/ad3e.htm
> >>
> >>
> >>
> >> T Ray Humphrey wrote:
> >>> Hi Joe,
> >>> Thank you for saying out load that CDOEXM sucks. I was trying to be polite
> >>> on this forum because I thought I might offend someone, but I have spent WAY
> >>> TOO much time trying to guess which property to set: write a test program,
> >>> set a property, go to ESM and see what's changed. It's not as if the
> >>> documentation has any information beyond the briefest description and the
> >>> very vanilla example.
> >>>
> >>> I modified my test program to call MailEnable only when creating contacts.
> >>> Otherwise, I set ProxyAddresses to change emails, using SMTP: and smtp: as
> >>> appropriate. I also set the SMTPEmail property, which seems to drive the
> >>> E-mail field on the General tab in ADUC for the contact. I don't know if that
> >>> property is critical for sending emails, but for consistency, it's right to
> >>> update it.
> >>>
> >>> The one field I can't find a property for is the E-mail field on the
> >>> Exchange General tab. When I change ProxyAddresses, that does not update.
> >>> This property seems like it might be critical for sending emails. Do you know
> >>> the magic property?
> >>>
> >>> Thanks so much for your help. And here's hoping that CDOEXM dies a quick and
> >>> painful death!
> >>>
> >>> Ray
> >>>
> >>> "Joe Richards [MVP]" wrote:
> >>>
> >>>> 1a. You would set the additional proxyAddresses values.
> >>>> 1b. Yes, they should be prefixed with smtp: in lowercase, uppercase
> >>>> denotes primary address.
> >>>>
> >>>> 2. Yes, it is based off the Recipient Policy that applied to the user.
> >>>>
> >>>> 3. If you want to change the primary address you should change the other
> >>>> attributes as well.
> >>>>
> >>>> In general, the CDOEXM interfaces for Exchange enabling objects (either
> >>>> mailbox or mail enabled) pretty much suck ass. They are a light attempt
> >>>> at giving functionality. As you may have surmised, MSFT doesn't actually
> >>>> use those methods in their own tools such as ESM or ADUC. They use MAPI
> >>>> calls and then put together these mechanisms for people outside of MSFT
> >>>> to use though they don't have full functionality.
> >>>>
> >>>> Allegedly this is all fixed in E12 as they toss out CDOEXM and WMI
> >>>> interfaces and replace it with MONAD (or PowerShell if you prefer) but I
> >>>> heard the exact same thing when E2K3 was coming out, it is all fixed!
> >>>>
> >>>>
> >>>> --
> >>>> Joe Richards Microsoft MVP Windows Server Directory Services
> >>>> Author of O'Reilly Active Directory Third Edition
> >>>> www.joeware.net
> >>>>
> >>>>
> >>>> ---O'Reilly Active Directory Third Edition now available---
> >>>>
> >>>> http://www.joeware.net/win/ad3e.htm
> >>>>
> >>>>
> >>>>
> >>>> T Ray Humphrey wrote:
> >>>>> Hi,
> >>>>> I have an ASP.NET web application that is creating contact objects in AD. At
> >>>>> the time of contact creation, I want to enable emails to that contact. I have
> >>>>> read about MailEnable from IMailRecipient, and that seems to be the thing to
> >>>>> call. The documentation states that it sets the properties: ProxyAddresses,
> >>>>> SMTPEmail and X400Email.
> >>>>>
> >>>>> Mostly that works, but there does seem to be some timing involved. During a
> >>>>> debug session, if I wait long enough between creating the AD contact and
> >>>>> calling MailEnable, it fails (lets say 30 seconds). If I step straight
> >>>>> through the code, no problem.
> >>>>>
> >>>>> In addition to that timing issue, I have a couple of other questions that
> >>>>> the documentation and code samples don't seem to cover:
> >>>>> 1) How do I set up an alternate email address? I wouldn't call MailEnable on
> >>>>> each address, would I? Must I set ProxyAddresses manually? Should the
> >>>>> alternate email be "smtp:" instead of "SMTP:"?
> >>>>> 2)Related to above, does MailEnable particularly set the primary (SMTP:)
> >>>>> email address of ProxyAddresses?
> >>>>> 3) What if I want to modify an email address later (either primary or
> >>>>> alternate)? I always seem to get an error when calling MailEnable on an
> >>>>> existing contact with existing primary and alternate email addresses. For
> >>>>> existing contacts, I've tried just setting ProxyAddresses and skipping the
> >>>>> call to MailEnable, but it doesn't update other properties, such as Email on
> >>>>> the General tab and Email on the Exchange General tab (in AD Properties).
> >>>>>
> >>>>> In short, I guess I need more details on when to call MailEnable, what other
> >>>>> calls to make or properties to set, and in what order, when both creating and
> >>>>> modifying an AD contact.
> >>>>>
> >>>>> Thanks very much for any help,
>
date: Wed, 31 May 2006 16:22:01 -0700
author: T Ray Humphrey
Re: particulars of MailEnable
Ah sorry, my fault, you have been saying mailenabled all of this time
and I looked at a mailbox enabled object.
That email address should be the targetAddress.
--
Joe Richards Microsoft MVP Windows Server Directory Services
Author of O'Reilly Active Directory Third Edition
www.joeware.net
---O'Reilly Active Directory Third Edition now available---
http://www.joeware.net/win/ad3e.htm
T Ray Humphrey wrote:
> Ahh. You are probably looking at a User. The Exchange General tab is
> different for a contact. Therein lies the beginnings of my problem...
>
> Ray
>
> "Joe Richards [MVP]" wrote:
>
>> What version of Exchange? I am looking at the Exchange General Tab in
>> Exchange Server 2003 and I see a field for MailBox Store and one for
>> Alias. Other than that I have three buttons for setting delivery
>> options, etc.
>>
>>
>>
>> --
>> Joe Richards Microsoft MVP Windows Server Directory Services
>> Author of O'Reilly Active Directory Third Edition
>> www.joeware.net
>>
>>
>> ---O'Reilly Active Directory Third Edition now available---
>>
>> http://www.joeware.net/win/ad3e.htm
>>
>>
>>
>> T Ray Humphrey wrote:
>>> No, Joe, the Alias field is at the top of the tab. Since our application
>>> manages email for many domains, we generate a value for that at contact
>>> creation time, it never changes, and we don't expose it to the user.
>>>
>>> The E-mail field is right under it. In my testing, I modified ProxyAddresses
>>> and SMTPEmail in CDOEXM calls (not using ADUC/ESM). If I look at the
>>> properties of that contact in ADUC now, the ProxyAddresses and SMTPEmail are
>>> as I set them, but the E-mail field on the Exchange General tab still shows
>>> an old "SMTP:BlahBlah@WoofWoof.com". So modifying the properties that I did
>>> had no effect on this field.
>>>
>>> Continued thanks,
>>> Ray
>>>
>>> "Joe Richards [MVP]" wrote:
>>>
>>>> Do you mean the Alias field on the Exchange general tab?
>>>>
>>>> That is the mailnickname attribute.
>>>>
>>>>
>>>>
>>>> --
>>>> Joe Richards Microsoft MVP Windows Server Directory Services
>>>> Author of O'Reilly Active Directory Third Edition
>>>> www.joeware.net
>>>>
>>>>
>>>> ---O'Reilly Active Directory Third Edition now available---
>>>>
>>>> http://www.joeware.net/win/ad3e.htm
>>>>
>>>>
>>>>
>>>> T Ray Humphrey wrote:
>>>>> Hi Joe,
>>>>> Thank you for saying out load that CDOEXM sucks. I was trying to be polite
>>>>> on this forum because I thought I might offend someone, but I have spent WAY
>>>>> TOO much time trying to guess which property to set: write a test program,
>>>>> set a property, go to ESM and see what's changed. It's not as if the
>>>>> documentation has any information beyond the briefest description and the
>>>>> very vanilla example.
>>>>>
>>>>> I modified my test program to call MailEnable only when creating contacts.
>>>>> Otherwise, I set ProxyAddresses to change emails, using SMTP: and smtp: as
>>>>> appropriate. I also set the SMTPEmail property, which seems to drive the
>>>>> E-mail field on the General tab in ADUC for the contact. I don't know if that
>>>>> property is critical for sending emails, but for consistency, it's right to
>>>>> update it.
>>>>>
>>>>> The one field I can't find a property for is the E-mail field on the
>>>>> Exchange General tab. When I change ProxyAddresses, that does not update.
>>>>> This property seems like it might be critical for sending emails. Do you know
>>>>> the magic property?
>>>>>
>>>>> Thanks so much for your help. And here's hoping that CDOEXM dies a quick and
>>>>> painful death!
>>>>>
>>>>> Ray
>>>>>
>>>>> "Joe Richards [MVP]" wrote:
>>>>>
>>>>>> 1a. You would set the additional proxyAddresses values.
>>>>>> 1b. Yes, they should be prefixed with smtp: in lowercase, uppercase
>>>>>> denotes primary address.
>>>>>>
>>>>>> 2. Yes, it is based off the Recipient Policy that applied to the user.
>>>>>>
>>>>>> 3. If you want to change the primary address you should change the other
>>>>>> attributes as well.
>>>>>>
>>>>>> In general, the CDOEXM interfaces for Exchange enabling objects (either
>>>>>> mailbox or mail enabled) pretty much suck ass. They are a light attempt
>>>>>> at giving functionality. As you may have surmised, MSFT doesn't actually
>>>>>> use those methods in their own tools such as ESM or ADUC. They use MAPI
>>>>>> calls and then put together these mechanisms for people outside of MSFT
>>>>>> to use though they don't have full functionality.
>>>>>>
>>>>>> Allegedly this is all fixed in E12 as they toss out CDOEXM and WMI
>>>>>> interfaces and replace it with MONAD (or PowerShell if you prefer) but I
>>>>>> heard the exact same thing when E2K3 was coming out, it is all fixed!
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Joe Richards Microsoft MVP Windows Server Directory Services
>>>>>> Author of O'Reilly Active Directory Third Edition
>>>>>> www.joeware.net
>>>>>>
>>>>>>
>>>>>> ---O'Reilly Active Directory Third Edition now available---
>>>>>>
>>>>>> http://www.joeware.net/win/ad3e.htm
>>>>>>
>>>>>>
>>>>>>
>>>>>> T Ray Humphrey wrote:
>>>>>>> Hi,
>>>>>>> I have an ASP.NET web application that is creating contact objects in AD. At
>>>>>>> the time of contact creation, I want to enable emails to that contact. I have
>>>>>>> read about MailEnable from IMailRecipient, and that seems to be the thing to
>>>>>>> call. The documentation states that it sets the properties: ProxyAddresses,
>>>>>>> SMTPEmail and X400Email.
>>>>>>>
>>>>>>> Mostly that works, but there does seem to be some timing involved. During a
>>>>>>> debug session, if I wait long enough between creating the AD contact and
>>>>>>> calling MailEnable, it fails (lets say 30 seconds). If I step straight
>>>>>>> through the code, no problem.
>>>>>>>
>>>>>>> In addition to that timing issue, I have a couple of other questions that
>>>>>>> the documentation and code samples don't seem to cover:
>>>>>>> 1) How do I set up an alternate email address? I wouldn't call MailEnable on
>>>>>>> each address, would I? Must I set ProxyAddresses manually? Should the
>>>>>>> alternate email be "smtp:" instead of "SMTP:"?
>>>>>>> 2)Related to above, does MailEnable particularly set the primary (SMTP:)
>>>>>>> email address of ProxyAddresses?
>>>>>>> 3) What if I want to modify an email address later (either primary or
>>>>>>> alternate)? I always seem to get an error when calling MailEnable on an
>>>>>>> existing contact with existing primary and alternate email addresses. For
>>>>>>> existing contacts, I've tried just setting ProxyAddresses and skipping the
>>>>>>> call to MailEnable, but it doesn't update other properties, such as Email on
>>>>>>> the General tab and Email on the Exchange General tab (in AD Properties).
>>>>>>>
>>>>>>> In short, I guess I need more details on when to call MailEnable, what other
>>>>>>> calls to make or properties to set, and in what order, when both creating and
>>>>>>> modifying an AD contact.
>>>>>>>
>>>>>>> Thanks very much for any help,
date: Wed, 31 May 2006 19:45:36 -0400
author: Joe Richards [MVP]
Re: particulars of MailEnable
So here is the problem. TargetAddress is read-only. It is set by calling
MailEnable. MailEnable only seems to work for mail enabling new contacts, not
for modifying existing contacts. Way down near the beginning of this post I
mentioned that a debug step-through with enough delay between the contact
creation and the MailEnable produces an error - I was wondering if MailEnable
won't work if the RUS has come through and created the SMTP: address (our RUS
would create an SMTP: that we don't want -- an "internal" address that a
contact wouldn't use). If I create a contact and then MailEnable right away,
no problem (our RUS then creates an smtp: address -- I'm not real savvy about
RUS, but I think that's what's happening).
Anyway, back to my problem. I can't set TargetAddress as it's read-only. For
existing contacts, I can't call just MailEnable. Setting ProxyAddresses
doesn't set TargetAddress. So, how the heck do I modify an SMTP: address for
an existing contact? Do I have to call MailDisable then MailEnable?
At the risk of wearing out my welcome, let me ask, should I be calling
MailEnable for user objects I create too? I don't currently. Instead, I call
CreateMailBox. That seems to work fine, but this whole discussion has me
questioning everything.
Many thanks,
Ray
"Joe Richards [MVP]" wrote:
> Ah sorry, my fault, you have been saying mailenabled all of this time
> and I looked at a mailbox enabled object.
>
> That email address should be the targetAddress.
>
> --
> Joe Richards Microsoft MVP Windows Server Directory Services
> Author of O'Reilly Active Directory Third Edition
> www.joeware.net
>
>
> ---O'Reilly Active Directory Third Edition now available---
>
> http://www.joeware.net/win/ad3e.htm
>
>
>
> T Ray Humphrey wrote:
> > Ahh. You are probably looking at a User. The Exchange General tab is
> > different for a contact. Therein lies the beginnings of my problem...
> >
> > Ray
> >
> > "Joe Richards [MVP]" wrote:
> >
> >> What version of Exchange? I am looking at the Exchange General Tab in
> >> Exchange Server 2003 and I see a field for MailBox Store and one for
> >> Alias. Other than that I have three buttons for setting delivery
> >> options, etc.
> >>
> >>
> >>
> >> --
> >> Joe Richards Microsoft MVP Windows Server Directory Services
> >> Author of O'Reilly Active Directory Third Edition
> >> www.joeware.net
> >>
> >>
> >> ---O'Reilly Active Directory Third Edition now available---
> >>
> >> http://www.joeware.net/win/ad3e.htm
> >>
> >>
> >>
> >> T Ray Humphrey wrote:
> >>> No, Joe, the Alias field is at the top of the tab. Since our application
> >>> manages email for many domains, we generate a value for that at contact
> >>> creation time, it never changes, and we don't expose it to the user.
> >>>
> >>> The E-mail field is right under it. In my testing, I modified ProxyAddresses
> >>> and SMTPEmail in CDOEXM calls (not using ADUC/ESM). If I look at the
> >>> properties of that contact in ADUC now, the ProxyAddresses and SMTPEmail are
> >>> as I set them, but the E-mail field on the Exchange General tab still shows
> >>> an old "SMTP:BlahBlah@WoofWoof.com". So modifying the properties that I did
> >>> had no effect on this field.
> >>>
> >>> Continued thanks,
> >>> Ray
> >>>
> >>> "Joe Richards [MVP]" wrote:
> >>>
> >>>> Do you mean the Alias field on the Exchange general tab?
> >>>>
> >>>> That is the mailnickname attribute.
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Joe Richards Microsoft MVP Windows Server Directory Services
> >>>> Author of O'Reilly Active Directory Third Edition
> >>>> www.joeware.net
> >>>>
> >>>>
> >>>> ---O'Reilly Active Directory Third Edition now available---
> >>>>
> >>>> http://www.joeware.net/win/ad3e.htm
> >>>>
> >>>>
> >>>>
> >>>> T Ray Humphrey wrote:
> >>>>> Hi Joe,
> >>>>> Thank you for saying out load that CDOEXM sucks. I was trying to be polite
> >>>>> on this forum because I thought I might offend someone, but I have spent WAY
> >>>>> TOO much time trying to guess which property to set: write a test program,
> >>>>> set a property, go to ESM and see what's changed. It's not as if the
> >>>>> documentation has any information beyond the briefest description and the
> >>>>> very vanilla example.
> >>>>>
> >>>>> I modified my test program to call MailEnable only when creating contacts.
> >>>>> Otherwise, I set ProxyAddresses to change emails, using SMTP: and smtp: as
> >>>>> appropriate. I also set the SMTPEmail property, which seems to drive the
> >>>>> E-mail field on the General tab in ADUC for the contact. I don't know if that
> >>>>> property is critical for sending emails, but for consistency, it's right to
> >>>>> update it.
> >>>>>
> >>>>> The one field I can't find a property for is the E-mail field on the
> >>>>> Exchange General tab. When I change ProxyAddresses, that does not update.
> >>>>> This property seems like it might be critical for sending emails. Do you know
> >>>>> the magic property?
> >>>>>
> >>>>> Thanks so much for your help. And here's hoping that CDOEXM dies a quick and
> >>>>> painful death!
> >>>>>
> >>>>> Ray
> >>>>>
> >>>>> "Joe Richards [MVP]" wrote:
> >>>>>
> >>>>>> 1a. You would set the additional proxyAddresses values.
> >>>>>> 1b. Yes, they should be prefixed with smtp: in lowercase, uppercase
> >>>>>> denotes primary address.
> >>>>>>
> >>>>>> 2. Yes, it is based off the Recipient Policy that applied to the user.
> >>>>>>
> >>>>>> 3. If you want to change the primary address you should change the other
> >>>>>> attributes as well.
> >>>>>>
> >>>>>> In general, the CDOEXM interfaces for Exchange enabling objects (either
> >>>>>> mailbox or mail enabled) pretty much suck ass. They are a light attempt
> >>>>>> at giving functionality. As you may have surmised, MSFT doesn't actually
> >>>>>> use those methods in their own tools such as ESM or ADUC. They use MAPI
> >>>>>> calls and then put together these mechanisms for people outside of MSFT
> >>>>>> to use though they don't have full functionality.
> >>>>>>
> >>>>>> Allegedly this is all fixed in E12 as they toss out CDOEXM and WMI
> >>>>>> interfaces and replace it with MONAD (or PowerShell if you prefer) but I
> >>>>>> heard the exact same thing when E2K3 was coming out, it is all fixed!
> >>>>>>
> >>>>>>
> >>>>>> --
> >>>>>> Joe Richards Microsoft MVP Windows Server Directory Services
> >>>>>> Author of O'Reilly Active Directory Third Edition
> >>>>>> www.joeware.net
> >>>>>>
> >>>>>>
> >>>>>> ---O'Reilly Active Directory Third Edition now available---
> >>>>>>
> >>>>>> http://www.joeware.net/win/ad3e.htm
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> T Ray Humphrey wrote:
> >>>>>>> Hi,
> >>>>>>> I have an ASP.NET web application that is creating contact objects in AD. At
> >>>>>>> the time of contact creation, I want to enable emails to that contact. I have
> >>>>>>> read about MailEnable from IMailRecipient, and that seems to be the thing to
> >>>>>>> call. The documentation states that it sets the properties: ProxyAddresses,
> >>>>>>> SMTPEmail and X400Email.
> >>>>>>>
> >>>>>>> Mostly that works, but there does seem to be some timing involved. During a
> >>>>>>> debug session, if I wait long enough between creating the AD contact and
> >>>>>>> calling MailEnable, it fails (lets say 30 seconds). If I step straight
> >>>>>>> through the code, no problem.
> >>>>>>>
> >>>>>>> In addition to that timing issue, I have a couple of other questions that
> >>>>>>> the documentation and code samples don't seem to cover:
> >>>>>>> 1) How do I set up an alternate email address? I wouldn't call MailEnable on
> >>>>>>> each address, would I? Must I set ProxyAddresses manually? Should the
> >>>>>>> alternate email be "smtp:" instead of "SMTP:"?
> >>>>>>> 2)Related to above, does MailEnable particularly set the primary (SMTP:)
> >>>>>>> email address of ProxyAddresses?
> >>>>>>> 3) What if I want to modify an email address later (either primary or
> >>>>>>> alternate)? I always seem to get an error when calling MailEnable on an
> >>>>>>> existing contact with existing primary and alternate email addresses. For
> >>>>>>> existing contacts, I've tried just setting ProxyAddresses and skipping the
> >>>>>>> call to MailEnable, but it doesn't update other properties, such as Email on
> >>>>>>> the General tab and Email on the Exchange General tab (in AD Properties).
> >>>>>>>
> >>>>>>> In short, I guess I need more details on when to call MailEnable, what other
> >>>>>>> calls to make or properties to set, and in what order, when both creating and
> >>>>>>> modifying an AD contact.
> >>>>>>>
> >>>>>>> Thanks very much for any help,
>
date: Wed, 31 May 2006 17:09:02 -0700
author: T Ray Humphrey
Re: particulars of MailEnable
When you mailenable a user or contact you specify the target address in
the mailenable call.
Once that is set, the only way to change it that I am aware of is to go
outside of CDOEXM and set the attributes directly with ADSI or LDAP API
calls.
When you do that, the RUS should set that address as the primary SMTP
and then add a secondary based on the recipient policy. For instance if
I have a recipient policy that sets an SMTP address to be
mailnickname@joe.com it will take an object (user or contact) that has
been mail enabled with a specified targetaddress of someone@joeware.net
it will set the targetAddress and primary SMTP in the proxyAddresses to
be someone@joeware.net and set a secondary SMTP of mailnickname@joe.com.
You only want to mailbox enable objects if you need an actual mailbox
for the object. If there is already a mailbox somewhere (On Exchange or
whatever) anywhere else, then use a mailenabled contact (if they don't
need to auth on the local forest) or mailenabled user (if they need to
auth).
When you create a contact or a user, the RUS shouldn't be touching the
object until you have mailenabled or mailboxenabled the object. If you
are experiencing something else, it means your code is setting
attributes on the object creation that it probably shouldn't be.
--
Joe Richards Microsoft MVP Windows Server Directory Services
Author of O'Reilly Active Directory Third Edition
www.joeware.net
---O'Reilly Active Directory Third Edition now available---
http://www.joeware.net/win/ad3e.htm
T Ray Humphrey wrote:
> So here is the problem. TargetAddress is read-only. It is set by calling
> MailEnable. MailEnable only seems to work for mail enabling new contacts, not
> for modifying existing contacts. Way down near the beginning of this post I
> mentioned that a debug step-through with enough delay between the contact
> creation and the MailEnable produces an error - I was wondering if MailEnable
> won't work if the RUS has come through and created the SMTP: address (our RUS
> would create an SMTP: that we don't want -- an "internal" address that a
> contact wouldn't use). If I create a contact and then MailEnable right away,
> no problem (our RUS then creates an smtp: address -- I'm not real savvy about
> RUS, but I think that's what's happening).
>
> Anyway, back to my problem. I can't set TargetAddress as it's read-only. For
> existing contacts, I can't call just MailEnable. Setting ProxyAddresses
> doesn't set TargetAddress. So, how the heck do I modify an SMTP: address for
> an existing contact? Do I have to call MailDisable then MailEnable?
>
> At the risk of wearing out my welcome, let me ask, should I be calling
> MailEnable for user objects I create too? I don't currently. Instead, I call
> CreateMailBox. That seems to work fine, but this whole discussion has me
> questioning everything.
>
> Many thanks,
> Ray
>
> "Joe Richards [MVP]" wrote:
>
>> Ah sorry, my fault, you have been saying mailenabled all of this time
>> and I looked at a mailbox enabled object.
>>
>> That email address should be the targetAddress.
>>
>> --
>> Joe Richards Microsoft MVP Windows Server Directory Services
>> Author of O'Reilly Active Directory Third Edition
>> www.joeware.net
>>
>>
>> ---O'Reilly Active Directory Third Edition now available---
>>
>> http://www.joeware.net/win/ad3e.htm
>>
>>
>>
>> T Ray Humphrey wrote:
>>> Ahh. You are probably looking at a User. The Exchange General tab is
>>> different for a contact. Therein lies the beginnings of my problem...
>>>
>>> Ray
>>>
>>> "Joe Richards [MVP]" wrote:
>>>
>>>> What version of Exchange? I am looking at the Exchange General Tab in
>>>> Exchange Server 2003 and I see a field for MailBox Store and one for
>>>> Alias. Other than that I have three buttons for setting delivery
>>>> options, etc.
>>>>
>>>>
>>>>
>>>> --
>>>> Joe Richards Microsoft MVP Windows Server Directory Services
>>>> Author of O'Reilly Active Directory Third Edition
>>>> www.joeware.net
>>>>
>>>>
>>>> ---O'Reilly Active Directory Third Edition now available---
>>>>
>>>> http://www.joeware.net/win/ad3e.htm
>>>>
>>>>
>>>>
>>>> T Ray Humphrey wrote:
>>>>> No, Joe, the Alias field is at the top of the tab. Since our application
>>>>> manages email for many domains, we generate a value for that at contact
>>>>> creation time, it never changes, and we don't expose it to the user.
>>>>>
>>>>> The E-mail field is right under it. In my testing, I modified ProxyAddresses
>>>>> and SMTPEmail in CDOEXM calls (not using ADUC/ESM). If I look at the
>>>>> properties of that contact in ADUC now, the ProxyAddresses and SMTPEmail are
>>>>> as I set them, but the E-mail field on the Exchange General tab still shows
>>>>> an old "SMTP:BlahBlah@WoofWoof.com". So modifying the properties that I did
>>>>> had no effect on this field.
>>>>>
>>>>> Continued thanks,
>>>>> Ray
>>>>>
>>>>> "Joe Richards [MVP]" wrote:
>>>>>
>>>>>> Do you mean the Alias field on the Exchange general tab?
>>>>>>
>>>>>> That is the mailnickname attribute.
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Joe Richards Microsoft MVP Windows Server Directory Services
>>>>>> Author of O'Reilly Active Directory Third Edition
>>>>>> www.joeware.net
>>>>>>
>>>>>>
>>>>>> ---O'Reilly Active Directory Third Edition now available---
>>>>>>
>>>>>> http://www.joeware.net/win/ad3e.htm
>>>>>>
>>>>>>
>>>>>>
>>>>>> T Ray Humphrey wrote:
>>>>>>> Hi Joe,
>>>>>>> Thank you for saying out load that CDOEXM sucks. I was trying to be polite
>>>>>>> on this forum because I thought I might offend someone, but I have spent WAY
>>>>>>> TOO much time trying to guess which property to set: write a test program,
>>>>>>> set a property, go to ESM and see what's changed. It's not as if the
>>>>>>> documentation has any information beyond the briefest description and the
>>>>>>> very vanilla example.
>>>>>>>
>>>>>>> I modified my test program to call MailEnable only when creating contacts.
>>>>>>> Otherwise, I set ProxyAddresses to change emails, using SMTP: and smtp: as
>>>>>>> appropriate. I also set the SMTPEmail property, which seems to drive the
>>>>>>> E-mail field on the General tab in ADUC for the contact. I don't know if that
>>>>>>> property is critical for sending emails, but for consistency, it's right to
>>>>>>> update it.
>>>>>>>
>>>>>>> The one field I can't find a property for is the E-mail field on the
>>>>>>> Exchange General tab. When I change ProxyAddresses, that does not update.
>>>>>>> This property seems like it might be critical for sending emails. Do you know
>>>>>>> the magic property?
>>>>>>>
>>>>>>> Thanks so much for your help. And here's hoping that CDOEXM dies a quick and
>>>>>>> painful death!
>>>>>>>
>>>>>>> Ray
>>>>>>>
>>>>>>> "Joe Richards [MVP]" wrote:
>>>>>>>
>>>>>>>> 1a. You would set the additional proxyAddresses values.
>>>>>>>> 1b. Yes, they should be prefixed with smtp: in lowercase, uppercase
>>>>>>>> denotes primary address.
>>>>>>>>
>>>>>>>> 2. Yes, it is based off the Recipient Policy that applied to the user.
>>>>>>>>
>>>>>>>> 3. If you want to change the primary address you should change the other
>>>>>>>> attributes as well.
>>>>>>>>
>>>>>>>> In general, the CDOEXM interfaces for Exchange enabling objects (either
>>>>>>>> mailbox or mail enabled) pretty much suck ass. They are a light attempt
>>>>>>>> at giving functionality. As you may have surmised, MSFT doesn't actually
>>>>>>>> use those methods in their own tools such as ESM or ADUC. They use MAPI
>>>>>>>> calls and then put together these mechanisms for people outside of MSFT
>>>>>>>> to use though they don't have full functionality.
>>>>>>>>
>>>>>>>> Allegedly this is all fixed in E12 as they toss out CDOEXM and WMI
>>>>>>>> interfaces and replace it with MONAD (or PowerShell if you prefer) but I
>>>>>>>> heard the exact same thing when E2K3 was coming out, it is all fixed!
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Joe Richards Microsoft MVP Windows Server Directory Services
>>>>>>>> Author of O'Reilly Active Directory Third Edition
>>>>>>>> www.joeware.net
>>>>>>>>
>>>>>>>>
>>>>>>>> ---O'Reilly Active Directory Third Edition now available---
>>>>>>>>
>>>>>>>> http://www.joeware.net/win/ad3e.htm
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> T Ray Humphrey wrote:
>>>>>>>>> Hi,
>>>>>>>>> I have an ASP.NET web application that is creating contact objects in AD. At
>>>>>>>>> the time of contact creation, I want to enable emails to that contact. I have
>>>>>>>>> read about MailEnable from IMailRecipient, and that seems to be the thing to
>>>>>>>>> call. The documentation states that it sets the properties: ProxyAddresses,
>>>>>>>>> SMTPEmail and X400Email.
>>>>>>>>>
>>>>>>>>> Mostly that works, but there does seem to be some timing involved. During a
>>>>>>>>> debug session, if I wait long enough between creating the AD contact and
>>>>>>>>> calling MailEnable, it fails (lets say 30 seconds). If I step straight
>>>>>>>>> through the code, no problem.
>>>>>>>>>
>>>>>>>>> In addition to that timing issue, I have a couple of other questions that
>>>>>>>>> the documentation and code samples don't seem to cover:
>>>>>>>>> 1) How do I set up an alternate email address? I wouldn't call MailEnable on
>>>>>>>>> each address, would I? Must I set ProxyAddresses manually? Should the
>>>>>>>>> alternate email be "smtp:" instead of "SMTP:"?
>>>>>>>>> 2)Related to above, does MailEnable particularly set the primary (SMTP:)
>>>>>>>>> email address of ProxyAddresses?
>>>>>>>>> 3) What if I want to modify an email address later (either primary or
>>>>>>>>> alternate)? I always seem to get an error when calling MailEnable on an
>>>>>>>>> existing contact with existing primary and alternate email addresses. For
>>>>>>>>> existing contacts, I've tried just setting ProxyAddresses and skipping the
>>>>>>>>> call to MailEnable, but it doesn't update other properties, such as Email on
>>>>>>>>> the General tab and Email on the Exchange General tab (in AD Properties).
>>>>>>>>>
>>>>>>>>> In short, I guess I need more details on when to call MailEnable, what other
>>>>>>>>> calls to make or properties to set, and in what order, when both creating and
>>>>>>>>> modifying an AD contact.
>>>>>>>>>
>>>>>>>>> Thanks very much for any help,
date: Thu, 01 Jun 2006 01:32:18 -0400
author: Joe Richards [MVP]
Re: particulars of MailEnable
Thanks for your detailed explanations, Joe. You revealed what no MS
documentation and no KB article has.
Cheers,
Ray Humphrey
"Joe Richards [MVP]" wrote:
> When you mailenable a user or contact you specify the target address in
> the mailenable call.
>
> Once that is set, the only way to change it that I am aware of is to go
> outside of CDOEXM and set the attributes directly with ADSI or LDAP API
> calls.
>
> When you do that, the RUS should set that address as the primary SMTP
> and then add a secondary based on the recipient policy. For instance if
> I have a recipient policy that sets an SMTP address to be
> mailnickname@joe.com it will take an object (user or contact) that has
> been mail enabled with a specified targetaddress of someone@joeware.net
> it will set the targetAddress and primary SMTP in the proxyAddresses to
> be someone@joeware.net and set a secondary SMTP of mailnickname@joe.com.
>
> You only want to mailbox enable objects if you need an actual mailbox
> for the object. If there is already a mailbox somewhere (On Exchange or
> whatever) anywhere else, then use a mailenabled contact (if they don't
> need to auth on the local forest) or mailenabled user (if they need to
> auth).
>
> When you create a contact or a user, the RUS shouldn't be touching the
> object until you have mailenabled or mailboxenabled the object. If you
> are experiencing something else, it means your code is setting
> attributes on the object creation that it probably shouldn't be.
>
>
>
> --
> Joe Richards Microsoft MVP Windows Server Directory Services
> Author of O'Reilly Active Directory Third Edition
> www.joeware.net
>
>
> ---O'Reilly Active Directory Third Edition now available---
>
> http://www.joeware.net/win/ad3e.htm
>
>
>
> T Ray Humphrey wrote:
> > So here is the problem. TargetAddress is read-only. It is set by calling
> > MailEnable. MailEnable only seems to work for mail enabling new contacts, not
> > for modifying existing contacts. Way down near the beginning of this post I
> > mentioned that a debug step-through with enough delay between the contact
> > creation and the MailEnable produces an error - I was wondering if MailEnable
> > won't work if the RUS has come through and created the SMTP: address (our RUS
> > would create an SMTP: that we don't want -- an "internal" address that a
> > contact wouldn't use). If I create a contact and then MailEnable right away,
> > no problem (our RUS then creates an smtp: address -- I'm not real savvy about
> > RUS, but I think that's what's happening).
> >
> > Anyway, back to my problem. I can't set TargetAddress as it's read-only. For
> > existing contacts, I can't call just MailEnable. Setting ProxyAddresses
> > doesn't set TargetAddress. So, how the heck do I modify an SMTP: address for
> > an existing contact? Do I have to call MailDisable then MailEnable?
> >
> > At the risk of wearing out my welcome, let me ask, should I be calling
> > MailEnable for user objects I create too? I don't currently. Instead, I call
> > CreateMailBox. That seems to work fine, but this whole discussion has me
> > questioning everything.
> >
> > Many thanks,
> > Ray
> >
> > "Joe Richards [MVP]" wrote:
> >
> >> Ah sorry, my fault, you have been saying mailenabled all of this time
> >> and I looked at a mailbox enabled object.
> >>
> >> That email address should be the targetAddress.
> >>
> >> --
> >> Joe Richards Microsoft MVP Windows Server Directory Services
> >> Author of O'Reilly Active Directory Third Edition
> >> www.joeware.net
> >>
> >>
> >> ---O'Reilly Active Directory Third Edition now available---
> >>
> >> http://www.joeware.net/win/ad3e.htm
> >>
> >>
> >>
> >> T Ray Humphrey wrote:
> >>> Ahh. You are probably looking at a User. The Exchange General tab is
> >>> different for a contact. Therein lies the beginnings of my problem...
> >>>
> >>> Ray
> >>>
> >>> "Joe Richards [MVP]" wrote:
> >>>
> >>>> What version of Exchange? I am looking at the Exchange General Tab in
> >>>> Exchange Server 2003 and I see a field for MailBox Store and one for
> >>>> Alias. Other than that I have three buttons for setting delivery
> >>>> options, etc.
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Joe Richards Microsoft MVP Windows Server Directory Services
> >>>> Author of O'Reilly Active Directory Third Edition
> >>>> www.joeware.net
> >>>>
> >>>>
> >>>> ---O'Reilly Active Directory Third Edition now available---
> >>>>
> >>>> http://www.joeware.net/win/ad3e.htm
> >>>>
> >>>>
> >>>>
> >>>> T Ray Humphrey wrote:
> >>>>> No, Joe, the Alias field is at the top of the tab. Since our application
> >>>>> manages email for many domains, we generate a value for that at contact
> >>>>> creation time, it never changes, and we don't expose it to the user.
> >>>>>
> >>>>> The E-mail field is right under it. In my testing, I modified ProxyAddresses
> >>>>> and SMTPEmail in CDOEXM calls (not using ADUC/ESM). If I look at the
> >>>>> properties of that contact in ADUC now, the ProxyAddresses and SMTPEmail are
> >>>>> as I set them, but the E-mail field on the Exchange General tab still shows
> >>>>> an old "SMTP:BlahBlah@WoofWoof.com". So modifying the properties that I did
> >>>>> had no effect on this field.
> >>>>>
> >>>>> Continued thanks,
> >>>>> Ray
> >>>>>
> >>>>> "Joe Richards [MVP]" wrote:
> >>>>>
> >>>>>> Do you mean the Alias field on the Exchange general tab?
> >>>>>>
> >>>>>> That is the mailnickname attribute.
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> --
> >>>>>> Joe Richards Microsoft MVP Windows Server Directory Services
> >>>>>> Author of O'Reilly Active Directory Third Edition
> >>>>>> www.joeware.net
> >>>>>>
> >>>>>>
> >>>>>> ---O'Reilly Active Directory Third Edition now available---
> >>>>>>
> >>>>>> http://www.joeware.net/win/ad3e.htm
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> T Ray Humphrey wrote:
> >>>>>>> Hi Joe,
> >>>>>>> Thank you for saying out load that CDOEXM sucks. I was trying to be polite
> >>>>>>> on this forum because I thought I might offend someone, but I have spent WAY
> >>>>>>> TOO much time trying to guess which property to set: write a test program,
> >>>>>>> set a property, go to ESM and see what's changed. It's not as if the
> >>>>>>> documentation has any information beyond the briefest description and the
> >>>>>>> very vanilla example.
> >>>>>>>
> >>>>>>> I modified my test program to call MailEnable only when creating contacts.
> >>>>>>> Otherwise, I set ProxyAddresses to change emails, using SMTP: and smtp: as
> >>>>>>> appropriate. I also set the SMTPEmail property, which seems to drive the
> >>>>>>> E-mail field on the General tab in ADUC for the contact. I don't know if that
> >>>>>>> property is critical for sending emails, but for consistency, it's right to
> >>>>>>> update it.
> >>>>>>>
> >>>>>>> The one field I can't find a property for is the E-mail field on the
> >>>>>>> Exchange General tab. When I change ProxyAddresses, that does not update.
> >>>>>>> This property seems like it might be critical for sending emails. Do you know
> >>>>>>> the magic property?
> >>>>>>>
> >>>>>>> Thanks so much for your help. And here's hoping that CDOEXM dies a quick and
> >>>>>>> painful death!
> >>>>>>>
> >>>>>>> Ray
> >>>>>>>
> >>>>>>> "Joe Richards [MVP]" wrote:
> >>>>>>>
> >>>>>>>> 1a. You would set the additional proxyAddresses values.
> >>>>>>>> 1b. Yes, they should be prefixed with smtp: in lowercase, uppercase
> >>>>>>>> denotes primary address.
> >>>>>>>>
> >>>>>>>> 2. Yes, it is based off the Recipient Policy that applied to the user.
> >>>>>>>>
> >>>>>>>> 3. If you want to change the primary address you should change the other
> >>>>>>>> attributes as well.
> >>>>>>>>
> >>>>>>>> In general, the CDOEXM interfaces for Exchange enabling objects (either
> >>>>>>>> mailbox or mail enabled) pretty much suck ass. They are a light attempt
> >>>>>>>> at giving functionality. As you may have surmised, MSFT doesn't actually
> >>>>>>>> use those methods in their own tools such as ESM or ADUC. They use MAPI
> >>>>>>>> calls and then put together these mechanisms for people outside of MSFT
> >>>>>>>> to use though they don't have full functionality.
> >>>>>>>>
> >>>>>>>> Allegedly this is all fixed in E12 as they toss out CDOEXM and WMI
> >>>>>>>> interfaces and replace it with MONAD (or PowerShell if you prefer) but I
> >>>>>>>> heard the exact same thing when E2K3 was coming out, it is all fixed!
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> --
> >>>>>>>> Joe Richards Microsoft MVP Windows Server Directory Services
> >>>>>>>> Author of O'Reilly Active Directory Third Edition
> >>>>>>>> www.joeware.net
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> ---O'Reilly Active Directory Third Edition now available---
> >>>>>>>>
> >>>>>>>> http://www.joeware.net/win/ad3e.htm
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> T Ray Humphrey wrote:
> >>>>>>>>> Hi,
> >>>>>>>>> I have an ASP.NET web application that is creating contact objects in AD. At
> >>>>>>>>> the time of contact creation, I want to enable emails to that contact. I have
> >>>>>>>>> read about MailEnable from IMailRecipient, and that seems to be the thing to
> >>>>>>>>> call. The documentation states that it sets the properties: ProxyAddresses,
> >>>>>>>>> SMTPEmail and X400Email.
> >>>>>>>>>
> >>>>>>>>> Mostly that works, but there does seem to be some timing involved. During a
> >>>>>>>>> debug session, if I wait long enough between creating the AD contact and
> >>>>>>>>> calling MailEnable, it fails (lets say 30 seconds). If I step straight
> >>>>>>>>> through the code, no problem.
> >>>>>>>>>
> >>>>>>>>> In addition to that timing issue, I have a couple of other questions that
> >>>>>>>>> the documentation and code samples don't seem to cover:
> >>>>>>>>> 1) How do I set up an alternate email address? I wouldn't call MailEnable on
> >>>>>>>>> each address, would I? Must I set ProxyAddresses manually? Should the
> >>>>>>>>> alternate email be "smtp:" instead of "SMTP:"?
> >>>>>>>>> 2)Related to above, does MailEnable particularly set the primary (SMTP:)
> >>>>>>>>> email address of ProxyAddresses?
> >>>>>>>>> 3) What if I want to modify an email address later (either primary or
> >>>>>>>>> alternate)? I always seem to get an error when calling MailEnable on an
> >>>>>>>>> existing contact with existing primary and alternate email addresses. For
> >>>>>>>>> existing contacts, I've tried just setting ProxyAddresses and skipping the
> >>>>>>>>> call to MailEnable, but it doesn't update other properties, such as Email on
> >>>>>>>>> the General tab and Email on the Exchange General tab (in AD Properties).
> >>>>>>>>>
> >>>>>>>>> In short, I guess I need more details on when to call MailEnable, what other
> >>>>>>>>> calls to make or properties to set, and in what order, when both creating and
> >>>>>>>>> modifying an AD contact.
> >>>>>>>>>
> >>>>>>>>> Thanks very much for any help,
>
date: Thu, 1 Jun 2006 05:52:01 -0700
author: T Ray Humphrey
Re: particulars of MailEnable
Yeah the Exchange docs, especially around what the attributes are and
how to do things programmatically sucks pretty bad. You may want to
check out the book in my signature as I have a chapter in there on
writing scripts for Exchange that you might find useful. It is taken
from a chapter I wrote for the Windows Server Cookbook. It is also going
to make it into the Active Directory Cookbook Second Edition whenever
that comes out.
--
Joe Richards Microsoft MVP Windows Server Directory Services
Author of O'Reilly Active Directory Third Edition
www.joeware.net
---O'Reilly Active Directory Third Edition now available---
http://www.joeware.net/win/ad3e.htm
T Ray Humphrey wrote:
> Thanks for your detailed explanations, Joe. You revealed what no MS
> documentation and no KB article has.
>
> Cheers,
> Ray Humphrey
>
> "Joe Richards [MVP]" wrote:
>
>> When you mailenable a user or contact you specify the target address in
>> the mailenable call.
>>
>> Once that is set, the only way to change it that I am aware of is to go
>> outside of CDOEXM and set the attributes directly with ADSI or LDAP API
>> calls.
>>
>> When you do that, the RUS should set that address as the primary SMTP
>> and then add a secondary based on the recipient policy. For instance if
>> I have a recipient policy that sets an SMTP address to be
>> mailnickname@joe.com it will take an object (user or contact) that has
>> been mail enabled with a specified targetaddress of someone@joeware.net
>> it will set the targetAddress and primary SMTP in the proxyAddresses to
>> be someone@joeware.net and set a secondary SMTP of mailnickname@joe.com.
>>
>> You only want to mailbox enable objects if you need an actual mailbox
>> for the object. If there is already a mailbox somewhere (On Exchange or
>> whatever) anywhere else, then use a mailenabled contact (if they don't
>> need to auth on the local forest) or mailenabled user (if they need to
>> auth).
>>
>> When you create a contact or a user, the RUS shouldn't be touching the
>> object until you have mailenabled or mailboxenabled the object. If you
>> are experiencing something else, it means your code is setting
>> attributes on the object creation that it probably shouldn't be.
>>
>>
>>
>> --
>> Joe Richards Microsoft MVP Windows Server Directory Services
>> Author of O'Reilly Active Directory Third Edition
>> www.joeware.net
>>
>>
>> ---O'Reilly Active Directory Third Edition now available---
>>
>> http://www.joeware.net/win/ad3e.htm
>>
>>
>>
>> T Ray Humphrey wrote:
>>> So here is the problem. TargetAddress is read-only. It is set by calling
>>> MailEnable. MailEnable only seems to work for mail enabling new contacts, not
>>> for modifying existing contacts. Way down near the beginning of this post I
>>> mentioned that a debug step-through with enough delay between the contact
>>> creation and the MailEnable produces an error - I was wondering if MailEnable
>>> won't work if the RUS has come through and created the SMTP: address (our RUS
>>> would create an SMTP: that we don't want -- an "internal" address that a
>>> contact wouldn't use). If I create a contact and then MailEnable right away,
>>> no problem (our RUS then creates an smtp: address -- I'm not real savvy about
>>> RUS, but I think that's what's happening).
>>>
>>> Anyway, back to my problem. I can't set TargetAddress as it's read-only. For
>>> existing contacts, I can't call just MailEnable. Setting ProxyAddresses
>>> doesn't set TargetAddress. So, how the heck do I modify an SMTP: address for
>>> an existing contact? Do I have to call MailDisable then MailEnable?
>>>
>>> At the risk of wearing out my welcome, let me ask, should I be calling
>>> MailEnable for user objects I create too? I don't currently. Instead, I call
>>> CreateMailBox. That seems to work fine, but this whole discussion has me
>>> questioning everything.
>>>
>>> Many thanks,
>>> Ray
>>>
>>> "Joe Richards [MVP]" wrote:
>>>
>>>> Ah sorry, my fault, you have been saying mailenabled all of this time
>>>> and I looked at a mailbox enabled object.
>>>>
>>>> That email address should be the targetAddress.
>>>>
>>>> --
>>>> Joe Richards Microsoft MVP Windows Server Directory Services
>>>> Author of O'Reilly Active Directory Third Edition
>>>> www.joeware.net
>>>>
>>>>
>>>> ---O'Reilly Active Directory Third Edition now available---
>>>>
>>>> http://www.joeware.net/win/ad3e.htm
>>>>
>>>>
>>>>
>>>> T Ray Humphrey wrote:
>>>>> Ahh. You are probably looking at a User. The Exchange General tab is
>>>>> different for a contact. Therein lies the beginnings of my problem...
>>>>>
>>>>> Ray
>>>>>
>>>>> "Joe Richards [MVP]" wrote:
>>>>>
>>>>>> What version of Exchange? I am looking at the Exchange General Tab in
>>>>>> Exchange Server 2003 and I see a field for MailBox Store and one for
>>>>>> Alias. Other than that I have three buttons for setting delivery
>>>>>> options, etc.
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Joe Richards Microsoft MVP Windows Server Directory Services
>>>>>> Author of O'Reilly Active Directory Third Edition
>>>>>> www.joeware.net
>>>>>>
>>>>>>
>>>>>> ---O'Reilly Active Directory Third Edition now available---
>>>>>>
>>>>>> http://www.joeware.net/win/ad3e.htm
>>>>>>
>>>>>>
>>>>>>
>>>>>> T Ray Humphrey wrote:
>>>>>>> No, Joe, the Alias field is at the top of the tab. Since our application
>>>>>>> manages email for many domains, we generate a value for that at contact
>>>>>>> creation time, it never changes, and we don't expose it to the user.
>>>>>>>
>>>>>>> The E-mail field is right under it. In my testing, I modified ProxyAddresses
>>>>>>> and SMTPEmail in CDOEXM calls (not using ADUC/ESM). If I look at the
>>>>>>> properties of that contact in ADUC now, the ProxyAddresses and SMTPEmail are
>>>>>>> as I set them, but the E-mail field on the Exchange General tab still shows
>>>>>>> an old "SMTP:BlahBlah@WoofWoof.com". So modifying the properties that I did
>>>>>>> had no effect on this field.
>>>>>>>
>>>>>>> Continued thanks,
>>>>>>> Ray
>>>>>>>
>>>>>>> "Joe Richards [MVP]" wrote:
>>>>>>>
>>>>>>>> Do you mean the Alias field on the Exchange general tab?
>>>>>>>>
>>>>>>>> That is the mailnickname attribute.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Joe Richards Microsoft MVP Windows Server Directory Services
>>>>>>>> Author of O'Reilly Active Directory Third Edition
>>>>>>>> www.joeware.net
>>>>>>>>
>>>>>>>>
>>>>>>>> ---O'Reilly Active Directory Third Edition now available---
>>>>>>>>
>>>>>>>> http://www.joeware.net/win/ad3e.htm
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> T Ray Humphrey wrote:
>>>>>>>>> Hi Joe,
>>>>>>>>> Thank you for saying out load that CDOEXM sucks. I was trying to be polite
>>>>>>>>> on this forum because I thought I might offend someone, but I have spent WAY
>>>>>>>>> TOO much time trying to guess which property to set: write a test program,
>>>>>>>>> set a property, go to ESM and see what's changed. It's not as if the
>>>>>>>>> documentation has any information beyond the briefest description and the
>>>>>>>>> very vanilla example.
>>>>>>>>>
>>>>>>>>> I modified my test program to call MailEnable only when creating contacts.
>>>>>>>>> Otherwise, I set ProxyAddresses to change emails, using SMTP: and smtp: as
>>>>>>>>> appropriate. I also set the SMTPEmail property, which seems to drive the
>>>>>>>>> E-mail field on the General tab in ADUC for the contact. I don't know if that
>>>>>>>>> property is critical for sending emails, but for consistency, it's right to
>>>>>>>>> update it.
>>>>>>>>>
>>>>>>>>> The one field I can't find a property for is the E-mail field on the
>>>>>>>>> Exchange General tab. When I change ProxyAddresses, that does not update.
>>>>>>>>> This property seems like it might be critical for sending emails. Do you know
>>>>>>>>> the magic property?
>>>>>>>>>
>>>>>>>>> Thanks so much for your help. And here's hoping that CDOEXM dies a quick and
>>>>>>>>> painful death!
>>>>>>>>>
>>>>>>>>> Ray
>>>>>>>>>
>>>>>>>>> "Joe Richards [MVP]" wrote:
>>>>>>>>>
>>>>>>>>>> 1a. You would set the additional proxyAddresses values.
>>>>>>>>>> 1b. Yes, they should be prefixed with smtp: in lowercase, uppercase
>>>>>>>>>> denotes primary address.
>>>>>>>>>>
>>>>>>>>>> 2. Yes, it is based off the Recipient Policy that applied to the user.
>>>>>>>>>>
>>>>>>>>>> 3. If you want to change the primary address you should change the other
>>>>>>>>>> attributes as well.
>>>>>>>>>>
>>>>>>>>>> In general, the CDOEXM interfaces for Exchange enabling objects (either
>>>>>>>>>> mailbox or mail enabled) pretty much suck ass. They are a light attempt
>>>>>>>>>> at giving functionality. As you may have surmised, MSFT doesn't actually
>>>>>>>>>> use those methods in their own tools such as ESM or ADUC. They use MAPI
>>>>>>>>>> calls and then put together these mechanisms for people outside of MSFT
>>>>>>>>>> to use though they don't have full functionality.
>>>>>>>>>>
>>>>>>>>>> Allegedly this is all fixed in E12 as they toss out CDOEXM and WMI
>>>>>>>>>> interfaces and replace it with MONAD (or PowerShell if you prefer) but I
>>>>>>>>>> heard the exact same thing when E2K3 was coming out, it is all fixed!
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Joe Richards Microsoft MVP Windows Server Directory Services
>>>>>>>>>> Author of O'Reilly Active Directory Third Edition
>>>>>>>>>> www.joeware.net
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---O'Reilly Active Directory Third Edition now available---
>>>>>>>>>>
>>>>>>>>>> http://www.joeware.net/win/ad3e.htm
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> T Ray Humphrey wrote:
>>>>>>>>>>> Hi,
>>>>>>>>>>> I have an ASP.NET web application that is creating contact objects in AD. At
>>>>>>>>>>> the time of contact creation, I want to enable emails to that contact. I have
>>>>>>>>>>> read about MailEnable from IMailRecipient, and that seems to be the thing to
>>>>>>>>>>> call. The documentation states that it sets the properties: ProxyAddresses,
>>>>>>>>>>> SMTPEmail and X400Email.
>>>>>>>>>>>
>>>>>>>>>>> Mostly that works, but there does seem to be some timing involved. During a
>>>>>>>>>>> debug session, if I wait long enough between creating the AD contact and
>>>>>>>>>>> calling MailEnable, it fails (lets say 30 seconds). If I step straight
>>>>>>>>>>> through the code, no problem.
>>>>& |