You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I successfully get site script from target website using Get-PnPSiteScriptFromWeb, and I want to get site script from the same website using C# but failed.
I look up the code in /src/Commands/SiteDesigns/GetSiteScriptFromWeb.cs , and found that pnp-powershell doing this by Tenant.GetSiteScriptFromSite(Url, tenantSiteScriptSerializationInfo);
When I try to write codes, I found that GetSiteScriptFromSite() is not a static method, maybe it's about the version of Microsoft.Online.SharePoint.TenantAdministration?
So I create a new object instance and write code like this:
Tenant tenant = new Tenant(ctx),;
var script = tenant.GetSiteScriptFromSite(Url, tenantSiteScriptSerializationInfo);
ctx.ExecuteQueryRetry();
and I receive error message "current site is not a tenant administration site" when executing ctx.ExecuteQueryRetry();
It looks like an error related to permissions, but I can use powershell to get the sitescript without problem.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I successfully get site script from target website using
Get-PnPSiteScriptFromWeb
, and I want to get site script from the same website using C# but failed.I look up the code in
/src/Commands/SiteDesigns/GetSiteScriptFromWeb.cs
, and found that pnp-powershell doing this byTenant.GetSiteScriptFromSite(Url, tenantSiteScriptSerializationInfo);
When I try to write codes, I found that GetSiteScriptFromSite() is not a static method, maybe it's about the version of Microsoft.Online.SharePoint.TenantAdministration?
So I create a new object instance and write code like this:
and I receive error message "current site is not a tenant administration site" when executing
ctx.ExecuteQueryRetry();
It looks like an error related to permissions, but I can use powershell to get the sitescript without problem.
Any advice would be appreciated.
environment: PnP.PowerShell 1.6.0
Beta Was this translation helpful? Give feedback.
All reactions