.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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -