azure cognitive search using sharepoint subdirectory doesn't work

Megan Moore 1 Reputation point
2021-12-27T16:57:09.387+00:00

I have a Sharepoint datasource that I am trying to connect to azure cognitive search for a client. I am able to set up a datasource with the root of the Sharepoint directory with a url pattern https://[CLIENT].sharepoint.com/teams/[TEAM] however I need to set up sub-searches where I only search the files in a specific sub-directory within this Sharepoint. I continually get errors when I have tried to do this either by setting up a search with the url of the sub-directory (either the url in the browser or trying a file path format added to the url) as well as by changing the useQuery parameter and using a subdirectory URL for the includeLibrary variable).

Is this a potential permissions issue on the Sharepoint itself, or is there another way in which I can specify the sub-directories to make them searchable? I have gone through the documentation here: https://video2.skills-academy.com/en-us/azure/search/search-howto-index-sharepoint-online and it has not worked for me yet.

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
994 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Megan Moore 1 Reputation point
    2021-12-29T16:14:46.163+00:00

    Yep, the process seems to be:

    1. datasource with subdirectory path is created successfully (according to the request)
    2. When I go to create the indexer and run it, I go through the devicelogin process and succeed
    3. Then when I go to create the indexer I receive an error:
      Failed to update indexer "test-indexer", error: "Error with data source: SharePoint site 'https://[CLIENT].sharepoint.com/teams/[TEAM]/Shared%20Documents/General/azure_files/[SUBDIRECTORY]' not found. Please adjust your data source definition in order to proceed."
    0 comments No comments

  2. ajkuma 26,131 Reputation points Microsoft Employee
    2021-12-29T18:56:37.833+00:00

    Thanks for sharing additional details and the error.

    To better assist you on this:

    1. Could you please share time stamp (in UTC)? and || service and indexer with issue (I'll follow-up with you privately on this)
    2. Which is the exact configuration you have? Could you please provide the data source JSON configuration to check which query you are doing?
      If what you mean by sub-directory is a sub-site in the SharePoint, you should be using the includeLibrariesInSite with the keyword with the URI of the subsite-
      Index data from SharePoint Online (preview) - Azure Cognitive Search | Microsoft Learn

    includeLibrariesInSite : Index content from all libraries in defined site in the connection string. These are limited to subsites of your site.
    The query value for this keyword should be the URI of the site or subsite.

    3.Permissions can be provided through delegation or application. Which one are you using and what is the configuration you have added for AAD?

    Note: Please do not share any PII data on the public forum.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.