Here's part of the code:
Code: Select all
email = chr(34) & givenNameNew & " " & surNameNew & chr(34) & " <" & LCase( givenNameNew & "." & surNameNew & "@domain.com> " )
email = email & ";" & LCase( Left( givenNameNew, 1 ) & surNameNew & "@domain.com" )
If( Len( surName ) > 6 ) Then
email = email & ";" & Left( givenNameNew, 1 ) & Left( surNameNew, 6 ) & "@domain.com"
End If
email = Split( email, ";" )
Set objUser = GetObject( ADsPath )
objUser.Put "givenName", givenNameNew
objUser.Put "sn", surNameNew
objUser.Put "scalixMailnode", "default"
objUser.Put "scalixMailboxClass", "FULL"
objUser.Put "scalixScalixObject", "TRUE"
objUser.Put "scalixEmailAddress", email
objUser.SetInfo
More explanation: any email address over 7 characters actually has to be an alias for a truncated real email address. So, I have to create those as aliases too.
Anyway, the code works just it should, but it appears that AD or the GUI extensions don't.
Once the code has been run, checking the update by using ADSIEdit.msc shows that the scalixEmailAddress attribute contains the following:
Code: Select all
"Test User" <test.user@domain.com>;tuser@domain.com
When I compare this to a test user that I update by hand, they have exactly the same format.
However, when I check the AD entry in ADUC, the default email address is listed in the "Others" box along with the alias (tuser@domain.com).
So, I changed the following line of code:
Code: Select all
objUser.Put "scalixEmailAddress", email
to
Code: Select all
objUser.Put "scalixEmailAddress", email(0)
Now I have just the default email address being added. Again, I run the script, the attribute appears to be formatted correctly when viewing it in ADSIEdit.msc but when I check it in ADUC only the name appears in the "Default Email". In other words, the only part that shows up is "Test User" and the address is not seen. But again, if I check the actual AD entry, it's there.
So, where did I screw up? Should the "< >" characters be something different because it's unicode?