.net - UserPrincipal.GetAuthorizationGroups throws exception -
in following code
principalcontext* context = new principalcontext(contexttype::domain, domainname); userprincipal* user = userprincipal::findbyidentity(context, identitytype::samaccountname, username); principalsearchresult<principal*>* groups = user->getauthorizationgroups();
i following exception:
message: object reference not set instance of object.
exception call stack:
@ system.directoryservices.accountmanagement.principal.checkdisposedordeleted() @ system.directoryservices.accountmanagement.userprincipal.getauthorizationgroupshelper() @ system.directoryservices.accountmanagement.userprincipal.getauthorizationgroups()
any idea why internal method fails? how can user deleted or disposed, or has happened?
Comments
Post a Comment