Cli-microsoft365: New command: Move a folder to another location

Created on 12 Nov 2018  路  18Comments  路  Source: pnp/cli-microsoft365

Move a folder to another location

command: spo folder move -u|--webUrl <webUrl> -s|--sourceUrl <sourceUrl> -t|--targetUrl <targetUrl>

  • webUrl: The URL of the site where the folder is located
  • sourceUrl: Site-relative URL of the folder to move
  • targetUrl: Server-relative URL where to move the folder
good first issue new feature work in progress

Most helpful comment

I can take this aswell, thanks @phawrylak for easy ones to begin with :)

All 18 comments

@phawrylak, I would recommend looking at the copy folder command. That one can look similar as the copy command with switching few params for the CreateCopyJobs API.

@VelinGeorgiev, yes, this is the plan. I have read your blog article and have seen spo folder copy command. 馃憤

You want to take it @phawrylak?

@waldekmastykarz, I will leave it for others. 馃槂

I can take this aswell, thanks @phawrylak for easy ones to begin with :)

@VelinGeorgiev I see that AllowSchemaMismatch is not included as an option in any of the file/folder copy/move.
Should it be?

I would say yes, the default should be false.
Perhaps @waldekmastykarz can comment on this?

I agree, because I think it should be an option for the user.

What is the purpose of AllowSchemaMismatch?

@waldekmastykarz when you try to move from one library to another, there could be different fields on the target destination.
If there is a mismatch we just get an error.
So an AllowSchemaMismatch thats true moves/copies anyways :)

Gotcha. In that case, definitely something we need. Not sure about the default value, but it feels like we should allow mismatch by default and only fail if the user explicitly specified that the schemas should match.

@waldekmastykarz I had a look in fiddler.

  1. The user tried to move a Folder withing the UI. Then a request is sent without the AllowSchemaMismatch and we get a 500 error if there's a mismatch.

    1. We get prompted and told that we will lose some data, move anyway? Then on the second call the AllowSchemaMismatch with value true is passed along.

      So maybe default false then?

@waldekmastykarz you can review my PRs but keep in mind I will have a look at the "mismatch" thing.
Just a question, if we need it for the spo file copy and spo folder copy I could change this in two separate PRs, for structure?

Yes, please do two separate PRs as it will be easier to review

I can wait with reviewing both PRs until you're done. I'll label them as work in progress for the time being, ok?

Nice! Is there a rush or is sunday ok for me to have looked at the default behavior and changed/made the PRs?:)

No rush. We have a number of open PRs that we need to catch up on. If your commands are done when we're releasing the next beta, we'll include them. Otherwise, we'll include them in the next slot. Just let us know when you're ready.

Yes, AllowSchemaMismatch by default is false. Is is in case of source list schema <=> target list schema mismatch i.e. when you try to move file from list with custom fields to a list without the same custom fields.

Was this page helpful?
0 / 5 - 0 ratings