Skip to content

New command: m365 file move #4607

@appieschot

Description

@appieschot

Usage

m365 file move

Description

Moves a file to another location using the Microsoft Graph

Options

Option Description
-u, --webUrl <webUrl> The URL of the site where the file is located.
-s, --sourceUrl <sourceUrl> Server-relative or absolute URL of the file.
-t, --targetUrl <targetUrl> Server-relative or absolute URL of the location.
--newName [newName] New name of the destination file.
--nameConflictBehavior [nameConflictBehavior] Behavior when a document with the same name is already present at the destination. Possible values: fail, replace, rename. Default is fail.

Examples

Moves a file using the graph

m365 file move --webUrl https://contoso.sharepoint.com/sites/project --sourceUrl "/sites/project/Shared Documents/Document.pdf" --targetUrl "/sites/IT/Shared Documents"

Default properties

No response

Additional Info

  • We currently have a m365 file add command using the Microsoft Graph this should be part of that command structure
  • Should use the new Drive API
  • Validate if we already have appropriate permissions for this command

Two remarks;

  • If we agree on this spec I shall create one for the m365 file copy option as well (it will be the same structure)
  • We most likely want to have a m365 folder move and m365 file copy as well, the source could/would be the almost same. We could use an Alias for that and have our --sourceUrl reflect both files and folders.
  • We should consider support for the driveItem since that is something that will be returned by the m365 file list

@pnp/cli-for-microsoft-365-maintainers please chime in :D

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions