Accessing SPRole class returns an access denied exception
From: Martin Cabalzar (m.cabalzar_at_gmx.ch)
Date: 02/17/04
- Next message: Doncan311: "Another notice's source like msnbc?"
- Previous message: Steve Drake: "Sharepoint Searching other SOAP content source"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 17 Feb 2004 13:17:11 +0100
Hello
Does anybody know the reason, why accessing the SPUser.Roles method gives an
"access denied" exception, altough the current user is impersonated as
administrator? All other operations where you have to impersonate as
administrator works without problems, only the SPRoleCollection and SPRole
classes makes trouble.
This is the exception:
Microsoft.SharePoint.Library.SPRequestInternalClass.GetGroupsDataAsSafeArray
(String bstrUrl, UInt32 dwGroupsScope, Boolean fIsGlobal, String bstrValue,
UInt32& pdwColCount, UInt32& pdwRowCount, Object& pvarDataSet)
at Microsoft.SharePoint.Library.a.a(String A_0, UInt32 A_1, Boolean A_2,
String A_3, UInt32& A_4, UInt32& A_5, Object& A_6)
at Microsoft.SharePoint.SPGroupCollection.a(Boolean A_0, String[] A_1)
at Microsoft.SharePoint.SPGroupCollection.g()
at Microsoft.SharePoint.SPGroupCollection.Undirty()
at Microsoft.SharePoint.SPRoleCollection.Undirty()
at
Microsoft.SharePoint.SPBaseCollection.System.Collections.IEnumerable.GetEnum
erator()
at MyWebParts.MyDocuments.ListsForCurrentUser(SPBaseType listType)
I don't think the problem is the impersonation, because all other functions
works.
This is the basic code:
SPUser user = SPControl.GetContextWeb(Context).CurrentUser;
SPRoleCollection roleCollection = user.Roles;
foreach(SPRole role in roleCollection){
output.Write(role.Name);
}
Thank you for help!
Martin
- Next message: Doncan311: "Another notice's source like msnbc?"
- Previous message: Steve Drake: "Sharepoint Searching other SOAP content source"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|