Skip to content

spo folder copy#706

Closed
simonagren wants to merge 5 commits intopnp:devfrom
simonagren:spo-folder-copy
Closed

spo folder copy#706
simonagren wants to merge 5 commits intopnp:devfrom
simonagren:spo-folder-copy

Conversation

@simonagren
Copy link
Copy Markdown
Member

Made a few changes to match the changes made in spo file move and spo folder move

  • Added AllowSchemaMismatch
  • Changed to url.resolve
  • single parsing of URL
  • Empty return in Promise function
  • Slight changed in unit tests
  • Slight change in documentation

@coveralls
Copy link
Copy Markdown

coveralls commented Dec 10, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling 226f267 on simonagren:spo-folder-copy into 8270091 on pnp:dev.

@waldekmastykarz
Copy link
Copy Markdown
Member

Thank you! I'll review it shortly

@waldekmastykarz waldekmastykarz self-assigned this Dec 11, 2018
Copy link
Copy Markdown
Member

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When trying to use the command, I'm getting a File not found error.

Repro:

spo folder copy -u https://contoso.sharepoint.com/sites/marketing -s Shared%20Documents/Folder11 -t /sites/sales

It seems that the command generated invalid URL in the CreateCopyJobs payload:

CreateCopyJobs request...
body   : {"exportObjectUris":["https://contoso.sharepoint.com/sites/Shared%20Documents/Folder11"],"destinationUri":"https://contoso.sharepoint.com/sites/sales","options":{"AllowSchemaMismatch":false,"IgnoreVersionHistory":true}}
headers: {"authorization":"Bearer eyJ0eXAiOiJKV1QiLCJhbGc...","accept":"application/json;odata=nometadata","User-Agent":"NONISV|SharePointPnP|Office365CLI/1.11.0"}
json   : true
url    : https://contoso.sharepoint.com/sites/marketing/_api/site/CreateCopyJobs

I also tried running

spo folder copy -u https://contoso.sharepoint.com/sites/marketing -s /Shared%20Documents/Folder11 -t /sites/sales

and

spo folder copy -u https://contoso.sharepoint.com/sites/marketing -s "Shared Documents/Folder11" -t /sites/sales

But in all cases I'm getting the same error

Copy link
Copy Markdown
Member

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done with a few issues I've fixed when merging the PR

webUrl: string;
sourceUrl: string;
targetUrl: string;
allowSchemaMismatch: boolean;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allowSchemaMismatch should be optional

```

Copies folder to a document library in another site collection. Allow for schema mismatch
```sh
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be an empty line between text and a code block. Additionally, the code block shouldn't be indented.

`-u, --webUrl <webUrl>`|The URL of the site where the folder is located
`-s, --sourceUrl <sourceUrl>`|Site-relative URL of the folder to copy
`-t, --targetUrl <targetUrl>`|Server-relative URL where to copy the folder
`--allowSchemaMismatch`|Ignores any missing fields in the target destination and copies the folder anyway
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't match the option description in the command

`-u, --webUrl <webUrl>`|The URL of the site where the folder is located
`-s, --sourceUrl <sourceUrl>`|Site-relative URL of the folder to copy
`-t, --targetUrl <targetUrl>`|Server-relative URL where to copy the folder
`--allowSchemaMismatch`|Ignores any missing fields in the target destination and copies the folder anyway
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target and destination are the same thing. No need to mention them both in one sentence

@waldekmastykarz waldekmastykarz added this to the v1.13.0 milestone Dec 30, 2018
@waldekmastykarz
Copy link
Copy Markdown
Member

Merged manually. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants