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://learn.microsoft.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.
1,062 questions
{count} votes

3 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,636 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.


  3. Kiko de Ángel 0 Reputation points Microsoft Employee
    2024-11-04T15:03:40.63+00:00

    Hello!

    Adding on top of this messages.

    As the connector is in Public Preview, there're some limitations in the use and also in documentation :-(Megan, if your subdirectory has spaces in the URL, the model fails transforming it to readable URL. When it adds a %20 to the URL replacing the space in the URL, the index fails reading the info and add additional characters making it unreadeable.

    To solve this situation, you have to add a parameter different to the includeLibrariesInSite, you have to use includeFolder that is not documented but is the model use in the Graph to explore the folder content.

    0 comments No comments

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.