Hi,
I am unable to get the specific list/library contenttypes using csom powershell. List is getting fetched.
Getting error:"The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested."
Below is code I used to get content type collection:
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl) $Context.Credentials = $credentials $Context.ExecuteQuery()
$Web= $Context.Web $Context.Load($Web) $Context.ExecuteQuery() $listsColl=$Web.Lists $Context.Load($listsColl) $Context.ExecuteQuery() $contentTypeColl=$Context.Site.RootWeb.ContentTypes $Context.Load($contentTypeColl) $Context.ExecuteQuery() $CT=$contentTypeColl | where {$_.Id -eq "0x010100793AA7D56406304698C72BB5734F0C25"} $Context.Load($CT) $Context.ExecuteQuery() $list=$listsColl.GetByTitle("1_Uploaded Files") $Context.Load($list) $Context.ExecuteQuery() $listContentypes= $list.ContentTypes $Context.Load($listContentypes) $Context.ExecuteQuery()