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

sonal khatri 76 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.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,229 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,601 questions
{count} vote

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,451 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.