Get List of Items Located in a Document Library Folder

  • 13 March 2018
  • 5 replies
  • 19 views

Badge +2

The problem I am trying to solve is to determine if there is a specific word document in a specific folder located in the "Project Documents" library of a SharePoint 2016 site.  My site structure would be something like this: //server/sitename/project documents/folderA/.  Within the folderA, I need to know if there is a document called "status report."  These would all be on Alternate Sites than from where the workflow runs.

Using a "Call Web Service" "sitedata.asmx" method, I am able to see the content on the site "//server/sitename/".  The content is stored in a collection variable which I then loop through (for each) to see if there is an item called "Project Documents" and I find one.  Then I use a Query List (CAML editor) to retrieve the contents of the Project Documents library.  I am able to find the Status Report folder within the Project Documents library, but I am not able to figure out how to get the contents of that specific "Status Report" folder.  I have tried a few different Query List options.  I am clueless when it comes to Soap, Web Service Calls, etc.  I used the documentation (found here) created by as a "template."

Any help would be greatly appreciated as I have been working on this for a couple of days.


5 replies

Userlevel 5
Badge +14

I think you do not need to bother with any web services.

simply let the query list action search for your specific document name. unfortunately it doesn't support to search within a specific folder, however it returns all the documents with a given name within library regardless of their location.

if you let it return one of URLs field you can then examine the path whether the document is placed in your specific folder.

213979_pastedImage_2.png

Badge +2

Thanks for the reply.  I am able to get your suggestion to work; however, as stated in my initial question, I need to get the information from an alternative site.  When I enter the alternative site (http://server/sites/alternativesite) the Query List command gives the following error. "The execution returned an unexpected error.
The Web application at http://server/sites/alternatesite could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application".  I can change the "alternative site" field to be the current site where the workflow is running and the command works correctly.  Thoughts?

Userlevel 5
Badge +14

it should work as far as alternative site runs within the same farm.

is your alternative site from different farm?

Badge +2

I wasn't on the same farm.  I was doing this in our TEST environment.  For grins and giggles I thought I would give it a try in our PROD environment and it started working.  Your solution was spot on!  Thanks for your help.

Userlevel 5
Badge +14

great!

please mark the question answered.

Reply