Hi,
I see that there are docs for using GetFolderByServerRelativeUrl and GetFileByServerRelativeUrl methods in the SharePoint REST API, however, I couldn't find any docs on using GetFileByUrl method with SharePoint REST API.
Could that information be added please?
Thanks,
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
Actually, Official document didn't list the usage of GetFileByUrl.
This is the sample to use this method, actually it's using the absolute file url like this:
https://tenant.sharepoint.com/_api/web/GetFileByUrl(@url)?@url='https://tenant.sharepoint.com/Shared%20Documents/0%20(7).jpg'
This is the difference with GetFileByServerRelativeUrl
Thanks @Jerry0527
I've given it a shot and I'm getting either the FileNotFound or "fileURL" is missing error, I've tried different combinations.
What am I doing wrong here, here's my example:
https://contoso.sharepoint.com/_api/web/GetFileByUrl(@url)?@url='https://contoso.sharepoint.com/teams/TechTeam-Contoso-/Shared%20Documents/General/Email%20Messages/FW%20Phase%201%20Migration%20%20to%20affected%20users_123456.eml'
Also, the actual link that I get for the file is:
https://contoso.sharepoint.com/:u:/r/teams/TechTeam-contoso-/Shared%20Documents/General/Email%20Messages/FW%20Phase%201%20Migration%20%20to%20affected%20users_123456.eml?csf=1&web=1&e=abcDEf
Hi @haneef95,
It seems the file is located at the site url:
https://contoso.sharepoint.com/teams/TechTeam-Contoso-/
Then should like this:
https://contoso.sharepoint.com/teams/TechTeam-Contoso-/_api/web/GetFileByUrl(@url)?@url='https://contoso.sharepoint.com/teams/TechTeam-Contoso-/Shared%20Documents/General/Email%20Messages/FW%20Phase%201%20Migration%20%20to%20affected%20users_123456.eml'
Closing this issue as "answered". If you encounter a similar issue(s), please open up a new issue. See our wiki for more details: Issue-List: Our approach to closed issues