Share via


WSS 2.0 : Explicit Impersonation cannot work with SPRoleCollection

The following code will fail if the user doesnot have Admin previlage

       SPRoleCollection RC =  CurrentWeb.CurrentUser.Roles;

The CurrentWeb.CurrentUser.Roles method requires Manage Site Groups permission and the impersonation does not work with SPRoleCollection

RESOLUTION:
-Write a custom sharepoint webservice and pass the administrator (networkcredentials) credentials to the webservice to retrieve the roles.