In this SharePoint PnP tutorial, We will discuss the solution to an error as “SharePoint Server relative urls must start with SPWeb.ServerRelativeUrl“.
I recently worked with PnP SharePoint ASP.NET Web Application in Visual Studio 2017. 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“. You can see the error message in the below screenshot.
SharePoint Server relative
urls must start with SPWeb.ServerRelativeUrl
The Solution of this above error is: You should pass the Server Relative URL as “/sites/SiteName/Pages/WebPartPageName.aspx “. Once you will pass this type of Server relative URL Path and again run the code, then it will execute and give the appropriate result.
Here in this SharePoint PnP tutorial, We discussed the solution of an error as “SharePoint Server relative
You may also like the following tutorials:
- Column does not exist. it may have been deleted by another user error in SharePoint Online
- After nine attempts there was a problem downloading the following file which is required to continue visual studio
- The remote server returned an error (401) Unauthorized in SharePoint
Hello Everyone!! I am Bhawana a SharePoint MVP and having about 10+ years of SharePoint experience as well as in .Net technologies. I have worked in all the versions of SharePoint from wss to Office 365. I have good exposure in Customization and Migration using Nintex, Metalogix tools. Now exploring more in SharePoint 2016 🙂 Hope here I can contribute and share my knowledge to the fullest. As I believe “There is no wealth like knowledge and no poverty like ignorance”