I've a document library and within this document libary I have sub-folders (no subfolders further).
There is 1 documentlibary called DocumentACC and this document libary contains Sub-folders as you see below. These subfolders contains FILES (Word, PPT, XLS etc.) no subfolders within this further.
So when I open the DocumentACC then the Folder it shows e.g. 15 files. now the idea is with my sandbox solution WEBpart which has only 1 button. The idea is when the user clicks on the button he should get all files names + location of that files....
!!!! But only files for that specific folder, where he is !!!!
So I looked and found the Folder is in the URL... But how can I get the files for that folder. So I think the URL with the querystring parameter "RootFolder" is fine, but how can I get the files.... I'm struggling and struggling, can someone bring me on right path... Below is the folder structure and the small code for webpart....
So HOw can I get all files from Folder ACC 2015-11-05??
DocumentACC
ACC 2015-12-14
ACC 2015-11-05
ACC 2015-10-15
libName = "DocumentsACC";
using (SPWeb web = SPContext.Current.Site.OpenWeb())
{
SPDocumentLibrary lstDocLib = (SPDocumentLibrary)web.Lists[libName];
Label3.Text = lstDocLib.RootFolder.Name;
foreach (SPListItem item in lstDocLib.Items)
{
//Label3.Text = item.Folder.Name;
if (item.FileSystemObjectType == SPFileSystemObjectType.Folder)
{
//item is a folder
Label1.Text = Label1.Text + "<BR />" + item.Name;
}
else if (item.FileSystemObjectType == SPFileSystemObjectType.File)
{
//item is afile
Label2.Text = Label1.Text + "<BR />" + item.Name;
//HERE I NEED TO GET THE FILE NAMES and LOCATION
}
}
}