UNPKG

16.2 kBTypeScriptView Raw
1import { _SPCollection, _SPInstance, ISPQueryable, ISPCollection, IDeleteableWithETag } from "../spqueryable.js";
2import { IChangeQuery } from "../types.js";
3import { IBasePermissions } from "../security/types.js";
4import { IFieldInfo } from "../fields/types.js";
5import { IFormInfo } from "../forms/types.js";
6import { IFolderInfo } from "../folders/types.js";
7import { IViewInfo } from "../views/types.js";
8import { IUserCustomActionInfo } from "../user-custom-actions/types.js";
9import { IResourcePath } from "../utils/to-resource-path.js";
10export declare class _Lists extends _SPCollection<IListInfo[]> {
11 /**
12 * Gets a list from the collection by guid id
13 *
14 * @param id The Id of the list (GUID)
15 */
16 getById(id: string): IList;
17 /**
18 * Gets a list from the collection by title
19 *
20 * @param title The title of the list
21 */
22 getByTitle(title: string): IList;
23 /**
24 * Adds a new list to the collection
25 *
26 * @param title The new list's title
27 * @param description The new list's description
28 * @param template The list template value
29 * @param enableContentTypes If true content types will be allowed and enabled, otherwise they will be disallowed and not enabled
30 * @param additionalSettings Will be passed as part of the list creation body
31 */
32 add(title: string, desc?: string, template?: number, enableContentTypes?: boolean, additionalSettings?: Partial<IListInfo>): Promise<IListAddResult>;
33 /**
34 * Ensures that the specified list exists in the collection (note: this method not supported for batching)
35 *
36 * @param title The new list's title
37 * @param desc The new list's description
38 * @param template The list template value
39 * @param enableContentTypes If true content types will be allowed and enabled, otherwise they will be disallowed and not enabled
40 * @param additionalSettings Will be passed as part of the list creation body or used to update an existing list
41 */
42 ensure(title: string, desc?: string, template?: number, enableContentTypes?: boolean, additionalSettings?: Partial<IListInfo>): Promise<IListEnsureResult>;
43 /**
44 * Gets a list that is the default asset location for images or other files, which the users upload to their wiki pages.
45 */
46 ensureSiteAssetsLibrary(): Promise<IList>;
47 /**
48 * Gets a list that is the default location for wiki pages.
49 */
50 ensureSitePagesLibrary(): Promise<IList>;
51}
52export interface ILists extends _Lists {
53}
54export declare const Lists: import("../spqueryable.js").ISPInvokableFactory<ILists>;
55export declare class _List extends _SPInstance<IListInfo> {
56 delete: (this: ISPQueryable<any>, eTag?: string) => Promise<void>;
57 /**
58 * Gets the effective base permissions of this list
59 *
60 */
61 get effectiveBasePermissions(): ISPQueryable;
62 /**
63 * Gets the event receivers attached to this list
64 *
65 */
66 get eventReceivers(): ISPCollection;
67 /**
68 * Gets the related fields of this list
69 *
70 */
71 get relatedFields(): ISPQueryable;
72 /**
73 * Gets the IRM settings for this list
74 *
75 */
76 get informationRightsManagementSettings(): ISPQueryable;
77 /**
78 * Updates this list intance with the supplied properties
79 *
80 * @param properties A plain object hash of values to update for the list
81 * @param eTag Value used in the IF-Match header, by default "*"
82 */
83 update(properties: Partial<IListInfo>, eTag?: string): Promise<IListUpdateResult>;
84 /**
85 * Returns the collection of changes from the change log that have occurred within the list, based on the specified query.
86 * @param query A query that is performed against the change log.
87 */
88 getChanges(query: IChangeQuery): Promise<any>;
89 /**
90 * Returns the collection of items in the list based on the provided CamlQuery
91 * @param query A query that is performed against the list
92 * @param expands An expanded array of n items that contains fields to expand in the CamlQuery
93 */
94 getItemsByCAMLQuery(query: ICamlQuery, ...expands: string[]): Promise<any>;
95 /**
96 * See: https://msdn.microsoft.com/en-us/library/office/dn292554.aspx
97 * @param query An object that defines the change log item query
98 */
99 getListItemChangesSinceToken(query: IChangeLogItemQuery): Promise<string>;
100 /**
101 * Moves the list to the Recycle Bin and returns the identifier of the new Recycle Bin item.
102 */
103 recycle(): Promise<string>;
104 /**
105 * Renders list data based on the view xml provided
106 * @param viewXml A string object representing a view xml
107 */
108 renderListData(viewXml: string): Promise<IRenderListData>;
109 /**
110 * Returns the data for the specified query view
111 *
112 * @param parameters The parameters to be used to render list data as JSON string.
113 * @param overrideParams The parameters that are used to override and extend the regular SPRenderListDataParameters.
114 * @param query Allows setting of query parameters
115 */
116 renderListDataAsStream(parameters: IRenderListDataParameters, overrideParameters?: any, query?: Map<string, string>): Promise<IRenderListDataAsStreamResult>;
117 /**
118 * Gets the field values and field schema attributes for a list item.
119 * @param itemId Item id of the item to render form data for
120 * @param formId The id of the form
121 * @param mode Enum representing the control mode of the form (Display, Edit, New)
122 */
123 renderListFormData(itemId: number, formId: string, mode: ControlMode): Promise<IListFormData>;
124 /**
125 * Reserves a list item ID for idempotent list item creation.
126 */
127 reserveListItemId(): Promise<number>;
128 /**
129 * Creates an item using path (in a folder), validates and sets its field values.
130 *
131 * @param formValues The fields to change and their new values.
132 * @param decodedUrl Path decoded url; folder's server relative path.
133 * @param bNewDocumentUpdate true if the list item is a document being updated after upload; otherwise false.
134 * @param checkInComment Optional check in comment.
135 * @param additionalProps Optional set of additional properties LeafName new document file name,
136 */
137 addValidateUpdateItemUsingPath(formValues: IListItemFormUpdateValue[], decodedUrl: string, bNewDocumentUpdate?: boolean, checkInComment?: string, additionalProps?: {
138 /**
139 * If creating a document or folder, the name
140 */
141 leafName?: string;
142 /**
143 * 0: File, 1: Folder, 2: Web
144 */
145 objectType?: 0 | 1 | 2;
146 }): Promise<IListItemFormUpdateValue[]>;
147 /**
148 * Gets the parent information for this item's list and web
149 */
150 getParentInfos(): Promise<IListParentInfos>;
151}
152export interface IList extends _List, IDeleteableWithETag {
153}
154export declare const List: import("../spqueryable.js").ISPInvokableFactory<IList>;
155/**
156 * Represents the output of the add method
157 */
158export interface IListAddResult {
159 list: IList;
160 data: IListInfo;
161}
162/**
163 * Represents the output of the update method
164 */
165export interface IListUpdateResult {
166 list: IList;
167 data: IListInfo;
168}
169/**
170 * Represents the output of the ensure method
171 */
172export interface IListEnsureResult {
173 list: IList;
174 created: boolean;
175 data: IListInfo;
176}
177/**
178 * Specifies a Collaborative Application Markup Language (CAML) query on a list or joined lists.
179 */
180export interface ICamlQuery {
181 /**
182 * Gets or sets a value that indicates whether the query returns dates in Coordinated Universal Time (UTC) format.
183 */
184 DatesInUtc?: boolean;
185 /**
186 * Gets or sets a value that specifies the server relative URL of a list folder from which results will be returned.
187 */
188 FolderServerRelativeUrl?: string;
189 /**
190 * Gets or sets a value that specifies the information required to get the next page of data for the list view.
191 */
192 ListItemCollectionPosition?: IListItemCollectionPosition;
193 /**
194 * Gets or sets value that specifies the XML schema that defines the list view.
195 */
196 ViewXml?: string;
197}
198/**
199 * Specifies the information required to get the next page of data for a list view.
200 */
201export interface IListItemCollectionPosition {
202 /**
203 * Gets or sets a value that specifies information, as name-value pairs, required to get the next page of data for a list view.
204 */
205 PagingInfo: string;
206}
207/**
208 * Represents the input parameter of the GetListItemChangesSinceToken method.
209 */
210export interface IChangeLogItemQuery {
211 /**
212 * The change token for the request.
213 */
214 ChangeToken?: string;
215 /**
216 * The XML element that defines custom filtering for the query.
217 */
218 Contains?: string;
219 /**
220 * The records from the list to return and their return order.
221 */
222 Query?: string;
223 /**
224 * The options for modifying the query.
225 */
226 QueryOptions?: string;
227 /**
228 * RowLimit
229 */
230 RowLimit?: string;
231 /**
232 * The names of the fields to include in the query result.
233 */
234 ViewFields?: string;
235 /**
236 * The GUID of the view.
237 */
238 ViewName?: string;
239}
240/**
241 * Represents the output parameter of the renderListFormData method.
242 */
243export interface IListFormData {
244 ContentType?: string;
245 Title?: string;
246 Author?: string;
247 Editor?: string;
248 Created?: Date;
249 Modified: Date;
250 Attachments?: any;
251 ListSchema?: any;
252 FormControlMode?: number;
253 FieldControlModes?: {
254 Title?: number;
255 Author?: number;
256 Editor?: number;
257 Created?: number;
258 Modified?: number;
259 Attachments?: number;
260 };
261 WebAttributes?: {
262 WebUrl?: string;
263 EffectivePresenceEnabled?: boolean;
264 AllowScriptableWebParts?: boolean;
265 PermissionCustomizePages?: boolean;
266 LCID?: number;
267 CurrentUserId?: number;
268 };
269 ItemAttributes?: {
270 Id?: number;
271 FsObjType?: number;
272 ExternalListItem?: boolean;
273 Url?: string;
274 EffectiveBasePermissionsLow?: number;
275 EffectiveBasePermissionsHigh?: number;
276 };
277 ListAttributes?: {
278 Id?: string;
279 BaseType?: number;
280 Direction?: string;
281 ListTemplateType?: number;
282 DefaultItemOpen?: number;
283 EnableVersioning?: boolean;
284 };
285 CSRCustomLayout?: boolean;
286 PostBackRequired?: boolean;
287 PreviousPostBackHandled?: boolean;
288 UploadMode?: boolean;
289 SubmitButtonID?: string;
290 ItemContentTypeName?: string;
291 ItemContentTypeId?: string;
292 JSLinks?: string;
293}
294/**
295 * Enum representing the options of the RenderOptions property on IRenderListDataParameters interface
296 */
297export declare enum RenderListDataOptions {
298 None = 0,
299 ContextInfo = 1,
300 ListData = 2,
301 ListSchema = 4,
302 MenuView = 8,
303 ListContentType = 16,
304 FileSystemItemId = 32,
305 ClientFormSchema = 64,
306 QuickLaunch = 128,
307 Spotlight = 256,
308 Visualization = 512,
309 ViewMetadata = 1024,
310 DisableAutoHyperlink = 2048,
311 EnableMediaTAUrls = 4096,
312 ParentInfo = 8192,
313 PageContextInfo = 16384,
314 ClientSideComponentManifest = 32768
315}
316/**
317 * Represents the parameters to be used to render list data as JSON string in the RenderListDataAsStream method of IList.
318 */
319export interface IRenderListDataParameters {
320 AddRequiredFields?: boolean;
321 AllowMultipleValueFilterForTaxonomyFields?: boolean;
322 AudienceTarget?: boolean;
323 DatesInUtc?: boolean;
324 DeferredRender?: boolean;
325 ExpandGroups?: boolean;
326 FirstGroupOnly?: boolean;
327 FolderServerRelativeUrl?: string;
328 ImageFieldsToTryRewriteToCdnUrls?: string;
329 MergeDefaultView?: boolean;
330 OriginalDate?: boolean;
331 OverrideViewXml?: string;
332 Paging?: string;
333 ReplaceGroup?: boolean;
334 RenderOptions?: RenderListDataOptions[] | number;
335 ViewXml?: string;
336}
337/**
338 * Represents properties of a list item field and its value.
339 */
340export interface IListItemFormUpdateValue {
341 /**
342 * The error message result after validating the value for the field.
343 */
344 ErrorMessage?: string;
345 /**
346 * The internal name of the field.
347 */
348 FieldName?: string;
349 /**
350 * The value of the field, in string format.
351 */
352 FieldValue?: string;
353 /**
354 * Indicates whether there was an error result after validating the value for the field.
355 */
356 HasException?: boolean;
357}
358/**
359 * Represents the output parameter of the renderListData method.
360 */
361export interface IRenderListData {
362 Row: any[];
363 FirstRow: number;
364 FolderPermissions: string;
365 LastRow: number;
366 FilterLink: string;
367 ForceNoHierarchy: string;
368 HierarchyHasIndention: string;
369}
370/**
371 * Determines the display mode of the given control or view
372 */
373export declare enum ControlMode {
374 Display = 1,
375 Edit = 2,
376 New = 3
377}
378export interface IListInfo {
379 AllowContentTypes: boolean;
380 AllowDeletion: boolean;
381 BaseTemplate: number;
382 BaseType: any;
383 BrowserFileHandling: any;
384 ContentTypes: any[];
385 ContentTypesEnabled: boolean;
386 CrawlNonDefaultViews: boolean;
387 CreatablesInfo: any;
388 Created: string;
389 CurrentChangeToken: any;
390 CustomActionElements: any[];
391 DataSource: any;
392 DefaultContentApprovalWorkflowId: string;
393 DefaultDisplayFormUrl: string;
394 DefaultEditFormUrl: string;
395 DefaultNewFormUrl: string;
396 DefaultView: any;
397 DefaultViewPath: any;
398 DefaultViewUrl: string;
399 Description: string;
400 DescriptionResource: any;
401 Direction: string;
402 DocumentTemplateUrl: string;
403 DraftVersionVisibility: any;
404 EffectiveBasePermissions: IBasePermissions;
405 EffectiveBasePermissionsForUI: IBasePermissions;
406 EnableAssignToEmail: boolean;
407 EnableAttachments: boolean;
408 EnableFolderCreation: boolean;
409 EnableMinorVersions: boolean;
410 EnableModeration: boolean;
411 EnableRequestSignOff: boolean;
412 EnableVersioning: boolean;
413 EntityTypeName: string;
414 EventReceivers: any[];
415 ExcludeFromOfflineClient: boolean;
416 ExemptFromBlockDownloadOfNonViewableFiles: boolean;
417 Fields: Partial<IFieldInfo>[];
418 FileSavePostProcessingEnabled: boolean;
419 ForceCheckout: boolean;
420 Forms: IFormInfo[];
421 HasExternalDataSource: boolean;
422 Hidden: boolean;
423 Id: string;
424 ImagePath: {
425 DecodedUrl: string;
426 };
427 ImageUrl: string;
428 InformationRightsManagementSettings: any[];
429 IrmEnabled: boolean;
430 IrmExpire: boolean;
431 IrmReject: boolean;
432 IsApplicationList: boolean;
433 IsCatalog: boolean;
434 IsPrivate: boolean;
435 IsSiteAssetsLibrary: boolean;
436 IsSystemList: boolean;
437 ItemCount: number;
438 LastItemDeletedDate: string;
439 LastItemModifiedDate: string;
440 LastItemUserModifiedDate: string;
441 ListExperienceOptions: number;
442 ListItemEntityTypeFullName: string;
443 MajorVersionLimit: number;
444 MajorWithMinorVersionsLimit: number;
445 MultipleDataList: boolean;
446 NoCrawl: boolean;
447 OnQuickLaunch: boolean;
448 ParentWebPath: {
449 DecodedUrl: string;
450 };
451 ParentWebUrl: string;
452 ParserDisabled: boolean;
453 ReadSecurity: number;
454 RootFolder: IFolderInfo;
455 SchemaXml: string;
456 ServerTemplateCanCreateFolders: boolean;
457 TemplateFeatureId: string;
458 Title: string;
459 UserCustomActions: IUserCustomActionInfo[];
460 ValidationFormula: string;
461 ValidationMessage: string;
462 Views: IViewInfo[];
463 WorkflowAssociations: any[];
464 WriteSecurity: number;
465}
466export interface IRenderListDataAsStreamResult {
467 CurrentFolderSpItemUrl: string;
468 FilterLink: string;
469 FirstRow: number;
470 FolderPermissions: string;
471 ForceNoHierarchy: string;
472 HierarchyHasIndention: string;
473 LastRow: number;
474 NextHref?: string;
475 Row: any[];
476 RowLimit: number;
477}
478export interface IListParentInfos {
479 List: {
480 Id: string;
481 RootFolderServerRelativePath: IResourcePath;
482 RootFolderServerRelativeUrl: string;
483 RootFolderUniqueId: string;
484 };
485 ParentWeb: {
486 Id: string;
487 ServerRelativePath: IResourcePath;
488 ServerRelativeUrl: string;
489 Url: string;
490 };
491}
492//# sourceMappingURL=types.d.ts.map
\No newline at end of file