Using Sites.Selected search or query for a specific file name in a subfolder within a specific library.

DarylD 1 Reputation point
2021-09-24T20:33:07.843+00:00

I have tried a variety of http get requests. With sites.selected permissions on an Azure App I can drill to a specific file name to retrieve its url, but I can't use a wildcard to find it, unless I know the exact subfolder it is in.

Is there a way to use Microsoft Graph Sites.Selected permissions perform a search or query for a part of a file name inside a sharepoint site and within subfolders?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,383 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,802 questions
{count} votes

2 answers

Sort by: Most helpful
  1. MichaelHan-MSFT 18,021 Reputation points
    2021-09-28T09:23:44.177+00:00

    Hi @DarylD ,

    Per my test, when using Microsoft Graph Sites.Selected permissions search a file with the search api, we will get access dennied error.
    So Sites.Selected permission is not enough to seach a file. You need to grant at least Files.Read.All to searh a file in the site


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

  2. MichaelHan-MSFT 18,021 Reputation points
    2021-09-30T07:49:59.263+00:00

    Hi @DarylD ,

    According to the documentation: https://learn.microsoft.com/en-us/graph/api/resources/search-api-overview?view=graph-rest-1.0#scope-search-based-on-entity-types. You need to grant at least Files.Read.All permission on your app to search files.

    136632-image.png