Forum Discussion
Lee-Martin
Jan 16, 2023Brass Contributor
Add-PnPTenantTheme - Attempted to perform an unauthorized operation.
I've tried to upload a theme, but I'm geting an Attempted to perform an unauthorized operation I'm an admin on the particular site I'm trying to upload to, so I assumed this would be enough permi...
SvenSieverding
Bronze Contributor
Hi Lee-Martin ,
Add-PnPTenantTheme tries to create a new theme that you can use tenant-wide in all site collections. You need SharePoint Admin permissions and you have to be connected to the admin site to use that command.
I use a PnP site template to invoke a custom theme on a single site collection:
<?xml version="1.0"?>
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2022/09/ProvisioningSchema">
<pnp:Templates ID="ThemeTemplate">
<pnp:ProvisioningTemplate ID="ThemeProvisioningTemplate" >
<pnp:Theme Name="MyColorTheme" IsInverted="false">
{
"themePrimary": "#aaaaaa",
"themeLighterAlt": "#fefcf6",
"themeLighter": "#fcf3dd",
"themeLight": "#fae8bf",
"themeTertiary": "#f4d282",
"themeSecondary": "#efbe4b",
"themeDarkAlt": "#d5a32f",
"themeDark": "#b48a28",
"themeDarker": "#85661d",
"neutralLighterAlt": "#f8f8f8",
"neutralLighter": "#f4f4f4",
"neutralLight": "#eaeaea",
"neutralQuaternaryAlt": "#dadada",
"neutralQuaternary": "#d0d0d0",
"neutralTertiaryAlt": "#c8c8c8",
"neutralTertiary": "#a9a9a9",
"neutralSecondary": "#8d8d8d",
"neutralPrimaryAlt": "#727272",
"neutralPrimary": "#020202",
"neutralDark": "#3a3a3a",
"black": "#1e1e1e",
"white": "#ffffff",
"bodyBackground": "#ffffff",
"bodyText": "#020202"
}
</pnp:Theme>
</pnp:ProvisioningTemplate>
</pnp:Templates>
</pnp:Provisioning>
Invoke-PnPSiteTemplate .\theme.xml
But there might be better ways to do so.
Best Regards,
Sven
Lee-Martin
Jan 16, 2023Brass Contributor
Thanks, I've tried that an am getting the error
Invoke-PnPSiteTemplate : Cannot contact site at the specified URL https://<myhomesite>.sharepoint.com/<mysite>. There is
no Web named "/<mysite>/_vti_bin/sites.asmx".
Invoke-PnPSiteTemplate : Cannot contact site at the specified URL https://<myhomesite>.sharepoint.com/<mysite>. There is
no Web named "/<mysite>/_vti_bin/sites.asmx".
- SvenSieverdingJan 16, 2023Bronze Contributor
Hello Lee-Martin,
Are you connected to the correct url? Like
https://<myhomesite>.sharepoint.com/sites/<mysite>?
What happens, if you execute the command "Get-PnPWeb"?
Do you get the same error?
Best Regards,
Sven- Lee-MartinJan 16, 2023Brass ContributorI am connected, and I get a similar error when I run that command
- SvenSieverdingJan 17, 2023Bronze ContributorMhm.... thats wierd..
Get-PNPWeb should give you the name of the site you are connected to, even if you just have "read" permissions.
How did you connect to the site? What was the output of "Connect-PnPOnline"?
Best Regards,
Sven