Skip to content

Bug report: Cannot create a new SharePoint list using example command with schemaXml option #2906

@danwatford

Description

@danwatford

Description

Attempts to create a new list on an existing SharePoint online team site fails with 'Error: Invalid list template.'

Unfortunately there is no information provided in the error response from SharePoint to help determine the issue with the schemaXml.

The same issue occurs if using the schemaXml example from the documentation page, https://pnp.github.io/cli-microsoft365/cmd/spo/list/list-add/

Steps to reproduce

At an ubuntu terminal, running under wsl:

m365 spo list add --title Announcements --baseTemplate Announcements --webUrl https://watconsdev.sharepoint.com/sites/bfwvendors --schemaXml '<List xmlns:ows="Microsoft SharePoint" Title="List1" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/List1" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/"><MetaData><ContentTypes><ContentTypeRef ID="0x01"><Folder TargetName="Item" /></ContentTypeRef><ContentTypeRef ID="0x0120" /></ContentTypes><Fields><Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Type="Text" Name="Title" DisplayName="$Resources:core,Title;" Required="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" MaxLength="255" /></Fields><Views><View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE"><Toolbar Type="Standard" /><XslLink Default="TRUE">main.xsl</XslLink><RowLimit Paged="TRUE">30</RowLimit><ViewFields><FieldRef Name="LinkTitleNoMenu"></FieldRef></ViewFields><Query><OrderBy><FieldRef Name="Modified" Ascending="FALSE"></FieldRef></OrderBy></Query><ParameterBindings><ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)" /><ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" /><ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_ONET_HOME)" /></ParameterBindings></View><View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/15/images/generic.png?rev=23" Url="AllItems.aspx"><Toolbar Type="Standard" /><XslLink Default="TRUE">main.xsl</XslLink><JSLink>clienttemplates.js</JSLink><RowLimit Paged="TRUE">30</RowLimit><ViewFields><FieldRef Name="LinkTitle"></FieldRef></ViewFields><Query><OrderBy><FieldRef Name="ID"></FieldRef></OrderBy></Query><ParameterBindings><ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" /><ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" /></ParameterBindings></View></Views><Forms><Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" /><Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" /><Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" /></Forms></MetaData></List>'

Expected results

A new SharePoint list called Announcements is created.

Actual results

An error result is given by m365:
Error: Invalid list template.

Diagnostics

Executing command spo list add with options {"options":{"debug":true,"title":"Announcements","baseTemplate":"Announcements","webUrl":"https://watconsdev.sharepoint.com/sites/bfwvendors","schemaXml":"<List xmlns:ows=\"Microsoft SharePoint\" Title=\"List1\" FolderCreation=\"FALSE\" Direction=\"$Resources:Direction;\" Url=\"Lists/List1\" BaseType=\"0\" xmlns=\"http://schemas.microsoft.com/sharepoint/\"><MetaData><ContentTypes><ContentTypeRef ID=\"0x01\"><Folder TargetName=\"Item\" /></ContentTypeRef><ContentTypeRef ID=\"0x0120\" /></ContentTypes><Fields><Field ID=\"{fa564e0f-0c70-4ab9-b863-0177e6ddd247}\" Type=\"Text\" Name=\"Title\" DisplayName=\"$Resources:core,Title;\" Required=\"TRUE\" SourceID=\"http://schemas.microsoft.com/sharepoint/v3\" StaticName=\"Title\" MaxLength=\"255\" /></Fields><Views><View BaseViewID=\"0\" Type=\"HTML\" MobileView=\"TRUE\" TabularView=\"FALSE\"><Toolbar Type=\"Standard\" /><XslLink Default=\"TRUE\">main.xsl</XslLink><RowLimit Paged=\"TRUE\">30</RowLimit><ViewFields><FieldRef Name=\"LinkTitleNoMenu\"></FieldRef></ViewFields><Query><OrderBy><FieldRef Name=\"Modified\" Ascending=\"FALSE\"></FieldRef></OrderBy></Query><ParameterBindings><ParameterBinding Name=\"AddNewAnnouncement\" Location=\"Resource(wss,addnewitem)\" /><ParameterBinding Name=\"NoAnnouncements\" Location=\"Resource(wss,noXinviewofY_LIST)\" /><ParameterBinding Name=\"NoAnnouncementsHowTo\" Location=\"Resource(wss,noXinviewofY_ONET_HOME)\" /></ParameterBindings></View><View BaseViewID=\"1\" Type=\"HTML\" WebPartZoneID=\"Main\" DisplayName=\"$Resources:core,objectiv_schema_mwsidcamlidC24;\" DefaultView=\"TRUE\" MobileView=\"TRUE\" MobileDefaultView=\"TRUE\" SetupPath=\"pages\\viewpage.aspx\" ImageUrl=\"/_layouts/15/images/generic.png?rev=23\" Url=\"AllItems.aspx\"><Toolbar Type=\"Standard\" /><XslLink Default=\"TRUE\">main.xsl</XslLink><JSLink>clienttemplates.js</JSLink><RowLimit Paged=\"TRUE\">30</RowLimit><ViewFields><FieldRef Name=\"LinkTitle\"></FieldRef></ViewFields><Query><OrderBy><FieldRef Name=\"ID\"></FieldRef></OrderBy></Query><ParameterBindings><ParameterBinding Name=\"NoAnnouncements\" Location=\"Resource(wss,noXinviewofY_LIST)\" /><ParameterBinding Name=\"NoAnnouncementsHowTo\" Location=\"Resource(wss,noXinviewofY_DEFAULT)\" /></ParameterBindings></View></Views><Forms><Form Type=\"DisplayForm\" Url=\"DispForm.aspx\" SetupPath=\"pages\\form.aspx\" WebPartZoneID=\"Main\" /><Form Type=\"EditForm\" Url=\"EditForm.aspx\" SetupPath=\"pages\\form.aspx\" WebPartZoneID=\"Main\" /><Form Type=\"NewForm\" Url=\"NewForm.aspx\" SetupPath=\"pages\\form.aspx\" WebPartZoneID=\"Main\" /></Forms></MetaData></List>"}}
Creating list in site at https://watconsdev.sharepoint.com/sites/bfwvendors...
Existing access token eyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX still valid. Returning...
Request:
{
  "headers": {
    "common": {
      "Accept": "application/json, text/plain, */*"
    },
    "delete": {},
    "get": {},
    "head": {},
    "post": {
      "Content-Type": "application/x-www-form-urlencoded"
    },
    "put": {
      "Content-Type": "application/x-www-form-urlencoded"
    },
    "patch": {
      "Content-Type": "application/x-www-form-urlencoded"
    },
    "user-agent": "NONISV|SharePointPnP|CLIMicrosoft365/4.2.0",
    "accept-encoding": "gzip, deflate",
    "accept": "application/json;odata=nometadata",
    "authorization": "Bearer eyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  },
  "decompress": true,
  "responseType": "json",
  "url": "https://watconsdev.sharepoint.com/sites/bfwvendors/_api/web/lists",
  "method": "post",
  "data": {
    "Title": "Announcements",
    "BaseTemplate": 104,
    "SchemaXml": "<List xmlns:ows=\\\"Microsoft SharePoint\" Title=\"List1\" FolderCreation=\"FALSE\" Direction=\"$Resources:Direction;\" Url=\"Lists/List1\" BaseType=\"0\" xmlns=\"http://schemas.microsoft.com/sharepoint/\"><MetaData><ContentTypes><ContentTypeRef ID=\"0x01\"><Folder TargetName=\"Item\" /></ContentTypeRef><ContentTypeRef ID=\"0x0120\" /></ContentTypes><Fields><Field ID=\"{fa564e0f-0c70-4ab9-b863-0177e6ddd247}\" Type=\"Text\" Name=\"Title\" DisplayName=\"$Resources:core,Title;\" Required=\"TRUE\" SourceID=\"http://schemas.microsoft.com/sharepoint/v3\" StaticName=\"Title\" MaxLength=\"255\" /></Fields><Views><View BaseViewID=\"0\" Type=\"HTML\" MobileView=\"TRUE\" TabularView=\"FALSE\"><Toolbar Type=\"Standard\" /><XslLink Default=\"TRUE\">main.xsl</XslLink><RowLimit Paged=\"TRUE\">30</RowLimit><ViewFields><FieldRef Name=\"LinkTitleNoMenu\"></FieldRef></ViewFields><Query><OrderBy><FieldRef Name=\"Modified\" Ascending=\"FALSE\"></FieldRef></OrderBy></Query><ParameterBindings><ParameterBinding Name=\"AddNewAnnouncement\" Location=\"Resource(wss,addnewitem)\" /><ParameterBinding Name=\"NoAnnouncements\" Location=\"Resource(wss,noXinviewofY_LIST)\" /><ParameterBinding Name=\"NoAnnouncementsHowTo\" Location=\"Resource(wss,noXinviewofY_ONET_HOME)\" /></ParameterBindings></View><View BaseViewID=\"1\" Type=\"HTML\" WebPartZoneID=\"Main\" DisplayName=\"$Resources:core,objectiv_schema_mwsidcamlidC24;\" DefaultView=\"TRUE\" MobileView=\"TRUE\" MobileDefaultView=\"TRUE\" SetupPath=\"pages\\\\viewpage.aspx\" ImageUrl=\"/_layouts/15/images/generic.png?rev=23\" Url=\"AllItems.aspx\"><Toolbar Type=\"Standard\" /><XslLink Default=\"TRUE\">main.xsl</XslLink><JSLink>clienttemplates.js</JSLink><RowLimit Paged=\"TRUE\">30</RowLimit><ViewFields><FieldRef Name=\"LinkTitle\"></FieldRef></ViewFields><Query><OrderBy><FieldRef Name=\"ID\"></FieldRef></OrderBy></Query><ParameterBindings><ParameterBinding Name=\"NoAnnouncements\" Location=\"Resource(wss,noXinviewofY_LIST)\" /><ParameterBinding Name=\"NoAnnouncementsHowTo\" Location=\"Resource(wss,noXinviewofY_DEFAULT)\" /></ParameterBindings></View></Views><Forms><Form Type=\"DisplayForm\" Url=\"DispForm.aspx\" SetupPath=\"pages\\form.aspx\" WebPartZoneID=\"Main\" /><Form Type=\"EditForm\" Url=\"EditForm.aspx\" SetupPath=\"pages\\form.aspx\" WebPartZoneID=\"Main\" /><Form Type=\"NewForm\" Url=\"NewForm.aspx\" SetupPath=\"pages\\form.aspx\" WebPartZoneID=\"Main\" /></Forms></MetaData></List>"
  }
}
Request error:
{
  "status": 500,
  "statusText": "Internal Server Error",
  "headers": {
    "cache-control": "private, max-age=0",
    "transfer-encoding": "chunked",
    "content-type": "application/json;odata=nometadata;streaming=true;charset=utf-8",
    "expires": "Tue, 14 Dec 2021 15:53:53 GMT",
    "last-modified": "Wed, 29 Dec 2021 15:53:53 GMT",
    "vary": "Origin",
    "p3p": "CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"",
    "x-sharepointhealthscore": "1",
    "x-sp-serverstate": "ReadOnly=0",
    "dataserviceversion": "3.0",
    "spclientservicerequestduration": "205",
    "x-aspnet-version": "4.0.30319",
    "sprequestguid": "2a9111a0-b0f8-3000-90b9-ae1a7e4271fa",
    "request-id": "2a9111a0-b0f8-3000-90b9-ae1a7e4271fa",
    "ms-cv": "oBGRKviwADCQua4afkJx+g.0",
    "strict-transport-security": "max-age=31536000",
    "x-frame-options": "SAMEORIGIN",
    "content-security-policy": "frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com *.powerapps.com *.yammer.com *.officeapps.live.com *.office.com *.stream.azure-test.net *.microsoftstream.com *.dynamics.com;",
    "x-powered-by": "ASP.NET",
    "microsoftsharepointteamservices": "16.0.0.22001",
    "x-content-type-options": "nosniff",
    "x-ms-invokeapp": "1; RequireReadOnly",
    "x-cache": "CONFIG_NOCACHE",
    "x-msedge-ref": "Ref A: A1AAF8DC9199485AA1ED4C5DF026677F Ref B: LON21EDGE1318 Ref C: 2021-12-29T15:53:53Z",
    "date": "Wed, 29 Dec 2021 15:53:52 GMT",
    "connection": "close"
  },
  "error": {
    "odata.error": {
      "code": "-2130575237, Microsoft.SharePoint.SPException",
      "message": {
        "lang": "en-US",
        "value": "Invalid list template."
      }
    }
  }
}
Error: Invalid list template.

CLI for Microsoft 365 version

v4.2.0

nodejs version

v14.17.0

Operating system (environment)

Windows

Shell

bash

cli doctor

{ "os": { "platform": "linux", "version": "#1 SMP Tue Jun 23 12:58:10 UTC 2020", "release": "4.19.128-microsoft-standard" }, "cliVersion": "4.2.0", "nodeVersion": "v14.17.0", "cliAadAppId": "31359c7f-bd7e-475c-86db-fdb8c937548e", "cliAadAppTenant": "common", "authMode": "DeviceCode", "cliEnvironment": "", "roles": [], "scopes": [ "AllSites.FullControl", "AppCatalog.ReadWrite.All", "ChannelMember.ReadWrite.All", "ChannelMessage.Send", "ChannelSettings.ReadWrite.All", "Directory.AccessAsUser.All", "Directory.ReadWrite.All", "Group.ReadWrite.All", "IdentityProvider.ReadWrite.All", "Mail.ReadWrite", "Mail.Send", "Reports.Read.All", "Tasks.ReadWrite", "Team.Create", "TeamMember.ReadWrite.All", "TeamsApp.ReadWrite.All", "TeamsAppInstallation.ReadWriteForUser", "TeamSettings.ReadWrite.All", "TeamsTab.ReadWrite.All", "TermStore.ReadWrite.All", "User.Invite.All", "User.ReadWrite.All", "profile", "openid", "email", "AllSites.FullControl", "AppCatalog.ReadWrite.All", "ChannelMember.ReadWrite.All", "ChannelMessage.Send", "ChannelSettings.ReadWrite.All", "Directory.AccessAsUser.All", "Directory.ReadWrite.All", "Group.ReadWrite.All", "IdentityProvider.ReadWrite.All", "Mail.ReadWrite", "Mail.Send", "Reports.Read.All", "Tasks.ReadWrite", "Team.Create", "TeamMember.ReadWrite.All", "TeamsApp.ReadWrite.All", "TeamsAppInstallation.ReadWriteForUser", "TeamSettings.ReadWrite.All", "TeamsTab.ReadWrite.All", "TermStore.ReadWrite.All", "User.Invite.All", "User.ReadWrite.All" ] }

Additional Info

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions