Skip to content

spo file add: A file or folder with the name already exists #6011

@MartinLoeper

Description

@MartinLoeper

Priority

(Urgent) I can't use the CLI

Description

I want to replace a remote sharepoint file using the spo file add command, but the server complains that the file already exists.

Steps to reproduce

m365 spo file add \
        -u "xxxxxx" \
        --folder "xxxxxx" \
        --checkOut \
        --checkInComment 'mloeper locked file to modify entries' \
        --path "some local path"

Expected results

The file should be replaced. Since it is versioned, a new version should be added.

Actual results

{"error":"Eine Datei oder ein Ordner mit dem Namen \"xxxxx\" ist bereits vorhanden."}

aka "file already exists".

Diagnostics

No response

CLI for Microsoft 365 version

v7.6.0

nodejs version

20.11.1

Operating system (environment)

Linux

Shell

zsh

cli doctor

No response

Additional Info

No response


Updated spec

Seems like the error thrown was by design by the API.
While looking at the command, I found some other issues as well:

  • Verbose logs only work in debug mode
  • Undoing a check-out of a file always fails since there is no access token provided to the request.
  • Impossible to check in a file using a site relative URL, for example: --folder "/Shared Documents".

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions