TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Swetha
NA
196
25.9k
"ExecuteQuery" with "0" args: "pageInfo.PageLayoutLisItem
Sep 6 2018 2:16 AM
I am getting exception while creating publishing page with pagelayout uisng powershell csom
Error:
Exception calling "ExecuteQuery" with "0" argument(s): "pageInformation.PageLayoutListItem"
No idea of what the error is.No error description. :-(
below is my code:
$siteUrl = $csvRow.SiteURL
$pageName= $csvRow.PageName
$pageLayoutName=$csvRow.PageLayout
$lists= $subsiteweb.Lists
$list=$lists.GetByTitle("Pages")
$query = New-Object Microsoft.SharePoint.Client.CamlQuery
$query.ViewXml = "<View Scope='RecursiveAll'><Query><Where><Contains><FieldRef Name='FileLeafRef' /><Value Type='Text'>"+$pageName+"</Value></Contains></Where></Query></View>"
$listItems = $list.GetItems($query)
$subsiteCtx.Load($listItems)
$subsiteCtx.ExecuteQuery()
if($listItems.Count -le 0)
{
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$ctx.Credentials = $credentials
$ctx.ExecuteQuery()
$pageLayoutList = $ctx.Web.Lists.GetByTitle("Master Page Gallery")
$pageLayoutQuery = New-Object Microsoft.SharePoint.Client.CamlQuery
$pageLayoutQuery.ViewXml = "<View><Query><Where><Eq><FieldRef Name='FileLeafRef'/><Value Type='Text'>"+$pageLayoutName+"</Value></Eq></Where></Query></View>"
$pageLayouts = $pageLayoutList.GetItems($pageLayoutQuery)
$ctx.Load($pageLayouts)
$ctx.ExecuteQuery()
$pageLayout = $pageLayouts[0]
#Get the publishing Web
$pubWeb = [Microsoft.SharePoint.Client.Publishing.PublishingWeb]::GetPublishingWeb($ctx, $ctx.Web)
$ctx.Load($pubWeb)
$pageInfo = New-Object Microsoft.SharePoint.Client.Publishing.PublishingPageInformation
$pageInfo.Name = $pageName
$pageInfo.PageLayoutListItem = $pageLayout
$page = $pubWeb.AddPublishingPage($pageInfo)
$ctx.Load($page)
$ctx.ExecuteQuery()
I tried finding out whether the $pageLayout object($pageLayout = $pageLayouts[0]) is empty and Yes it is empty ,but the exception I got is different.Can anyone explain what the error is and how should i resolve pls respond ASAP
Reply
Answers (
1
)
Sharepoint 2010 FBA Authentication
Feed service provider defined identifier is missing