1 | import { _SPCollection, _SPInstance, ISPInstance, IDeleteableWithETag, ISPQueryable } from "../spqueryable.js";
|
2 | import { IItem } from "../items/types.js";
|
3 | import { IResourcePath } from "../utils/to-resource-path.js";
|
4 | import "../context-info/index.js";
|
5 | import { IMoveCopyOptions } from "../types.js";
|
6 | export declare class _Folders extends _SPCollection<IFolderInfo[]> {
|
7 | /**
|
8 | * Gets a folder by it's name
|
9 | *
|
10 | * @param name Folder's name
|
11 | */
|
12 | getByUrl(name: string): IFolder;
|
13 | /**
|
14 | * Adds a new folder by path and should be prefered over add
|
15 | *
|
16 | * @param serverRelativeUrl The server relative url of the new folder to create
|
17 | * @param overwrite True to overwrite an existing folder, default false
|
18 | */
|
19 | addUsingPath(serverRelativeUrl: string, overwrite?: boolean): Promise<IFolderAddResult>;
|
20 | }
|
21 | export interface IFolders extends _Folders {
|
22 | }
|
23 | export declare const Folders: import("../spqueryable.js").ISPInvokableFactory<IFolders>;
|
24 | export declare class _Folder extends _SPInstance<IFolderInfo> {
|
25 | delete: (this: ISPQueryable<any>, eTag?: string) => Promise<void>;
|
26 | /**
|
27 | * Gets this folder's sub folders
|
28 | *
|
29 | */
|
30 | get folders(): IFolders;
|
31 | /**
|
32 | * Gets this folder's list item field values
|
33 | *
|
34 | */
|
35 | get listItemAllFields(): ISPInstance;
|
36 | /**
|
37 | * Gets the parent folder, if available
|
38 | *
|
39 | */
|
40 | get parentFolder(): IFolder;
|
41 | /**
|
42 | * Gets this folder's properties
|
43 | *
|
44 | */
|
45 | get properties(): ISPInstance;
|
46 | /**
|
47 | * Gets this folder's storage metrics information
|
48 | *
|
49 | */
|
50 | get storageMetrics(): ISPInstance<IStorageMetrics>;
|
51 | /**
|
52 | * Updates folder's properties
|
53 | * @param props Folder's properties to update
|
54 | */
|
55 | update(props: Partial<IFolderInfo>): Promise<IFolderUpdateResult>;
|
56 | /**
|
57 | * Moves the folder to the Recycle Bin and returns the identifier of the new Recycle Bin item.
|
58 | */
|
59 | recycle(): Promise<string>;
|
60 | /**
|
61 | * Gets the associated list item for this folder, loading the default properties
|
62 | */
|
63 | getItem<T>(...selects: string[]): Promise<IItem & T>;
|
64 | /**
|
65 | * Moves the file by path to the specified destination url.
|
66 | * Also works with different site collections.
|
67 | *
|
68 | * @param destUrl The absolute url or server relative url of the destination file path to move to.
|
69 | * @param shouldOverWrite Should a file with the same name in the same location be overwritten?
|
70 | * @param options Allows you to supply the full set of options controlling the move behavior
|
71 | */
|
72 | moveByPath(destUrl: string, options: Partial<Omit<IMoveCopyOptions, "ResetAuthorAndCreatedOnCopy">>): Promise<IFolder>;
|
73 | /**
|
74 | * Moves the file by path to the specified destination url.
|
75 | * Also works with different site collections.
|
76 | *
|
77 | * @param destUrl The absolute url or server relative url of the destination file path to move to.
|
78 | * @param keepBoth Keep both if file with the same name in the same location already exists? Only relevant when shouldOverWrite is set to false.
|
79 | */
|
80 | moveByPath(destUrl: string, KeepBoth?: boolean): Promise<IFolder>;
|
81 | /**
|
82 | * Moves the folder by path to the specified destination url.
|
83 | * Also works with different site collections.
|
84 | *
|
85 | * @param destUrl The absolute url or server relative url of the destination folder path to move to.
|
86 | * @param shouldOverWrite Should a folder with the same name in the same location be overwritten?
|
87 | * @param options Allows you to supply the full set of options controlling the copy behavior
|
88 | */
|
89 | copyByPath(destUrl: string, options: Partial<Omit<IMoveCopyOptions, "RetainEditorAndModifiedOnMove">>): Promise<IFolder>;
|
90 | /**
|
91 | * Copies a folder by path to destination path
|
92 | * Also works with different site collections.
|
93 | *
|
94 | * @param destUrl Absolute or relative URL of the destination path
|
95 | * @param keepBoth Keep both if folder with the same name in the same location already exists?
|
96 | */
|
97 | copyByPath(destUrl: string, KeepBoth?: boolean): Promise<IFolder>;
|
98 | /**
|
99 | * Deletes the folder object with options.
|
100 | *
|
101 | * @param parameters Specifies the options to use when deleting a folder.
|
102 | */
|
103 | deleteWithParams(parameters: Partial<IFolderDeleteParams>): Promise<void>;
|
104 | /**
|
105 | * Create the subfolder inside the current folder, as specified by the leafPath
|
106 | *
|
107 | * @param leafPath leafName of the new folder
|
108 | */
|
109 | addSubFolderUsingPath(leafPath: string): Promise<IFolder>;
|
110 | /**
|
111 | * Gets the parent information for this folder's list and web
|
112 | */
|
113 | getParentInfos(): Promise<IFolderParentInfos>;
|
114 | /**
|
115 | * Implementation of folder move/copy
|
116 | *
|
117 | * @param destUrl The server relative path to which the folder will be copied/moved
|
118 | * @param options Any options
|
119 | * @param methodName The method to call
|
120 | * @returns An IFolder representing the moved or copied folder
|
121 | */
|
122 | protected moveCopyImpl(destUrl: string, options: Partial<IMoveCopyOptions>, methodName: "MoveFolderByPath" | "CopyFolderByPath"): Promise<IFolder>;
|
123 | }
|
124 | export interface IFolder extends _Folder, IDeleteableWithETag {
|
125 | }
|
126 | export declare const Folder: import("../spqueryable.js").ISPInvokableFactory<IFolder>;
|
127 | /**
|
128 | * Creates an IFolder instance given a base object and a server relative path
|
129 | *
|
130 | * @param base Valid SPQueryable from which the observers will be used and the web url extracted
|
131 | * @param serverRelativePath The server relative url to the folder (ex: '/sites/dev/documents/folder3')
|
132 | * @returns IFolder instance referencing the folder described by the supplied parameters
|
133 | */
|
134 | export declare function folderFromServerRelativePath(base: ISPQueryable, serverRelativePath: string): IFolder;
|
135 | /**
|
136 | * Creates an IFolder instance given a base object and an absolute path
|
137 | *
|
138 | * @param base Valid SPQueryable from which the observers will be used
|
139 | * @param serverRelativePath The absolute url to the folder (ex: 'https://tenant.sharepoint.com/sites/dev/documents/folder/')
|
140 | * @returns IFolder instance referencing the folder described by the supplied parameters
|
141 | */
|
142 | export declare function folderFromAbsolutePath(base: ISPQueryable, absoluteFolderPath: string): Promise<IFolder>;
|
143 | /**
|
144 | * Creates an IFolder intance given a base object and either an absolute or server relative path to a folder
|
145 | *
|
146 | * @param base Valid SPQueryable from which the observers will be used
|
147 | * @param serverRelativePath server relative or absolute url to the file (ex: 'https://tenant.sharepoint.com/sites/dev/documents/folder' or '/sites/dev/documents/folder')
|
148 | * @returns IFile instance referencing the file described by the supplied parameters
|
149 | */
|
150 | export declare function folderFromPath(base: ISPQueryable, path: string): Promise<IFolder>;
|
151 | /**
|
152 | * Describes result of adding a folder
|
153 | */
|
154 | export interface IFolderAddResult {
|
155 | /**
|
156 | * A folder's instance
|
157 | */
|
158 | folder: IFolder;
|
159 | /**
|
160 | * Additional data from the server
|
161 | */
|
162 | data: any;
|
163 | }
|
164 | /**
|
165 | * Describes result of updating a folder
|
166 | */
|
167 | export interface IFolderUpdateResult {
|
168 | /**
|
169 | * A folder's instance
|
170 | */
|
171 | folder: IFolder;
|
172 | /**
|
173 | * Additional data from the server
|
174 | */
|
175 | data: any;
|
176 | }
|
177 | export interface IFolderInfo {
|
178 | readonly "odata.id": string;
|
179 | Exists: boolean;
|
180 | IsWOPIEnabled: boolean;
|
181 | ItemCount: number;
|
182 | Name: string;
|
183 | ProgID: string | null;
|
184 | ServerRelativeUrl: string;
|
185 | ServerRelativePath: IResourcePath;
|
186 | TimeCreated: string;
|
187 | TimeLastModified: string;
|
188 | UniqueId: string;
|
189 | WelcomePage: string;
|
190 | ContentTypeOrder: string[];
|
191 | UniqueContentTypeOrder: string[];
|
192 | StorageMetrics?: IStorageMetrics;
|
193 | }
|
194 | export interface IStorageMetrics {
|
195 | LastModified: string;
|
196 | TotalFileCount: number;
|
197 | TotalFileStreamSize: number;
|
198 | TotalSize: number;
|
199 | }
|
200 | export interface IFolderDeleteParams {
|
201 | /**
|
202 | * If true, delete or recycle a folder iff all files have
|
203 | * LockType values SPLockType.Shared or SPLockType.None.
|
204 | * When false, delete or recycle the folder if all files
|
205 | * have the LockType value SPLockType.None. See the <see cref="SPFile.SPLockType"/> enum.
|
206 | */
|
207 | BypassSharedLock: boolean;
|
208 | /**
|
209 | * Gets or sets a string value that allows SPFolder delete
|
210 | * and recycle methods to target a folder with a matching value
|
211 | */
|
212 | ETagMatch: string;
|
213 | /**
|
214 | * Gets or sets a Boolean that controls the way in which folders
|
215 | * are deleted. If set to true, only empty folders will be deleted.
|
216 | * If set to false, folders that are not empty may be deleted.
|
217 | */
|
218 | DeleteIfEmpty: boolean;
|
219 | }
|
220 | export interface IFolderParentInfos {
|
221 | Folder: {
|
222 | ServerRelativeUrl: string;
|
223 | };
|
224 | ParentList: {
|
225 | Id: string;
|
226 | RootFolderServerRelativePath: IResourcePath;
|
227 | RootFolderServerRelativeUrl: string;
|
228 | RootFolderUniqueId: string;
|
229 | };
|
230 | ParentWeb: {
|
231 | Id: string;
|
232 | ServerRelativePath: IResourcePath;
|
233 | ServerRelativeUrl: string;
|
234 | Url: string;
|
235 | };
|
236 | }
|
237 | //# sourceMappingURL=types.d.ts.map |
\ | No newline at end of file |