Setting Exchange Security Error: The directory property cannot be found in the cache

  • Thread starter Thread starter Jeremy Chapman
  • Start date Start date
J

Jeremy Chapman

In an asp.net page, I'm creating an exchange account. I've created the
account, and tied it to a primary NT account. Now I'm trying to assign
permissions to it but I get an error of "The directory property cannot be
found in the cache" when calling SetSecurityDescriptor. Any suggestions?

ADSSECURITYLib.ADsSecurity pSEC = new ADsSecurity();
ActiveDs.IADsSecurityDescriptor pSD = (ActiveDs.IADsSecurityDescriptor
pSEC.GetSecurityDescriptor(pNewUser.Path);

ActiveDs.IADsAccessControlList pDACL = (ActiveDs.IADsAccessControlList)
pSD.DiscretionaryAcl;

ActiveDs.AccessControlEntry pACE = new AccessControlEntry();
pACE.Trustee = pAccount.ADServer + "\\" + pAccount.SAMAccountName;
pACE.AccessMask = ADS_RIGHT_EXCH_MODIFY_USER_ATT |
LDAPConst.ADS_RIGHT_EXCH_MAIL_SEND_AS |
LDAPConst.ADS_RIGHT_EXCH_MAIL_RECEIVE_AS;

pACE.AceType = (int)(ActiveDs.ADS_ACETYPE_ENUM.ADS_ACETYPE_ACCESS_ALLOWED);

pDACL.AddAce(pACE);
pSD.DiscretionaryAcl = pDACL;
pSEC.SetSecurityDescriptor(pSD, pNewUser.Path);
 
Back
Top