Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

distibution and external contacts 1

Status
Not open for further replies.

Fabit

Technical User
Nov 22, 2005
95
US
Hi everyone,

I have a list of outside vendors that I need to send email too, which i have created a distribution list in my outlook. how can I export whatever I have in my outlook distribution list to distribution list in my ad? or is there a way?

Most Appreciative,
 
I'm not sure about exporting your outlook distribution list. Did you want it in AD so that you can see the Vendors in the Global Address List? Usually what I do is create contacts in AD for vendors. You could add contacts to a distribution group in AD.
 
yea, I know, but I have not created the contacts in ad yet. I also have tons of contacts to put in. I am just looking for a faster way instead of typing them all in by hand.
 
Here ya go, I should get a star for this LoL

Const olFolderContacts = 10

Dim strDisplayName, strEmail, strDescription, strDistList
Dim objContacts, objOU, objOutlook, objNamespace, objDistList


Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set colContacts = objNamespace.GetDefaultFolder(olFolderContacts).Items


objDistList = (INPUTBOX("Enter Outlook Dist List Name"))

Set DstLstName = colContacts.Item(objDistList)


If TypeName(DstLstName) = "DistListItem" Then
For j = 1 To DstLstName.MemberCount
strDisplayName = DstLstName.GetMember(j).Name
strEmail = DstLstName.GetMember(j).Address
CreateUser
MailingSetup
Next
Else
WScript.Echo "Name is not a Dist List"

End If

Wscript.Echo "Done"
WScript.Quit



'####################################
'You have to edit this part of the script to fit your situation, this will place the contacts
'in whatever OU you want them to be in.
'#####################################
Function CreateUser()
Set objOU = GetObject("LDAP://ou=<Organizational Unit>,dc=<domain>,dc=<com,net,org, etc..>")
Set objContact = objOU.Create("Contact", strContactName)
objContact.Put "displayName",strDisplayName
objContact.Put "Description", strDescription
objContact.Put "Mail", strEmail
objContact.SetInfo
End Function



Function MailingSetup()
objContact.MailEnable strEmail
objContact.SetInfo
End Function
 
w33mhz said:
Here ya go, I should get a star for this LoL
Careful. Soliciting stars for yourself is expressly forbidden.

Interesting script. I'll have to try that out. If it works, you'll certainly get a star from me. I would imagine, though, you'll want to add a comment in your script that reminds people they have to have the appropriate rights to create AD objects.

Pat Richard, MCSE MCSA:Messaging CNA
Microsoft Exchange MVP
Want to know how email works? Read for yourself -
 
Sorry I didn't know. It should work I was tring to make it a little more complex then what it needed to be, so I kind of stripped it. You are right, I was just assuming that they would have already had rights in AD.

I pulled the 2 functions from an actual script I wrote to add a bunch of contacts to our enviorment after we bought another company out and had to add the users as contacts.
 
Oh I also forgot to mention that a securtiy popup will state that a program is tring to access your outlook and if you want to allow or deny this program I just allow it for 1 min.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top