Re: How to debug access to sharepoint files?
@IntrepidIbex .
There could be multiple potential causes:
The files on SharePoint that are larger than 3MB may not be included in the search results because they exceed the size limit.
The files on SharePoint may not be in the supported formats: docx, doc, pptx, ppt, pdf.
Users may not have permission to access the files on SharePoint. Please check the Graph Explorer to see if the results show up there, as SharePoint uses Graph searches.
Here is the template for a call to the Graph search:
POST https://graph.microsoft.com/v1.0/search/query
{
"requests": [
{
"entityTypes": [
"driveItem",
"listItem"
],
"query": {
"queryString": "SEARCH TERMS filetype:docx OR filetype:aspx OR filetype:pptx OR filetype:pdf path:\"DOMAIN.sharepoint.com/sites/SITENAME"
},
"from": 0,
"size": 3,
"QueryAlterationOptions": {
"EnableModification": true,
"EnableSuggestion": true
}
}
]
}
For example, let’s assume that Generative Answers is configured to provide responses over the following SharePoint site: https://mydoman.sharepoint.com/sites/HR, and users are not getting responses when asking “How many leave days can I accumulate?”. A call to Graph API with the main keywords from the user query could reveal that no results are coming back:
{
"requests": [
{
"entityTypes": [
"driveItem",
"listItem"
],
"query": {
"queryString": "accumulate leave days filetype:docx OR filetype:aspx OR filetype:pptx OR filetype:pdf path:\"mydomain.sharepoint.com/sites/HR"
},
"from": 0,
"size": 3,
"QueryAlterationOptions": {
"EnableModification": true,
"EnableSuggestion": true
}
}
]
}
In this case, we can see that no results are being retrieved from Graph API:
{
"value": [
{
"searchTerms": [
"accumulate",
"leave",
"days"
],
"hitsContainers": [
{
"total": 0,
"moreResultsAvailable": false
}
]
}
],
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.searchResponse)"
}
If "No" result. Please refer to this doc: Search results missing in SharePoint Online - SharePoint | Microsoft Learn