[Fixed] Server relative urls must start with SPWeb.ServerRelativeUrl"in reading web part properties!

[Fixed] Server relative urls must start with SPWeb.ServerRelativeUrl”in reading web part properties!

No comments

 6,275 total views,  78 views today

Recently I was working on, to the get web part properties details from the SharePoint site page using the PowerShell CSOM, then I got this error “Exception calling “ExecuteQuery” with “0” argument(s): “Server relative URLs must start with SPWeb.ServerRelativeUrl” in reading web part properties!:“. In this, SharePoint troubleshooting I will share how to fix this error.

 

"Server relative urls must start with SPWeb.ServerRelativeUrl"in reading web part properties!:
“Server relative URLs must start with SPWeb.ServerRelativeUrl” in reading web part properties!:

How to fix the Exception calling “ExecuteQuery” with “0” argument(s): “Server relative URLs must start with SPWeb.ServerRelativeUrl” in reading web part properties!:?

[Fixed] Server relative urls must start with SPWeb.ServerRelativeUrl"in reading web part properties!
[Fixed] Server relative URLs must start with SPWeb.ServerRelativeUrl” in reading web part properties!
Solution:

The issue was in this line, the way I was passing the PageRelativeURL parameter.

$PageRelativeURL="/SitePages/TestWPPage.aspx"

#Parameters value
$siteURL="https://globalsharepoint2020.sharepoint.com/sites/CustomSearchRND"

$PageRelativeURL="/SitePages/TestWPPage.aspx"
$downloadLocation=$directoryPathForFileDownloadLocation;
$userName = "YourSPOUsername@tenant.domain.com"
$passWord = "YourSPOPassword"
#Parameters ends here.

#Calling the GetWebPartPropertyDetail function and passing the parameters.
GetWebPartPropertyDetails $siteURL $PageRelativeURL $userName $passWord

Change the $PageRelativeURL=”/SitePages/TestWPPage.aspx” to like below:

$PageRelativeURL="/sites/CustomSearchRND/SitePages/TestWPPage.aspx"

Note:

In the page relative URL, we need to pass the URL in the below format:

"/sites/yoursitename/SitePagesOrPages(library)/yourpage.aspx"

Summary:

Hence, in this troubleshooting, we have learned about how to fix the Exception calling “ExecuteQuery” with “0” argument(s): “Server relative URLs must start with SPWeb.ServerRelativeUrl” in reading web part properties!: error.

You may also like the following SharePoint PowerShell tutorials: