PrepAway - Latest Free Exam Questions & Answers

You need to ensure that all users can use the Web Part to update the description of the current site

You create a Web Part that programmatically updates the description of the current SharePoint
site. The Web Part contains the following code segment. (Line numbers are included for reference
only.) 01 SPSecurity.RunWithElevatedPrivileges(delegate() 02 { 03 SPSite currSite =
SPContext.Current.Site; 04 SPWeb currWeb = SPContext.Current.Web; 05 using (SPSite eSite =
new SPSite(currSite.ID)) 06 { 07 using (SPWeb eWeb = eSite.OpenWeb(currWeb.ID)) 08 { 09

eWeb.AllowUnsafeUpdates = true; 10 currWeb.Description = “Test”; 11 currWeb.Update(); 12
eWeb.AllowUnsafeUpdates = false; 13 } 14 } 15 }); Users report that they receive an Access
Denied error message when they use the Web Part. You need to ensure that all users can use the
Web Part to update the description of the current site. What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Change lines 10 and 11 to use the eWeb variable.

B.
Change lines 09 and 12 to use the currWeb variable.

C.
Remove lines 10 and 11.

D.
Remove lines 09 and 12.


Leave a Reply