nerdexam
Microsoft

70-573 · Question #83

You are creating a Web Part for SharePoint Server 2010. The Web Part contains the following code segment. (Line numbers are included for reference only.) 01 protected override void…

The correct answer is A. 04. MNEMONIC RULE: "No RunWithElevatedPrivileges for sandboxed solutions" Methods in a sandboxed solution cannot be configured to run with the elevated privileges of the user identity inwhich the application pool runs. Restrictions on Sandboxed Solutions in SharePoint 2010

Developing SharePoint Solutions

Question

You are creating a Web Part for SharePoint Server 2010. The Web Part contains the following code segment. (Line numbers are included for reference only.) 01 protected override void CreateChildControls () 02 { 03 base.CreateChildControls (); 04 SPSecurity.FunWithElevatedPrivileges ( 05 delegate 06 { 07 Label ListCount = new Label (); 08 ListCount.Text = String.Format ("There are {0> Lists", SPContext.Current.Heb.Lists.Count ); 09 Controls.Add ( ListCount ) ; 10 }} 11 } You need to identify which line of code prevents the Web Part from being deployed as a sandboxed solution. Which line of code should you identify?

Options

  • A04
  • B09
  • C08
  • D03

How the community answered

(40 responses)
  • A
    80% (32)
  • B
    5% (2)
  • C
    3% (1)
  • D
    13% (5)

Explanation

MNEMONIC RULE: "No RunWithElevatedPrivileges for sandboxed solutions" Methods in a sandboxed solution cannot be configured to run with the elevated privileges of the user identity inwhich the application pool runs. Restrictions on Sandboxed Solutions in SharePoint 2010

Topics

#sandboxed solutions#RunWithElevatedPrivileges#SPSecurity#trust level restriction

Community Discussion

No community discussion yet for this question.

Full 70-573 Practice