nerdexam
Microsoft

70-573 · Question #30

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.)…

The correct answer is D. Change lines 10 and 11 to use the eWeb variable. See the full explanation below for the reasoning.

Question

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.RunUithElevatedPrivileges (delegate() 02 { 03 SPSite currSite = SPConcext.Current.Site ; 04 SPUeb currUeb = SPContext.Current.Ueb ; 05 using (SPSite eSite = new SPSite ( currSite.ID ) ) 06 { 07 using (SPWeb eWeb = eSite.OpenUeb ( currUeb.ID ) ) 08 { 09 Web.AllowUnsafeUpdates = true; 10 currUeb.Description = "Test"; 11 currUeb.Update (); 12 eUeb.AllowUnsafeUpdates = false; 13 } 14 } 15 } 16 }; 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?

Options

  • ARemove lines 10 and 11.
  • BRemove lines 09 and 12.
  • CChange lines 09 and 12 to use the currWeb variable.
  • DChange lines 10 and 11 to use the eWeb variable.

How the community answered

(21 responses)
  • A
    14% (3)
  • B
    5% (1)
  • C
    10% (2)
  • D
    71% (15)

Community Discussion

No community discussion yet for this question.

Full 70-573 Practice