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.
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?
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?