In this SharePoint tutorial, I will explain how to fix the error “server relative urls must start with spweb.serverrelativeurl” that comes while working with CSOM SharePoint.
server relative urls must start with spweb.serverrelativeurl
Recently, I was working with an ASP.net web application using Visual Studio. There, I have added a Content Search Web Part using CSOM. To add this web part, You have to retrieve the Page URL. I was adding this page URL as [“/Pages/WebPartPageName.aspx”].
While running this CSOM code, an error occurred: “SharePoint Server relative URLs must start with SPWeb.ServerRelativeUrl.” The error message is shown in the screenshot below.
The Solution to this above error is: You should pass the Server Relative URL as “/sites/SiteName/Pages/WebPartPageName.aspx.” Once you pass this type of Server relative URL Path and again run the code, it will execute and give the appropriate result.
This is how to fix the error, server relative urls must start with spweb.serverrelativeurl that comes while working with CSOM SharePoint.
You may also like:
- SharePoint Rest API
- Error=Value=QuotaExceeded in SharePoint
- http error 400. the size of the request headers is too long
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com