Microsoft
70-573 · Question #44
You need to create a Web Part that verifies whether a user who accesses the Web Part page is a member of a group named Group1. Which code condition should you use?
The correct answer is A. SPContext.Current.Web.Groups("Group1").ContainsCurrentUser. MNEMONIC RULE: ContainsCurrentUser Gets a Boolean value that indicates whether the group contains the current user, included either through director indirect membership. SPGroup.ContainsCurrentUser Property
Developing SharePoint Solutions
Question
You need to create a Web Part that verifies whether a user who accesses the Web Part page is a member of a group named Group1. Which code condition should you use?
Options
- ASPContext.Current.Web.Groups("Group1").ContainsCurrentUser
- BSPContext.Current.Web.SiteUsers
- CSPContext.Current.Web.SiteUsers
- DSPContext.Current.Web.Users("Group1").IsDomainGroup
How the community answered
(27 responses)- A74% (20)
- B4% (1)
- C15% (4)
- D7% (2)
Explanation
MNEMONIC RULE: ContainsCurrentUser Gets a Boolean value that indicates whether the group contains the current user, included either through director indirect membership. SPGroup.ContainsCurrentUser Property
Topics
#group membership#ContainsCurrentUser#SPGroup#security check
Community Discussion
No community discussion yet for this question.