57,044 total views, 1 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.

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!](https://global-sharepoint.com/wp-content/uploads/2020/06/Fixed-Server-relative-urls-must-start-with-SPWeb-ServerRelativeUrl-in-reading-web-part-properties.png)
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:
- [Verified] Get all webparts from pages in a site using PowerShell in SharePoint Online
- Get document library inventory report in SharePoint using PowerShell script
- How to start SharePoint list workflow using PowerShell
- How to hide quick launch menu in SharePoint online using PnP PowerShell
- Edit user Permission is greyed Out SharePoint Online
- Get workflow inventory from SharePoint online using PowerShell CSOM
- Create a modern team site using PnP PowerShell in SharePoint
- In 2 steps convert a classic SharePoint page to modern using PnP
- SharePoint Online: Delete All Files from document library for the given date – PowerShell CSOM
- Create SharePoint online list using PnP provisioning template
- SharePoint Automation: PowerShell script to get remote server information
- Office 365: Retrieve hub sites and associated sites using PnP Powershell
- SharePoint Online Automation – O365 – Upload files to document library using PowerShell CSOM
- SharePoint Online Automation – O365 – Create multiple items in a list using PowerShell CSOM
- SharePoint Online Automation – O365 – Update document library metadata using PowerShell CSOM
- [Solved] Fix the “The term ‘Get-SPWeb’ is not recognized as the name of a cmdlet, function” PowerShell error
1 comments on “[Fixed] Server relative urls must start with SPWeb.ServerRelativeUrl”in reading web part properties!”
You must log in to post a comment.