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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cdoexm IMailRecipient.MailEnable obj doesn't support property / method

Status
Not open for further replies.

frumpus

Programmer
Aug 1, 2005
113
US
I am working with this small script to MailEnable a user (no mailbox). The workstation has exchange management tools installed so cdoexm.dll is registered, but I'm having trouble calling MailEnable on the IMailRecipient interface.

Code:
strADsPath = "LDAP://domaincontroller/CN=username, OU=Users, OU=Students, DC=someschool, DC=EDU"
strEmail = "username@email.someschool.edu"

'mail enable the user
Set objPerson = CreateObject("CDO.Person")
objPerson.DataSource.Open strADsPath
Set iRecip = objPerson.Getinterface("IMailRecipient")
Set iRecip = objPerson
iRecip.MailEnable strEmail 'this is the line that errors
objPerson.Datasource.Save

Error: Object doesn't support this property or method: 'IRecip.MailEnable'
Code: 800A01B6

From what I've read this code should be correct. Can anyone tell me what is going on here?
 
Update: Just to be sure it wasn't a dll related issue I ran the script on the Exchange 2003 server itself and received the same error.
 
Set iRecip = objPerson.Getinterface("IMailRecipient")
Set iRecip = objPerson

Which iRecip you want to use ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Well, that's a good question. I'm just following the code from MSDN there.

As it turns out though, we are moving to Exchange 2007 soon, in which MailEnable is no longer allowed. So it has been decided to scrap this code anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top