
Announcements
My objective is simple here- I'm copying and renaming a file, and I need to see if a file with the same name already exists.
Search query
https://graph.microsoft.com/v1.0/sites/xxxxx/drive/root/search(q='KPR Monthly User Report 2021-11-26.xlsx')
This does indeed return the file I'm searching for. However, it's also returning another file that in no way is related.
{
"@odata.type": "#microsoft.graph.driveItem",
"createdDateTime": "2021-11-26T14:08:23Z",
"id": "01UCCLNHJ3ZLOBX7R5FNGI7NZGUR3",
"lastModifiedDateTime": "2021-11-26T14:09:20Z",
"name": "KPR Monthly User Report 2021-11-26.xlsx",
"webUrl": "https://xxx/_layouts/15/Doc.aspx?sourcedoc=%xxx%7D&file=KPR%20Monthly%20User%20Report%202021-11-26.xlsx&action=default&mobileredirect=true&DefaultItemOpen=1",
"size": 19808,
},
{
"@odata.type": "#microsoft.graph.driveItem",
"createdDateTime": "2021-04-26T16:01:05Z",
"id": "01UCCLNHJGKNOO22ATQJAIDUOF6UY",
"lastModifiedDateTime": "2021-04-26T16:01:13Z",
"name": "ITG Final Export 4-26-2021.zip",
"webUrl": "https://xxx/Shared%20Documents/Internal-Tech/ITGlue-Exports/ITG%20Final%20Export%204-26-2021.zip",
"size": 73450349,
}
The second file is a zip. Even if it were to search contents, there is no file in the archive close to the searched filename.
Any clue what's going on here? I can't seem to get any result by searching via other methods. I know there's other ways to handle a file conflict, but this has me confused and I'd just like to figure it out.
SCTdan,
This can be tough because the Graph is massive and spans virtually all of our products. What you're outlining here isn't really specific to Power Automate and there's nothing an end user can do to update the Graph.
I agree that it's unusual to see this ZIP file being returned but the query you're making is pulling it back for some reason and is likely to continue doing so. There is a refresh cadence with the Graph that might correct the association later but it's not something to count on.
You can test this out with our Graph Explorer:
https://developer.microsoft.com/en-us/graph/graph-explorer
You can work with the query string and validate how this behaves on the beta API, you might see different results.
The search action can handle OData parameters that may help refine this further:
https://docs.microsoft.com/en-us/graph/api/driveitem-search?view=graph-rest-1.0&tabs=http
We have a fairly active group devoted to the Graph that may be able to help, too:
https://techcommunity.microsoft.com/t5/microsoft-graph/bd-p/OfficeGraph
I hope this helps!
Patrick