I wan to change the page name with Power shell script. When I had run the script I was given an spexception error:
Exception calling "CheckOut" with "0" argument(s): "The URL 'en/articles/kbarticles/Pages/R2-1_articles_Testing.aspx' is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web." At line:1 char:1 + $spFile.CheckOut() + ~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : SPException
The below script was used for update the name of the page:
$spWeb = Get-SPWeb("here i am given the web url")
$spFile = $spWeb.GetFile("full url with page name")
$spFile.CheckOut("Online",$null) ////here i am getting the error(spexception)
$spFile.Properties["Name"] = "Pages/R2-1_articles_Testing_New"
$spFile.Update()
$spFile.CheckIn("Update page layout via PowerShell",[Microsoft.SharePoint.SPCheckinType]::MajorCheckIn)
$spWeb.Dispose()