Skip to content

Commit

Permalink
Update AddUsingPath
Browse files Browse the repository at this point in the history
Add Missing parameter to AddUsingPath

Updating Docs
Adding Missing Parameter from interface.
  • Loading branch information
bcameron1231 committed Dec 1, 2023
1 parent 1b3b6fa commit df5c397
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/sp/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ Likewise you can add files using one of two methods, addUsingPath or addChunked.

The addUsingPath method, supports the percent or pound characters in file names.

When using EnsureUniqueFileName property, you must omit the Overwrite parameter.

```TypeScript
import { spfi } from "@pnp/sp";
import "@pnp/sp/webs";
Expand Down
9 changes: 8 additions & 1 deletion packages/sp/files/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export class _Files extends _SPCollection<IFileInfo[]> {
if (parameters.Overwrite) {
path.push(",Overwrite=true");
}
if (parameters.EnsureUniqueFileName) {
path.push(`,EnsureUniqueFileName=${parameters.EnsureUniqueFileName}`);
}
if (parameters.AutoCheckoutOnInvalidData) {
path.push(",AutoCheckoutOnInvalidData=true");
}
Expand Down Expand Up @@ -703,7 +706,7 @@ export interface IAddUsingPathProps {
/**
* Overwrite the file if it exists
*/
Overwrite: boolean;
Overwrite?: boolean;
/**
* specifies whether to auto checkout on invalid Data. It'll be useful if the list contains validation whose requirements upload will not be able to meet.
*/
Expand All @@ -712,6 +715,10 @@ export interface IAddUsingPathProps {
* Specifies a XOR hash of the file data which should be used to ensure end-2-end data integrity, base64 representation
*/
XorHash?: string;
/**
* Specifies whether to force unique file name. When using this, omit the Overwrite parameter.
*/
EnsureUniqueFileName?: boolean;
}

export interface IFileInfo {
Expand Down

0 comments on commit df5c397

Please sign in to comment.