Site Name Error with ADSI

K

Ken Parchinski

I am trying to create a custom recipient in our Exchange
5.5 SP4 Server Address Book using ADSI and the following
code. I retrieved the site name (OU) and organizational
unit (O) from similar routines I found on the MSDN
website. The problem, I am thinking, is that our site
name has a comma in it (Company Name, Inc.) and the
parameters are comma separated. I am receiving a -
2147016656 Automation Error - There is no such object on
the server. I sent an email to Stein Borge who authored a
WSH book and he suggested a \ prior to the , in the site
name; however, this did not work.

Function CreateCustomRecipient(ByVal sServerName As
String, ByVal sOU As String, ByVal sSN As String) As
Boolean

Dim strDisplayname As String
Dim strAlias As String
Dim objCont As IADsContainer
Dim objNewCR As IADs

On Error GoTo ERR_MESSAGE
'Debug.Print "LDAP://exchsvr/cn=Recipients,ou=Automated
Resources Group\,Inc.,o=ARGI"
Set objCont = GetObject
("LDAP://exchsvr/cn=Recipients,ou=Automated Resources
Group, Inc.,o=ARGI")
Set objNewCR = objCont.Create("Remote-Address", CStr
("cn=" & strAlias))
objNewCR.Put "cn", CStr(strDisplayname)
objNewCR.Put "uid", CStr(strAlias)
objNewCR.Put "Target-
Address", "SMTP:[email protected]"
objNewCR.SetInfo
CreateCustomerRecipient = True
Exit Function

ERR_MESSAGE:
'MsgBox CStr(Err.Number) & " - " & Err.Description
CreateCustomRecipient = False
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top