SPO CSOM method GetCustomListTemplates() throwing Internal Error #3699
Unanswered
HomerGreat
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Devs,
trying to get saved/uplaoded .stp template by CSOM method https://learn.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.client.site.getcustomlisttemplates?view=sharepoint-csom
** I have imported Pnp module and SharePoint client SDK.
** Specifically as below(site/web var, connection context and Site Context can see, but the template object throwing error)
$Ctx = Get-PnPContext
$Web = Get-PnPWeb
$RootWeb = $Ctx.Site.RootWeb
$ListTemplates = $Ctx.Site.GetCustomListTemplates($RootWeb)
** So the variable/object isn't loaded, looks like empty and can't continue with second creation part.
ERROR
Internal Error - Microsoft.SharePoint.Client.CollectionNotInitializedException: 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.
at Microsoft.SharePoint.Client.ClientObjectCollection.ThrowIfCollectionNotInited()
at Microsoft.SharePoint.Client.ClientObjectCollection.System.Collections.IEnumerable.GetEnumerator() ...
When I try to hover the $ListTemplates in debugger, it looks like loading for 0.5sec but then crashes and throwing that error.
Am I missing anything? Has been anything deprecated? Any suggestion? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions