Specified cast invalid error

  • Thread starter Thread starter Gautam
  • Start date Start date
G

Gautam

Dim deGroupDist As New DirectoryEntry()
deGroupDist = deContainer.Invoke("Create", New Object() {"group",
"CN=test" })
Dim AdMailRecip As CDOExm.IMailRecipient =
CType(deGroupDist.NativeObject,CDOExm.IMailRecipient)
AdMailRecip.MailEnable()

I am getting error number: 13, "specified cast invalid" error on the
first line. I am using cdoexm.dll (version 6.0.6249.0, sp 3) and
system.directoryservices(v1.0.3705).
Basically the error is occuring when I am trying to cast the
directoryEntry object as IMailRecipient object. Please help.
Thanks,
Gautam.
 
Make sure the machine you are running your app on has the Exchange Admin Tools SP2 or Higher on it. Without it you will get the Invalid cast err

Hope that helps :)
 
Back
Top