Which code segment should you add at line 03?
You have a SharePoint site collection that contains 100 subsites.
You plan to create a Web Part. The Web Part will be deployed to each subsite.
You need to ensure that the Web Part retrieves all of the files in the root directory of the current subsite.
You write the following code segment. (Line numbers are included for reference only.)
01 SPSite site = SPContext.Current.Site;
02 SPWeb web = SPContext.Current.Web;
03
Which code segment should you add at line 03?
What should you do?
You create a Web Part that takes three values from three text boxes and creates a new SharePoint site when you click a button named CreateNewSite.
The Web Part contains the following code segment.
protected void CreateNewSite_Click(object sender, EventArgs e)
{
SPSite site = SPContext.Current.Site;
SPWeb web = site.AllWebs.Add(SiteNameTextBox.Text, SiteTitleTextBox.Text, SiteDescriptionTextBox.Text, 0, SPWebTemplate.WebTemplateSTS, false, false);
}
You test the Web Part and it works properly.
When another user attempts to use the Web Part to create a new site, he receives the following error message: “Error: Access Denied.”
You need to ensure that users can use the Web Part to create new sites.
What should you do?
Which code segment should you use?
You are creating a Web Part. The Web Part will be used in a SharePoint subsite that has the URL http://www.contoso.com/hr.
You need to ensure that the Web Part activates a Feature in the subsite without causing a memory leak.
Which code segment should you use?
What should you do?
You update a solution validator.
You need to ensure that all SharePoint solutions are validated the next time the solutions are executed.
What should you do?
Which class should the logging component inherit?
You are creating a Web Part that will be deployed as a sandboxed solution.
You need to ensure that the Web Part can write debugging information to the SharePoint trace logs.
Which class should the logging component inherit?
Which tool should you use?
You create a custom Web Part.
You need to verify whether the Web Part causes any memory leaks.
Which tool should you use?
Which class should you add to the project?
You create custom code to import content to SharePoint sites.
You create a custom site definition by using Microsoft Visual Studio 2010.
You need to ensure that when a new site that uses the site definition is created, the custom code executes after the site is created.
Which class should you add to the project?
Which property should you use?
You create a custom site definition named DCS.
You create a site provision handler for DCS.
DCS contains a file named DCSTemplate.xsd that stores configuration data. You need to read the content of DCSTemplate.xsd in the site provision handler.
Which property should you use?
What should you do?
You have a custom site definition.
You create a custom site Feature.
You need to ensure that the Feature is activated for all new sites that are created by using the custom site definition.
What should you do?
Which file should you modify?
You use a third-party site definition to create SharePoint sites.
You need to add a Web Part to the home page of the site definition.
Which file should you modify?