web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Searching for file via...
Power Automate
Unanswered

Searching for file via graph API

(0) ShareShare
ReportReport
Posted on by 604

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.

Categories:
I have the same question (0)
  • Patrick Hess Profile Picture
    on at

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard