Skip to main content

Trying to query for a specific document in a document library in SharePoint Online.

 

My first thought was to use the Query a list action and set a url / path condition, but can't seem to find this as a condition.

 

The only way I've found to get a specific item is by ID, but in this case I don't have the item ID yet. That's what I'm trying to retrieve.

 

Any advice?

Hi Andre,



 



If you know the absolute path for the document, I am assuming yo know the file name. You can retrieve the list on query list action from using site URL and then use condition to retrieve item e.g the below query is getting all documents with "2020" in file name





You can query on any metadata field that is known



Regards,
Ashish



 


Hi @ghaiashish.



 



Yes, I know the file name. However, the file name is not necessarily unique within the document library and might give more than one result using the name-condition.

Lets say the condition gives multiple results, I can't seem figure out which document I'm actually looking for by looking at the response. For instance which folder the document is located in.



I've found this in the response, but it doesn't help me identify the correct document.





Hi,



 



If you need to query a unique file, you will need to know unique parameters. It could be one or combination of multiple parameters. e.g if you have two files with same name but different authors. You can use condition "Name = Document1.docx" and "CreatedBy=Andre Andersen" etc,





If you wish to isolate items from a collection of items that is a result of query list. you can use variables from object created as a result of query list.



I will need more information on what you are trying to achieve to advise if there is a possible solution or we have actually hit a limitation.



Kind Regards,



Ashish



 


Hi @ghaiashish.

That's why I was hoping to query for a path, because it's unique.

So the case is this:



Within a document library there are several folders, each representing a department. Each department has it's own running workflow. During the workflow it's waiting for two specific documents before continuing the workflow. The workflow is supposed to retrieve these documents and continue the workflow for approval. The document name is not unique within the library. And a combination of name and author might not be unique.



 



With the current conditions available, I'm unable to query for a document in a folder for example. At least what I have found. Even when exploring the result of a query with multiple results.



 



Appreciate any help


Reply