Which code segment should you add at line 05?

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?

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?

A.
user.Update();

B.
user.AllowBrowseUserInfo = true;

C.
group.Owner = user;

D.
group.AddUser(user);



Leave a Reply 0

Your email address will not be published. Required fields are marked *