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 RunWithElevatedPrivileges(EvelateSub) 02 Private Sub ElevatedSub() 03 Dim currSite
As SPSite = SPContext.Current.Site 04 Dim currWeb As SPWeb = SPContext.Current.Web 05
Using eSite As New SPSite(currSite.ID) 06 Using eWeb As SPWeb =
eSite.OpenWeb(currWeb.ID) 07 eWeb.AllowUnsafeUpdates = True 08 currWeb.Description =
“Test” 09 currWeb.Update() 10 eWeb.AllowUnsafeUpdates = False 11 End Using 12 End Using
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?

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 RunWithElevatedPrivileges(EvelateSub) 02 Private Sub ElevatedSub() 03 Dim currSite
As SPSite = SPContext.Current.Site 04 Dim currWeb As SPWeb = SPContext.Current.Web 05
Using eSite As New SPSite(currSite.ID) 06 Using eWeb As SPWeb =
eSite.OpenWeb(currWeb.ID) 07 eWeb.AllowUnsafeUpdates = True 08 currWeb.Description =
“Test” 09 currWeb.Update() 10 eWeb.AllowUnsafeUpdates = False 11 End Using 12 End Using
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?

A.
Change lines 07 and 10 to use the currWeb variable.

B.
Change lines 08 and 09 to use the eWeb variable.

C.
Remove lines 08 and 09.

D.
Remove lines 07 and 10.



Leave a Reply 0

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