Priority
(Medium) I'm annoyed but I'll live
Description
when presenting a malformatted CSV or fields inside the CSV, the spo listitem batch add will give a generic 'forEach' error instead of a proper error which field is not correct.
Steps to reproduce
m365 spo listitem batch add -s $site -t $listname -p $csvfile
with a csv file with a malformed date
Title,Datefield
"Test entry", "1980-01-01T12:00:00Z"
instead of the format required by listitem batch
Expected results
a proper error what is wrong with the csv
Actual results
a generic error about 'foreach'
Diagnostics
if I add a check in the parseBatchResponseBody(response) function in listitem-batch-add.js after the JSON.parse(line), i get a proper error:
if (!parsedResponse.value) { console.log(line); }
instead of just a foreach on undefined object of the next line.
CLI for Microsoft 365 version
v7.1.0
nodejs version
v20.9.0
Operating system (environment)
Windows
Shell
PowerShell
cli doctor
$ m365 cli doctor
{
"os": {
"platform": "win32",
"version": "Windows 11 Pro",
"release": "10.0.22621"
},
"cliVersion": "7.1.0",
"nodeVersion": "v20.9.0",
"cliAadAppId": "31359c7f-bd7e-475c-86db-fdb8c937548e",
"cliAadAppTenant": "common",
"authMode": "Browser",
"cliEnvironment": "",
"cliConfig": {
"autoOpenLinksInBrowser": false,
"copyDeviceCodeToClipboard": false,
"output": "json",
"printErrorsAsPlainText": false,
"prompt": false,
"showHelpOnFailure": false,
"showSpinner": false,
"errorOutput": "stdout",
"helpMode": "options"
},
"roles": [],
"scopes": {
"https://graph.microsoft.com": [
"AllSites.FullControl",
"AppCatalog.ReadWrite.All",
"AuditLog.Read.All",
"Bookings.Read.All",
"Calendars.Read",
"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",
"InformationProtectionPolicy.Read",
"Mail.Read.Shared",
"Mail.ReadWrite",
"Mail.Send",
"Notes.Read.All",
"OnlineMeetings.Read",
"OnlineMeetingTranscript.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"
],
"https://xxxxx.sharepoint.com": [
"AllSites.FullControl",
"AppCatalog.ReadWrite.All",
"AuditLog.Read.All",
"Bookings.Read.All",
"Calendars.Read",
"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",
"InformationProtectionPolicy.Read",
"Mail.Read.Shared",
"Mail.ReadWrite",
"Mail.Send",
"Notes.Read.All",
"OnlineMeetings.Read",
"OnlineMeetingTranscript.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
Priority
(Medium) I'm annoyed but I'll live
Description
when presenting a malformatted CSV or fields inside the CSV, the spo listitem batch add will give a generic 'forEach' error instead of a proper error which field is not correct.
Steps to reproduce
with a csv file with a malformed date
instead of the format required by listitem batch
Expected results
a proper error what is wrong with the csv
Actual results
a generic error about 'foreach'
Diagnostics
if I add a check in the parseBatchResponseBody(response) function in listitem-batch-add.js after the JSON.parse(line), i get a proper error:
instead of just a foreach on undefined object of the next line.
CLI for Microsoft 365 version
v7.1.0
nodejs version
v20.9.0
Operating system (environment)
Windows
Shell
PowerShell
cli doctor
$ m365 cli doctor
{
"os": {
"platform": "win32",
"version": "Windows 11 Pro",
"release": "10.0.22621"
},
"cliVersion": "7.1.0",
"nodeVersion": "v20.9.0",
"cliAadAppId": "31359c7f-bd7e-475c-86db-fdb8c937548e",
"cliAadAppTenant": "common",
"authMode": "Browser",
"cliEnvironment": "",
"cliConfig": {
"autoOpenLinksInBrowser": false,
"copyDeviceCodeToClipboard": false,
"output": "json",
"printErrorsAsPlainText": false,
"prompt": false,
"showHelpOnFailure": false,
"showSpinner": false,
"errorOutput": "stdout",
"helpMode": "options"
},
"roles": [],
"scopes": {
"https://graph.microsoft.com": [
"AllSites.FullControl",
"AppCatalog.ReadWrite.All",
"AuditLog.Read.All",
"Bookings.Read.All",
"Calendars.Read",
"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",
"InformationProtectionPolicy.Read",
"Mail.Read.Shared",
"Mail.ReadWrite",
"Mail.Send",
"Notes.Read.All",
"OnlineMeetings.Read",
"OnlineMeetingTranscript.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"
],
"https://xxxxx.sharepoint.com": [
"AllSites.FullControl",
"AppCatalog.ReadWrite.All",
"AuditLog.Read.All",
"Bookings.Read.All",
"Calendars.Read",
"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",
"InformationProtectionPolicy.Read",
"Mail.Read.Shared",
"Mail.ReadWrite",
"Mail.Send",
"Notes.Read.All",
"OnlineMeetings.Read",
"OnlineMeetingTranscript.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