Skip to content

Bug report: The 'spo listitem batch set' command breaks on XML forbidden character, like & #6430

@martinlingstuyl

Description

@martinlingstuyl

Priority

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

Description

When using m365 spo listitem batch set, the command can break if the CSV contains column values with an XML forbidden character, like &.

The command throws an error saying:
Error: An error occurred while parsing EntityName. Line 1, position 6515. - null

That is because we build a XML string for the CSOM call. We should probably replace the ampersands with &, and there are probably more characters to be escaped...

Steps to reproduce

Run the command with the following CSV

"ID","Title"
"1","Some update & fixes"

Expected results

It should update the list item without issues.

Actual results

It throws the error

Error: An error occurred while parsing EntityName. Line 1, position <number>. - null

Diagnostics

No response

CLI for Microsoft 365 version

10

nodejs version

20

Operating system (environment)

Windows

Shell

PowerShell

cli doctor

No response

Additional Info

No response

Implementation

We need to escape all XML forbidden characters:

"   &quot;
'   &apos;
<   &lt;
>   &gt;
&   &amp;

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions