Share via

GetFileByServerRelativePath API wont honor Range Header, not able to receive range input stream

Vineeth Kumar 20 Reputation points
2026-02-09T07:54:02.1966667+00:00

I am using following api to get inputstream of a file in sharepoint. <MainURL>/GetFileByServerRelativePath(decodedUrl='PathtoFile/ORGANIZATION_202306101632.csv')/$value

I have tried passing a header Range with value bytes=0-100. Even after sending this, the inpurstream returned is complete file and not honoring the bytes that I requested for.

How should I make it work?

Microsoft 365 and Office | SharePoint | Development
0 comments No comments

1 answer

Sort by: Most helpful
  1. Jayden-P 23,075 Reputation points Microsoft External Staff Moderator
    2026-02-09T08:38:05.6366667+00:00

    Hi @Vineeth Kumar

    Thank you for reaching out to our Q&A forum.

    After doing some research, GetFileByServerRelativePath endpoint is designed to download the full content of the file which result in ignoring the range header.

    If the server ignores the header, it returns a 200 code and download the full content.

    User's image

    You can read here for more details: Range header - HTTP | MDN

    Note: This information is provided as a convenience to you. These sites are not controlled by Microsoft, and Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please ensure that you fully understand the risks before using any suggestions from the above link.

    I also found that Graph API does support downloading with range header. If possible, you can consider using this: Download driveItem content - Microsoft Graph v1.0 | Microsoft Learn

    User's image

    I hope this information helps.


    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.

    Was this answer helpful?

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.