What should you do?

You have a SharePoint site collection. The root Web of the site collection has the URL http://intranet.
You plan to create a user solution that will contain a Web Part. The Web Part will display the title of the root Web. You write the following code segment for the Web Part. (Line numbers are included for reference only.)

You add the Web Part to a page in the root Web and receive the following error message: "Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper’s Execute method in the partial trust app domain: An unexpected error has occurred."
You need to prevent the error from occurring.
What should you do?
A. Add the following line of code at line 02:
currentSite.OpenWeb();
B. Add the following line of code at line 02:
currentSite.OpenWeb("http://intranet");
C. Change line 01 to the following code segment:
SPSite currentSite = SPContext.Current.Site;
D. Change line 04 to the following code segment:
currentTitle.Text = currentSite.OpenWeb().Title;

microsoft-exams

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.