Skip to main content
How Search or get the documents in subfolders of Document library in SharePoint

Option 1 Using CAML Query
below CAML query used to filter

 
   
     
       Sites/SiteCollectionName/SubsiteName/DocumentLibraryName/Folder Name/SubFolderName/SubSubFolderName/SubSubSubFolderName
   
 


Source
https://sharepoint.stackexchange.com/questions/60495/caml-query-for-sub-folder-documents-javascript
https://sharepoint.stackexchange.com/questions/59216/get-all-files-from-sub-folder-of-a-certain-content-type
https://sharepoint.stackexchange.com/questions/215230/get-all-items-in-list-by-field-name-caml-query


Option 2 Create a View which can point to SubFolder by changing the filter for the view using SharePoint Designer



Source: https://www.tombenjamin.ca/blog/designer/view/using-caml-query-show-files-folder/

There is a thread on social.technet where someone asks how to “Create a webpart to show subfolder of existing document library.” I had posted a reply to that explaining how to modify a library view in SharePoint Designer to show files from just one folder. I can illustrate the process here with some screenshots so that it is easier to follow.
The first step is done using the browser. You need to create the view for your library so that it shows files inside the folders of your library. That option ignores the folders and shows all of the files, regardless of what folder they are in. When you create the view, select the columns you want to display, how you want them sorted and select the Folders option “show all items without folders”

Show all items without folders
Then in SharePoint Designer (SPD) open the site, on the left is the Navigation and Site Objects pane. Under Site Objects click on Lists and Libraries, select the library. The Views will be displayed on the right, click on the view you’ve created.

Views panel in SharePoint Designer
In the code view, scroll down until you see the XsltListViewWebPart (a library view is a page with one ListView web part). In the XML you’ll see a  tag inside the  tag. It will have an  tag (for sorting).

Query tag inside XSLTListViewWebpart
Add a  tag and then use either the  option, which would return you files from a folder and its sub-folders.

BeginsWith tag inside XSLTListViewWebpart
Or the  option, which will return files from just one single folder

Eq tag inside XSLTListViewWebpart
Remember to use closing tags as shown.
If you want to check the folder names before adding the  clause you can add the  to the  tag.

FieldRef tag inside XSLTListViewWebpart
Then save and preview your view – use it to get the correct value for the folder names.

FieldRef return path values

Comments

Popular posts from this blog

Printing Date Format in  Power Automate (Flows) I was trying to format print the date and found multiple ways to print Date perticularly Month for my requirements. please find various  Month Format  formatDateTime(triggerBody()?['Test_x0020_Date_x002F_Time'],'MM/dd/yyyy') Output 12 /11/2020  formatDateTime(triggerBody()?['Test_x0020_Date_x002F_Time'],'MMM/dd/yyyy')   Output  Dec /11/2020  formatDateTime(triggerBody()?['Test_x0020_Date_x002F_Time'],'MMM/dd/yyyy') Output    December /11/2020  Surce https://sharepains.com/2018/11/12/formatdatetime-flow-power-automate/     The formatting options for formatDateTime, that you can use here are listed in the following table. Any of the format specifiers can be used in any kind of combination. FORMAT SPECIFIER DESCRIPTION EXAMPLES “d” The day of the month, from 1 through 31. More information:  The “d” Custom Format Specifier . 2009-06-01T13:45:30 -> 1 2009-06-15T13:45:30 -> 15 “dd” The day o
Get Email User Name, email from SharePoint person field in list  you can get user name and email from person field is the group or person coloumn Create PersonGroupCol - person or group field If you are not going to use those email address values later (you don't need to save emails in column) and you just want to show the email in SharePoint list view then you can also achieve it using JSON column formatting. Create one single line of text column (Email, Name) Hide it from list forms (make it  Hidden  from content type settings). Then use below JSON code to format the column: { "$schema" : "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json" , "elmType" : "div" , "txtContent" : "[$ PersonGroupCol . email ]" } For User Name { "$schema" : "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json" , "elmType" : "div"

How to remove special characters from the SharePoint list column using calculated column - SharePoint online

Remove special characters  from the SharePoint list column using calculated column =REPLACE([FirstNameLastName],SEARCH(" & ",[FirstNameLastName]),0,"") or =IF(ISERR(SEARCH("&",Title,1)),Title,REPLACE(Title,SEARCH("&",Title,1),2,""))  Source https://social.technet.microsoft.com/Forums/sharepoint/en-US/42391d83-a6eb-480f-b84a-3d43ef4f5e40/calculated-column-to-remove-amp-and-space-quotamp-quot?forum=sharepointgeneralprevious https://social.technet.microsoft.com/Forums/office/en-US/74d8022b-03f4-4ccf-9bfc-a3075a2f9202/multiple-replace-on-calculated-column?forum=sharepointgeneralprevious