nerdexam
Microsoft

70-573 · Question #260

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 correct answer is C. web.Files. MNEMONIC RULE: "current subsite = web = web.Files" Gets the collection of all files in the root directory of the website. SPWeb.Files Property

Developing for Data Access

Question

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?

Options

  • Asite.AllWebs[1].Files;
  • BSite.RootWeb.Lists[0].Items;
  • Cweb.Files;
  • Dweb.RootFolder.SubFolders[0].Files ;

How the community answered

(59 responses)
  • A
    14% (8)
  • B
    5% (3)
  • C
    78% (46)
  • D
    3% (2)

Explanation

MNEMONIC RULE: "current subsite = web = web.Files" Gets the collection of all files in the root directory of the website. SPWeb.Files Property

Topics

#SPWeb.Files#file retrieval#SharePoint object model#subsite

Community Discussion

No community discussion yet for this question.

Full 70-573 Practice