pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
988 stars 663 forks source link

Unable to update site logo for SharePoint Online Modern Team site #2646

Open vbhanage opened 4 years ago

vbhanage commented 4 years ago

Unable to update site logo for SharePoint Online Modern Team site.

SharePointPnPPowerShellOnline version is 3.20.2004.0 Command : Set-PnPSite -LogoFilePath C:\Project\Images\SiteLogo.png Does not give any error but doesn't update the logo either

ghost commented 4 years ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

jackpoz commented 4 years ago

Hi @vbhanage , if the Modern Team Site is an Office 365 Group site , try using https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/set-pnpunifiedgroup?view=sharepoint-ps with -GroupLogoPath parameter.

vbhanage commented 4 years ago

Hi jackpoz, I tried the command but received an error as below. Seems like some enhanced permission required? Please let me know...

Set-PnPUnifiedGroup -Identity 'Real Utilities Dev' -GroupLogoPath "C:\Project\Images\SiteLogo.png"

Set-PnPUnifiedGroup : Exception while invoking endpoint https://login.microsoftonline.com/01ca7c05-7080-4768-bfe7-d1e3cff7b99c/oauth2/token. At line:1 char:1

Thanks you.

jackpoz commented 4 years ago

The group logo is set using MS Graph, in particular https://docs.microsoft.com/en-us/graph/api/profilephoto-update?view=graph-rest-1.0&tabs=http endpoint, which has a known issue where Application Permissions are not supported so maybe that's why you received that error.

Try using powershell credentials instead of ClientId and make sure the account is Owner of the Group (maybe member too ?) and call Set-PnPUnifiedGroup again. Let some minutes pass from when you add the account as Owner to the group and when you run the powershell scripts just in case.

PedroMordeP commented 4 years ago

I'm getting issues also setting the logo using a template into a site that is GROUP#0 with Teams using the latest version 3.20.2004.0

Not sure if I open as a new issue or is related to this one.

The error message:

System.NullReferenceException: Object reference not set to an instance of an object. at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation provisioningInfo, Boolean calledFromHierarchy, TokenParser tokenParser) at Microsoft.SharePoint.Client.WebExtensions.ApplyProvisioningTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation applyingInformation) at SharePointPnP.PowerShell.Commands.Provisioning.Site.ApplyProvisioningTemplate.ExecuteCmdlet() at SharePointPnP.PowerShell.Commands.PnPCmdlet.ProcessRecord()

The Template example: Already tested with

<?xml version="1.0"?>
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2019/09/ProvisioningSchema">
  <pnp:Preferences Generator="OfficeDevPnP.Core, Version=3.16.1912.0, Culture=neutral, PublicKeyToken=5e633289e95c321a" />
  <pnp:Templates ID="CONTAINER-TEMPLATE-3DA864EF71634FDE9D0097EC98F1FA9A">
    <pnp:ProvisioningTemplate ID="TEMPLATE-3DA864EF71634FDE9D0097EC98F1FA9A" Version="1" BaseSiteTemplate="GROUP#0">
      <pnp:WebSettings RequestAccessEmail="" NoCrawl="false" WelcomePage="SitePages/Home.aspx" SiteLogo="{sitecollection}/logos/mylogo.jpg" AlternateCSS="" CommentsOnSitePagesDisabled="false" QuickLaunchEnabled="false" MembersCanShare="true" SearchScope="DefaultScope" />
      <pnp:SiteSettings AllowDesigner="true" AllowCreateDeclarativeWorkflow="true" AllowSaveDeclarativeWorkflowAsTemplate="true" AllowSavePublishDeclarativeWorkflow="true" />
      <pnp:Files>
        <pnp:File Src="SiteAssets/mylogo.jpg" Folder="{site}/logos" Overwrite="true" Level="Published" />
      </pnp:Files>
    </pnp:ProvisioningTemplate>
  </pnp:Templates>
</pnp:Provisioning>
robertcaretta commented 4 years ago

We are using a global tenant admin account with unrestricted permissions and also having this issue. You shouldn't need to be a owner of the group with these permissions. EX:

Set-PnPUnifiedGroup -Identity $group -GroupLogoPath ".\MyLogo.png"