Jan 16 2023 07:54 AM - edited Jan 16 2023 08:01 AM
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 permissions?
Do I need other permissions in order to be able to do this task?
Thanks
Jan 16 2023 08:33 AM
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
Jan 16 2023 08:41 AM
Jan 16 2023 08:48 AM
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
Jan 16 2023 08:51 AM
Jan 16 2023 11:15 PM
Jan 17 2023 01:10 AM
Jan 17 2023 01:54 AM
Jan 17 2023 02:02 AM - edited Jan 17 2023 02:20 AM
@SvenSieverding
However, the theme is not appearing in SharePoint (it doesn't appear in change the look)
Jan 17 2023 02:42 AM
Jan 17 2023 03:45 AM
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
Jan 17 2023 03:54 AM
Jan 17 2023 09:29 AM