Skip to content

Bug report:m365 spo list add fails when giving list a title containing numeric values only #5059

@adam13hylo

Description

@adam13hylo

Priority

(Medium) I'm annoyed but I'll live

Description

When trying to run the command m365 spo list add and providing only a numeric value in the '--title' parameter an error is returned as follows:

Error: Cannot convert a primitive value to the expected type 'Edm.String'. See the inner exception for more details.

Steps to reproduce

Run command with numeric value only in the title field, for example:

$lib = m365 spo list add --webUrl "https://$tenant.sharepoint.com/sites/$sitealias" --title "1000" --baseTemplate DocumentLibrary -o json | ConvertFrom-Json

Expected results

A document library would be created with a numeric value for the title.

Actual results

image

Diagnostics

Executing command spo list add with options {"options":{"webUrl":"https://tenant.sharepoint.com/sites/sitecollection","title":1004,"baseTemplate":"DocumentLibrary","output":"json","debug":true}}
Creating list in site at https://tenant.sharepoint.com/sites/sitecollection...
Existing access token eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dC..... still valid. Returning...
Request:
{
  "url": "https://tenant.sharepoint.com/sites/sitecollection/_api/web/lists",
  "method": "post",
  "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/6.7.0",
    "accept-encoding": "gzip, deflate",
    "X-ClientService-ClientTag": "M365CLI:6.7.0",
    "accept": "application/json;odata=nometadata",
    "authorization": "Bearer eyJ0eXA......"
  },
  "responseType": "json",
  "decompress": true,
  "data": {
    "Title": 1004,
    "BaseTemplate": 101
  }
}
Request error:
{
  "url": "https://tenant.sharepoint.com/sites/sitecollection/_api/web/lists",
  "status": 400,
  "statusText": "Bad Request",
  "headers": {
    "cache-control": "private, max-age=0",
    "transfer-encoding": "chunked",
    "content-type": "application/json;odata=nometadata;streaming=true;charset=utf-8",
    "expires": "Tue, 30 May 2023 11:49:54 GMT",
    "last-modified": "Wed, 14 Jun 2023 11:49:54 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-networkstatistics": "0,2102272,38,113,486795,0,2102272",
    "x-sharepointhealthscore": "1",
    "x-sp-serverstate": "ReadOnly=0",
    "dataserviceversion": "3.0",
    "spclientservicerequestduration": "13",
    "sprequestduration": "13",
    "x-aspnet-version": "4.0.30319",
    "x-databoundary": "EU",
    "x-1dscollectorurl": "https://eu-mobile.events.data.microsoft.com/OneCollector/1.0/",
    "x-ariacollectorurl": "https://eu-mobile.events.data.microsoft.com/Collector/3.0",
    "sprequestguid": "a8bebca0-101f-6000-a96f-0ce8142c6543",
    "request-id": "a8bebca0-101f-6000-a96f-0ce8142c6543",
    "ms-cv": "oLy+qB8QAGCpbwzoFCxlQw.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 *.microsoft.com onedrive.live.com *.onedrive.live.com securebroker.sharepointonline.com;",
    "x-powered-by": "ASP.NET",
    "microsoftsharepointteamservices": "16.0.0.23724",
    "x-content-type-options": "nosniff",
    "x-ms-invokeapp": "1; RequireReadOnly",
    "x-cache": "CONFIG_NOCACHE",
    "x-msedge-ref": "Ref A: 78CFF7F3DC1346678942D0D482774177 Ref B: MAN31EDGE0413 Ref C: 2023-06-14T11:49:54Z",
    "date": "Wed, 14 Jun 2023 11:49:54 GMT",
    "connection": "close"
  },
  "error": {
    "odata.error": {
      "code": "-1, Microsoft.SharePoint.Client.InvalidClientQueryException",
      "message": {
        "lang": "en-US",
        "value": "Cannot convert a primitive value to the expected type 'Edm.String'. See the inner exception for more details."
      }
    }
  }
}
Error: Cannot convert a primitive value to the expected type 'Edm.String'. See the inner exception for more details.

CLI for Microsoft 365 version

6.7.0

nodejs version

v14.15.0

Operating system (environment)

Windows

Shell

PowerShell

cli doctor

{
  "os": {
    "platform": "win32",
    "version": "Windows 10 Enterprise",
    "release": "10.0.22621"
  },
  "cliVersion": "6.7.0",
  "nodeVersion": "v14.15.0",
  "cliAadAppId": "31359c7f-bd7e-475c-86db-fdb8c937548e",
  "cliAadAppTenant": "common",
  "authMode": "DeviceCode",
  "cliEnvironment": "",
  "cliConfig": {},
  "roles": [],
  "scopes": [
    "AllSites.FullControl",
    "AppCatalog.ReadWrite.All",
    "AuditLog.Read.All",
    "Bookings.Read.All",
    "ChannelMember.ReadWrite.All",
    "ChannelMessage.Read.All",
    "ChannelMessage.Send",
    "ChannelSettings.ReadWrite.All",
    "Chat.Read",
    "Chat.ReadWrite",
    "Directory.AccessAsUser.All",
    "Directory.ReadWrite.All",
    "ExternalConnection.ReadWrite.All",
    "Group.ReadWrite.All",
    "IdentityProvider.ReadWrite.All",
    "Mail.Read.Shared",
    "Mail.ReadWrite",
    "Mail.Send",
    "Notes.Read.All",
    "Place.Read.All",
    "Policy.Read.All",
    "RecordsManagement.ReadWrite.All",
    "Reports.Read.All",
    "SecurityEvents.Read.All",
    "ServiceHealth.Read.All",
    "ServiceMessage.Read.All",
    "ServiceMessageViewpoint.Write",
    "Tasks.ReadWrite",
    "Team.Create",
    "TeamMember.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",
    "AuditLog.Read.All",
    "Bookings.Read.All",
    "ChannelMember.ReadWrite.All",
    "ChannelMessage.Read.All",
    "ChannelMessage.Send",
    "ChannelSettings.ReadWrite.All",
    "Chat.Read",
    "Chat.ReadWrite",
    "Directory.AccessAsUser.All",
    "Directory.ReadWrite.All",
    "ExternalConnection.ReadWrite.All",
    "Group.ReadWrite.All",
    "IdentityProvider.ReadWrite.All",
    "Mail.Read.Shared",
    "Mail.ReadWrite",
    "Mail.Send",
    "Notes.Read.All",
    "Place.Read.All",
    "Policy.Read.All",
    "RecordsManagement.ReadWrite.All",
    "Reports.Read.All",
    "SecurityEvents.Read.All",
    "ServiceHealth.Read.All",
    "ServiceMessage.Read.All",
    "ServiceMessageViewpoint.Write",
    "Tasks.ReadWrite",
    "Team.Create",
    "TeamMember.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