pnpframework icon indicating copy to clipboard operation
pnpframework copied to clipboard

"TeamsAppId" Property Missing from Extracted Schema File for Teams.

Open BaronSparky opened this issue 3 years ago • 6 comments

Reporting an Issue or Missing Feature

Issue

Expected behavior

To be able to extract a Teams configuration from an existing Team and then re-provision from that extracted template.

Actual behavior

Trying to re-provision from an extracted template results in errors:

Invoke-PnPTenantTemplate : The required attribute 'TeamsAppId' is missing.
At line:1 char:1
+ Invoke-PnPTenantTemplate -Path .\sometemplate.xml
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SyntaxError: (:) [Invoke-PnPTenantTemplate], XmlSchemaValidationException
    + FullyQualifiedErrorId : TEMPLATENOTVALID,PnP.PowerShell.Commands.Provisioning.Tenant.InvokeTenantTemplate

This relates to the "TeamAppId" property missing from the extracted schema for each of the "Tabs" defined. (https://docs.microsoft.com/en-us/graph/teams-configuring-builtin-tabs)

<pnp:Tab DisplayName="WebSite" ID="fdf0fc44-4eca-43e8-b8e1-932f7a60f1f7" Remove="false">
  <pnp:Configuration EntityId="" ContentUrl="https://www.somewebsite.co.uk" RemoveUrl="" WebsiteUrl="https://www.somewebsite.co.uk" />
</pnp:Tab>

needs to be similar to:

<pnp:Tab DisplayName="WebSite" TeamsAppId="com.microsoft.teamspace.tab.web" ID="fdf0fc44-4eca-43e8-b8e1-932f7a60f1f7" Remove="false">
  <pnp:Configuration EntityId="" ContentUrl="https://www.somewebsite.co.uk" RemoveUrl="" WebsiteUrl="https://www.somewebsite.co.uk" />
</pnp:Tab>

Steps to reproduce behavior

Extract a PnP Tenant Template using a configuration file that looks like:

{
    "$schema": "https://aka.ms/sppnp-extract-configuration-schema",    
    "tenant": {
        "teams": {          
            "includeGroupId": false,            
            "includeMessages": false
        }
    },
    "handlers": [
        "Tenant"
    ]
}

Issue the command for the SPO site that supports the Team and save it as an XML schema file::

$template = Get-PnPTenantTemplate -SiteUrl https://m365x123456.sharepoint.com/sites/PROV002 –Configuration "configTeams.json" -AsInstance
Save-PnPTenantTemplate -Force -Template $template -Out sometemplate.xml

Invoke the template: Invoke-PnPTenantTemplate -Path .\sometemplate.xml

What is the version of the Cmdlet module you are running?

1.7.17 (nightly)

Which operating system/environment are you running PnP PowerShell on?

  • [x] Windows
  • [ ] Linux
  • [ ] MacOS
  • [ ] Azure Cloud Shell
  • [ ] Azure Functions
  • [ ] Other : please specify

BaronSparky avatar Aug 12 '21 15:08 BaronSparky

Any ideas???

BaronSparky avatar Aug 27 '21 10:08 BaronSparky

Seems to be the same for the "Description" 2021-09-07T08:05:48.595 [Error] ERROR: The required attribute 'Description' is missing.Exception :Type : System.Xml.Schema.XmlSchemaValidationExceptionMessage : The required attribute 'Description' is missing.HResult : -2146231999CategoryInfo : SyntaxError: (:) [Read-PnPTenantTemplate], XmlSchemaValidationExceptionFullyQualifiedErrorId : TEMPLATENOTVALID,PnP.PowerShell.Commands.Provisioning.Tenant.ReadTenantTemplateInvocationInfo :MyCommand : Read-PnPTenantTemplateScriptLineNumber : 161OffsetInLine : 25HistoryId : 1ScriptName : C:\home\site\wwwroot\somefunction\run.ps1Line : $template = Read-PnPTenantTemplate -Path $schemaFilePathPositionMessage : At C:\home\site\wwwroot\somefunction\run.ps1:161 char:25+ $template = Read-PnPTenantTemplate -Path $schemaFilePath+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~PSScriptRoot : C:\home\site\wwwroot\somefunctionPSCommandPath : C:\home\site\wwwroot\somefunctionschema\run.ps1InvocationName : Read-PnPTenantTemplateCommandOrigin : InternalScriptStackTrace : at <ScriptBlock>, C:\home\site\wwwroot\somefunction\run.ps1: line 161PipelineIterationInfo :Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException : Result: ERROR: The required attribute 'Description' is missing.Exception :Type : System.Xml.Schema.XmlSchemaValidationExceptionMessage : The required attribute 'Description' is missing.HResult : -2146231999CategoryInfo : SyntaxError: (:) [Read-PnPTenantTemplate], XmlSchemaValidationExceptionFullyQualifiedErrorId : TEMPLATENOTVALID,PnP.PowerShell.Commands.Provisioning.Tenant.ReadTenantTemplateInvocationInfo :MyCommand : Read-PnPTenantTemplateScriptLineNumber : 161OffsetInLine : 25HistoryId : 1ScriptName : C:\home\site\wwwroot\somefunction\run.ps1Line : $template = Read-PnPTenantTemplate -Path $schemaFilePathPositionMessage : At C:\home\site\wwwroot\somefunction\run.ps1:161 char:25+ $template = Read-PnPTenantTemplate -Path $schemaFilePath+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~PSScriptRoot : C:\home\site\wwwroot\somefunctionPSCommandPath : C:\home\site\wwwroot\somefunction\run.ps1InvocationName : Read-PnPTenantTemplateCommandOrigin : InternalScriptStackTrace : at <ScriptBlock>, C:\home\site\wwwroot\somefunction\run.ps1: line 161PipelineIterationInfo :Exception: The required attribute 'Description' is missing.Stack:

BaronSparky avatar Sep 07 '21 08:09 BaronSparky

The "Description" issue appears when the Team schema is extracted and "Description" is missing on the Channel. This appears to happen if the user has not supplied a "Description" for the Channel. It should be extracted as blank in that scenario as it is "required": <pnp:Channel DisplayName="Channel" Description=""...

BaronSparky avatar Sep 07 '21 09:09 BaronSparky

I'm seeing the same issue with TeamsAppId after exporting. See #529.

If I remove pnp:Tabs, the template is used successfully.

                    <pnp:Tabs>
                        <pnp:Tab DisplayName="Wiki" ID="f1d6f6db-e57c-4a17-a703-3d13765a2c83" Remove="false" />
                    </pnp:Tabs>

sympmarc avatar Nov 22 '21 23:11 sympmarc

A little more testing, several states I've tested.

As exported (no custom tabs), it fails with the error

                    <pnp:Tabs>
                        <pnp:Tab DisplayName="Wiki" ID="f1d6f6db-e57c-4a17-a703-3d13765a2c83" Remove="false" />
                    </pnp:Tabs>

Adding a OneNote tab makes it succeed.

                    <pnp:Tabs>
                        <pnp:Tab DisplayName="Wiki" TeamsAppId="com.microsoft.teamspace.tab.wiki" Remove="true" />
                        <pnp:Tab DisplayName="OneNote" TeamsAppId="0d820ecd-def2-4297-adad-78056cde7c78" />
                    </pnp:Tabs>

This fails, but silently and the Team isn't created. It sort of makes sense, since I've asked the engine to remove the only tab. (Tested by accident, but maybe still useful?)

                    <pnp:Tabs>
                        <pnp:Tab DisplayName="Wiki" TeamsAppId="com.microsoft.teamspace.tab.wiki" Remove="true" />
                    </pnp:Tabs>

sympmarc avatar Nov 23 '21 17:11 sympmarc

I've added a PR for this #532 Let's see if it's accepted

magarma avatar Nov 26 '21 11:11 magarma