Contact email address gets mangled _OR_ does not appear in global address book

Contact email address gets mangled _OR_ does not appear in global address book

Post by Paul Linc » Thu, 16 Nov 2000 04:00:00



When I add a contact using the code snippet below, it is fine for a minute
or two, but after a few minutes pass, the email address gets
changed/mangled.  It looks like the recipient policy overrides the email
address I programmatically enter.  If I do _not_ fill in the mailNickName
property, it does not mangle the email address, but it wont show up in the
Global Address Book.  The mangling process basically changes the email

SMTP address).

What am I doing wrong?

........
 ' Create the contact
 Set oContact = oObject.Create("contact", "CN=FirstName LastName")
 oContact.Put "name", "FirstName LastName"
 oContact.Put "displayName", "FirstName LastName"
 oContact.Put "givenName", "FirstName"
 oContact.Put "sn", "LastName"
 oContact.Put "mailNickName", "Firstname Lastname"

 oContact.SetInfo

 
 
 

Contact email address gets mangled _OR_ does not appear in global address book

Post by Paul Linc » Fri, 17 Nov 2000 04:00:00


Figured it out, but needed to use CDO _and_ ADSI (since I cant figure out
how to get the display name I wanted with straight CDO).
 ------------------------
<%
' MAIN

Dim CommonName   ' CN

CommonName = CreateContact_CDO
ModifyContact_ADSI CommonName

' ********************************************************************
' Create Contact using CDO
' ********************************************************************
Function CreateContact_CDO

 Dim iPerson   ' IPerson Interface
 Dim iRecip    ' IMailRecipient Interface
 Dim CommonName ' Common Name - CN

 Set iPerson = CreateObject("CDO.Person")
 CommonName = "FirstnameLastname"

' Now create the object in Active Directory

 With iPerson
   .FirstName = "FirstName"
   .LastName  = "LastName"
   .Fields("objectClass") = "contact"
   .Fields.Update
   .DataSource.SaveTo "LDAP://CN=" + CommonName +
",OU=Contacts,DC=linck,DC=net"

   Set iRecip = .GetInterface("IMailRecipient")

   .DataSource.Save
 End With

 CreateContact_CDO = CommonName

 ' Clean Up
 Set iPerson = nothing
 Set iRecip = nothing

End Function

' ********************************************************************
' Modify a contact using ADSI
' I only do this because I want to modify the display name
' and I can not figure out how to do it within the CDO (and create)
' ********************************************************************
Sub ModifyContact_ADSI(CommonName)

 ' Find the contact
 Set oContact=GetObject("LDAP://" + "CN=" + CommonName + ",OU=Contacts,
DC=linck,DC=net")
 oContact.Put "displayName", "FirstName LastName"
 oContact.SetInfo

End Sub

' ********************************************************************
' ADD a contact using ADSI
' Currently this function is not used since when the contact
' is added, recipient rules mangle the email id (mail)
' ********************************************************************
Sub AddContact_ADSI
Dim oContainer
Dim oContact

 ' Get the parent - I have contacts stored in contacts OU for convenience
 Set  oContainer=GetObject("LDAP://OU=Contacts, DC=linck,DC=net")

 ' Create the contact
 ' Current Problem is that the mail name gets messed up in the dir
 Set oContact = oObject.Create("contact", "CN=FirstNameLastName")
 oContact.Put "name", "FirstName LastName"
 oContact.Put "displayName", "FirstName LastName"
 oContact.Put "givenName", "FirstName"
 oContact.Put "sn", "LastName"
 oContact.Put "mailNickName", "FirstName"

 oContact.SetInfo

 ' Clean Up
 Set oContact = Nothing
 Set oContainer = Nothing

End Sub
%>

 
 
 

1. Outlook Address book not found - only Global Address list

Hi

We are migrating from NT4 SBS to W2K SBS; and I will
export and import all the .pst files manually.

I have done a test run and this works, however I cannot
find my Outlook Address book, only the Global address
list!!

This means I cannot browse my contacts folder from the
address book. This will not go down well with all the
users.

Can anyone offer any help or shed any light on what may
have happened/what I have done wrong?

Thanks in advance

Harry

2. 68K pains on a ppc

3. Importing Outlook Contacts into Exchange Global Address Book

4. How to make 4.1 Disks...

5. Using other peoples contacts as e-mail Address Book ?????

6. Shutdown, restart, & hibernate

7. Cannot View Contacts as e-mail address book SBS 2003

8. Restricting Console Activity

9. Creating virtual email addresses based on one ISP email address?

10. Internet Mail address in Global Address List?

11. Exchange 2000 - adding global contacts/address list

12. Any way to specify an internal email address to forward to an external email address?

13. Adding contacts to the Global Address List