GetFolderByServerRelativeUrl Rest API return Server relative urls must start with SPWeb.ServerRelativeUrl

g h 716 Reputation points

I am trying to fetch all files from a folder in SharePoint. I am looking for all file stored under "Shared%20Ducuments" path:


Return this error:

<m:code>-2147024809, System.ArgumentException</m:code>
    <m:message xml:lang="en-US">Server relative urls must start with SPWeb.ServerRelativeUrl</m:message>

Can anyone help please ?

SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,573 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jerryzy 10,566 Reputation points

    Hi @g h ,

    Please modify the Rest EndPoint like below:


    The ServerRelativeUrl needs to prepend /sites/sitename.

    Best Regards

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    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.

    11 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful