Microsoft
70-573 · Question #268
You need to programmatically add a user named User1 to a group named Group1. You write the following code segment. (Line numbers are included for reference only.) 01 string login = "User1"; 02…
The correct answer is A. group.AddUser(user). MNEMONIC RULE: "add a user = AddUser()" SPGroup.AddUser Method
Developing SharePoint Solutions
Question
You need to programmatically add a user named User1 to a group named Group1. You write the following code segment. (Line numbers are included for reference only.) 01 string login = "User1"; 02 string grpName = "Group1"; 03 SPUser user = SPContext.Current.Web.EnsureUser(login); 04 SPGroup group = SPContext.Current.Web.Groups[grpName]; 05 06 group.Update(); Which code segment should you add at line 05?
Options
- Agroup.AddUser(user);
- Bgroup.Owner = user;
- Cuser.AllowBrowseUserInfo = true;
- Duser.Update();
How the community answered
(26 responses)- A85% (22)
- B4% (1)
- C4% (1)
- D8% (2)
Explanation
MNEMONIC RULE: "add a user = AddUser()" SPGroup.AddUser Method
Topics
#SPGroup#AddUser#user management#SharePoint security
Community Discussion
No community discussion yet for this question.