PrepAway - Latest Free Exam Questions & Answers

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?

PrepAway - Latest Free Exam Questions & Answers

A.
site.AllWebs[1].Files;

B.
Site.RootWeb.Lists[0].Items;

C.
web.Files;

D.
web.RootFolder.SubFolders[0].Files ;
web.Users.Add(currentUser.LoginName, currentUser.Email, currentUser.Name, “”);

Explanation:
MNEMONIC RULE: “current subsite = web = web.Files”

Gets the collection of all files in the root directory of the website.

SPWeb.Files Property
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.files.aspx


Leave a Reply