On 7/31/2012 5:06 AM, ayeungied wrote:
>
> the sAMAccountName = xxxx_yyy
>
> I need to create a proxyAddress as
>
> ProxyAddresses = SMTP:xxxxyyy@abc.com.
>
> How to acheive it?
>
> Thanks & Regards,


So are you mail enabling the user with the Exchange powershells and
service built into the driver? If so you will get an SMTP: entry already.

Upper case SMTP vs lower case smtp: means primary in these fields.

So you would want to loop over the values in AD and remove any existing
SMTP: values, since they are very Highlander'ish in AD and there can be
only one.

<do-for-each>
<arg-node-set>
<token-query class-name="User">
<arg-dn>
<token-text
xml:space="preserve">Cn=user,ou=users,dc=doman,dc= com</token-text>
</arg-dn>
<arg-string>
<token-text xml:space="preserve">proxyAddresses</token-text>
</arg-string>
</token-query>
</arg-node-set>
<arg-actions>
<do-if>
<arg-conditions>
<and>
<if-local-variable mode="regex" name="current-node"
op="equal">^SMTP:</if-local-variable>
</and>
</arg-conditions>
<arg-actions>
<do-remove-dest-attr-value class-name="User" name="proxyAddresses">
<arg-value type="string">
<token-local-variable name="current-node"/>
</arg-value>
</do-remove-dest-attr-value>
</arg-actions>
<arg-actions/>
</do-if>
</arg-actions>
</do-for-each>

Then I am not sure if your issue is just removing underscores? If so,
it could be as simple as:

<do-add-dest-attr-value class-name="User" name="proxyAddresses">
<arg-value type="string">
<token-replace-all regex="_" replace-with="">
<token-dest-attr class-name="User" name="sAMAccountName"/>
</token-replace-all>
</arg-value>
</do-add-dest-attr-value>