pnpframework icon indicating copy to clipboard operation
pnpframework copied to clipboard

Get-PnPTenantTemplate fails with a Graph call for Teams

Open sympmarc opened this issue 3 years ago • 2 comments

I'm trying to get a template with Get-PnPTenantTemplate. The site is pretty straightforward, with nothing overly fancy. (Demo for the M365 Conference.)

The cmdlet fails with a call to: https://graph.microsoft.com/v1.0/teams/5f2fcc32-51ea-45b9-946c-641861a7b322/photo In the Graph Explorer, that call throws a 404 with v1.0 but works with beta. It feels like a bug.

The error message and configuration JSON are below.


Get-PnPException

Message          : Exception while invoking endpoint https://graph.microsoft.com/v1.0/teams/5f2fcc32-51ea-45b9-946c-641861a7b322/photo.
Stacktrace       :    at PnP.Framework.Provisioning.ObjectHandlers.ObjectTeams.ParseTeamJson(ExtractConfiguration configuration, String accessToken, String groupId,       
                   PnPMonitoredScope scope)
                      at PnP.Framework.Provisioning.ObjectHandlers.ObjectTeams.ExtractObjects(Tenant tenant, ProvisioningHierarchy hierarchy, ExtractConfiguration
                   configuration)
                      at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.GetTenantTemplate(Tenant tenant, ExtractConfiguration configuration)
                      at Microsoft.SharePoint.Client.TenantExtensions.GetTenantTemplate(Tenant tenant, ExtractConfiguration configuration)
                      at PnP.PowerShell.Commands.Provisioning.Site.GetTenantTemplate.ExtractTemplate(ExtractConfiguration configuration) in
                   c:\build\src\Commands\Provisioning\Tenant\GetTenantTemplate.cs:line 176
                      at PnP.PowerShell.Commands.Provisioning.Site.GetTenantTemplate.ExecuteCmdlet() in
                   c:\build\src\Commands\Provisioning\Tenant\GetTenantTemplate.cs:line 99
                      at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() in c:\build\src\Commands\Base\PnPSharePointCmdlet.cs:line 60
ScriptLineNumber : 1

{
    "$schema": "https://aka.ms/sppnp-extract-configuration-schema",
    "persistAssetFiles": true,
    "handlers": [
        "WebSettings",
        "Navigation",
        "Fields",
        "ContentTypes",
        "Lists",
        "Files",
        "Pages",
        "Tenant"
    ],
    "tenant": {
        "teams": {
            "teamSiteUrls": ["https://northpoleindustries.sharepoint.com/sites/WorkshopTemplate"],
            "includeGroupId": false,
            "includeMessages": false
        }
    },
    "navigation": {
        "removeExistingNodes": true
    },
    "contentTypes": {
        "groups": [
            "_Workshop"
        ]
    },
    "lists": {
        "lists": [
            {
                "title": "Site Pages"
            },
            {
                "title": "Site Assets"
            },
            {
                "title": "Policies"
            },
            {
                "title": "Elves"
            },
            {
                "title": "Toys"
            }
        ]
    },
    "pages": {
        "includeAllClientSidePages": true
    }
}

sympmarc avatar Nov 22 '21 23:11 sympmarc

Removing

"persistAssetFiles": true,

Fixes the issue, but of course, that causes other issues. Thanks to @bcameron1231 for the suggestion. Still seems like a bug.

sympmarc avatar Nov 22 '21 23:11 sympmarc

Agreed. While the Teams Photo isn't available in Graph v1.0 (only beta), we don't think the Provisioning Template should fail if it can't get the image under the v1.0 endpoint.

bcameron1231 avatar Nov 23 '21 16:11 bcameron1231

I just bumped into this one. Guess it's still an issue in PnP.PowerShell 1.11.0?

dremillard avatar Nov 05 '22 17:11 dremillard