How to read a file content from Sharepoint using Sharepoint file URL

sonal khatri 81 Reputation points
2024-01-29T04:07:38.25+00:00

Hello,
I want to read the file content from SharePoint using the SharePoint file URL.

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
{count} vote

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2024-01-29T08:32:40.8333333+00:00

    Hi @sonal khatri, You can use the ServerRelativeUrl field of response to obtain file contents by calling following rest api

    GET http://mysite.sharepoint.com/<site_name>/_api/web/getfilebyserverrelativeurl('<url>)/$value?binaryStringResponseBody=true
    
    
    

    Here is the similar issue for reference https://sharepoint.stackexchange.com/questions/186348/how-to-point-to-get-the-file-contents-or-file-from-sharepoint-changes-api-call

    ---If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


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.