Retrieve files from _layouts folder in SharePoint

I am currently working on a project in which I add docx files to the Layout folder in Visual Studio and then use these ducment files to create content types.

The problem is that I cannot get the document files programmatically. Using a web browser, I can get the files, but not using web.GetFolder () ;. The code runs in the function receiver when the function is activated.

SPSite site = properties.Feature.Parent as SPSite;
SPWeb web = site.RootWeb;

SPFolder docTempFolder = web.GetFolder("_LAYOUTS/Projekt/DocumentTemplates");

This code gives me a collection with null files.

What am I doing wrong?

Thanks for the help.

+5
source share
1 answer

SPFolder / SharePoint. (14 ), SPFolder. SPWeb.GetFolder, . .

14 , GetGenericSetupPath, - :

var path = SPUtility.GetGenericSetupPath(@"TEMPLATE\LAYOUTS\Projekt\DocumentTemplates");

, System.IO.File ..


: SharePoint 2013 , SharePoint. _layouts SharePoint (, /_layouts/15 SharePoint 2013 /_layouts/14 SharePoint 2010.

SPUtility.GetVersionedGenericSetupPath. SharePoint 2010.

+7

All Articles