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
Jan 17, 2023Bronze Contributor
Hello Lee-Martin ,
if you apply the theme via the "Invoke-PnPSiteTemplate" command, it is applied immediately as the current selection below site theme for the current site and does not show up below the "Sharepoint Theme themes". But you don't need to be a SharePoint Admin to do so.
If you want your theme to be displayed below "SharePoint themes", you need to connect to your SharePoint admin site ("https://<tenant>-admin.sharepoint.com") as a SharePoint administrator and invoke the Add-PnPTenantTheme command. But you need to be a SharePoint admin for that and that theme will be available on all sites.
$themepalette = @{
"themePrimary" = "#00ffff";
"themeLighterAlt" = "#f3fcfc";
"themeLighter" = "#daffff";
"themeLight" = "#affefe";
"themeTertiary" = "#76ffff";
"themeSecondary" = "#39ffff";
"themeDarkAlt" = "#00c4c4";
"themeDark" = "#009090";
"themeDarker" = "#005252";
"neutralLighterAlt" = "#f8f8f8";
"neutralLighter" = "#f4f4f4";
"neutralLight" = "#eaeaea";
"neutralQuaternaryAlt" = "#dadada";
"neutralQuaternary" = "#d0d0d0";
"neutralTertiaryAlt" = "#c8c8c8";
"neutralTertiary" = "#a6a6a6";
"neutralSecondaryAlt" = "#767676";
"neutralSecondary" = "#666666";
"neutralPrimary" = "#333";
"neutralPrimaryAlt" = "#3c3c3c";
"neutralDark" = "#212121";
"black" = "#000000";
"white" = "#fff";
"primaryBackground" = "#fff";
"primaryText" = "#333"
}
Add-PnPTenantTheme -Identity "MyCompanyTheme" -Palette $themepalette -IsInverted $false
Best Regards,
Sven
Lee-Martin
Jan 17, 2023Brass Contributor
So there is no way to just do it for just one site? My client doesn't want me to have admin access across the whole Site collection
- SvenSieverdingJan 17, 2023Bronze ContributorWell... you can directly set the theme colors on one site using the "Invoke-SiteTemplate" approach, but it seems like you can not add new themes to the gallery just for the one site.
Otherwise..... You could ask your client to execute that Add-PnPTenantTheme command.... But remember; Then the Theme will be available on every site in the tenant.
Best Regards,
Sven