UNPKG

20.3 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 /**
305 * The returned list will have a FileSystemItemId field on each item if possible.
306 */
307 FileSystemItemId = 32,
308 /**
309 * Returns the client form schema to add and edit items.
310 */
311 ClientFormSchema = 64,
312 /**
313 * Returns QuickLaunch navigation nodes.
314 */
315 QuickLaunch = 128,
316 /**
317 * Returns Spotlight rendering information.
318 */
319 Spotlight = 256,
320 /**
321 * Returns Visualization rendering information.
322 */
323 Visualization = 512,
324 /**
325 * Returns view XML and other information about the current view.
326 */
327 ViewMetadata = 1024,
328 /**
329 * Prevents AutoHyperlink from being run on text fields in this query.
330 */
331 DisableAutoHyperlink = 2048,
332 /**
333 * Enables urls pointing to Media TA service, such as .thumbnailUrl, .videoManifestUrl, .pdfConversionUrls.
334 */
335 EnableMediaTAUrls = 4096,
336 /**
337 * Return Parant folder information.
338 */
339 ParentInfo = 8192,
340 /**
341 * Return Page context info for the current list being rendered.
342 */
343 PageContextInfo = 16384,
344 /**
345 * Return client-side component manifest information associated with the list.
346 */
347 ClientSideComponentManifest = 32768,
348 /**
349 * Return all content-types available on the list.
350 */
351 ListAvailableContentTypes = 65536,
352 /**
353 * Return the order of items in the new-item menu.
354 */
355 FolderContentTypeOrder = 131072,
356 /**
357 * Return information to initialize Grid for quick edit.
358 */
359 GridInitInfo = 262144,
360 /**
361 * Indicator if the vroom API of the SPItemUrl returned in MediaTAUrlGenerator should use site url as host.
362 */
363 SiteUrlAsMediaTASPItemHost = 524288,
364 /**
365 * Return the files representing mount points in the list.
366 */
367 AddToOneDrive = 1048576,
368 /**
369 * Return SPFX CustomAction.
370 */
371 SPFXCustomActions = 2097152,
372 /**
373 * Do not return non-SPFX CustomAction.
374 */
375 CustomActions = 4194304
376}
377/**
378 * Represents the parameters to be used to render list data as JSON string in the RenderListDataAsStream method of IList.
379 */
380export interface IRenderListDataParameters {
381 /**
382 * Gets or sets a value indicating whether to add all fields to the return
383 */
384 AddAllFields?: boolean;
385 /**
386 * Gets or sets a value indicating whether to add all fields in all views and contetnt types to the return
387 */
388 AddAllViewFields?: boolean;
389 /**
390 * Gets or sets a value indicating whether to return regional settings as part of listschema
391 */
392 AddRegionalSettings?: boolean;
393 /**
394 * This parameter indicates if we always return required fields.
395 */
396 AddRequiredFields?: boolean;
397 /**
398 * This parameter indicates whether multi value filtering is allowed for taxonomy fields
399 */
400 AllowMultipleValueFilterForTaxonomyFields?: boolean;
401 /**
402 * Gets or sets a value indicating whether to audience target the resulting content
403 */
404 AudienceTarget?: boolean;
405 /**
406 * Specifies if we return DateTime field in UTC or local time
407 */
408 DatesInUtc?: boolean;
409 /**
410 * Specifies if we want to expand the grouping or not
411 */
412 ExpandGroups?: boolean;
413 /**
414 * Gets or sets a value indicating whether to expand user field to return jobtitle etc
415 */
416 ExpandUserField?: boolean;
417 /**
418 * Gets or sets a value indicating whether to filter out folders with ProgId="Team.Channel"
419 */
420 FilterOutChannelFoldersInDefaultDocLib?: boolean;
421 /**
422 * Specifies if we only return first group (regardless of view schema) or not
423 */
424 FirstGroupOnly?: boolean;
425 /**
426 * Specifies the url to the folder from which to return items
427 */
428 FolderServerRelativeUrl?: string;
429 /**
430 * This parameter indicates which fields to try and ReWrite to CDN Urls, The format of this parameter should be a comma seperated list of field names
431 */
432 ImageFieldsToTryRewriteToCdnUrls?: string;
433 MergeDefaultView?: boolean;
434 /**
435 * Gets or sets a value indicating whether we're in Modern List boot code path, in which we don't need to check modern vs classic
436 */
437 ModernListBoot?: boolean;
438 /**
439 * Specifies if we return always DateTime field original value
440 */
441 OriginalDate?: boolean;
442 /**
443 * Specified the override XML to be combined with the View CAML
444 */
445 OverrideViewXml?: string;
446 /**
447 * Specifies the paging information
448 */
449 Paging?: string;
450 /**
451 * Specifies if we want to replace the grouping or not to deal with GroupBy throttling
452 */
453 ReplaceGroup?: boolean;
454 /**
455 * Gets or sets a value indicating whether to add Url fields in JSON format.
456 */
457 RenderURLFieldInJSON?: boolean;
458 /**
459 * Specifies the type of output to return.
460 */
461 RenderOptions?: RenderListDataOptions[] | number;
462 /**
463 * Gets or sets a value indicating whether to not filter out Stub files (0 byte files created for upload).
464 */
465 ShowStubFile?: boolean;
466 /**
467 * Specifies the CAML view XML
468 */
469 ViewXml?: string;
470}
471/**
472 * Represents properties of a list item field and its value.
473 */
474export interface IListItemFormUpdateValue {
475 /**
476 * The error message result after validating the value for the field.
477 */
478 ErrorMessage?: string;
479 /**
480 * The internal name of the field.
481 */
482 FieldName?: string;
483 /**
484 * The value of the field, in string format.
485 */
486 FieldValue?: string;
487 /**
488 * Indicates whether there was an error result after validating the value for the field.
489 */
490 HasException?: boolean;
491}
492/**
493 * Represents the output parameter of the renderListData method.
494 */
495export interface IRenderListData {
496 Row: any[];
497 FirstRow: number;
498 FolderPermissions: string;
499 LastRow: number;
500 FilterLink: string;
501 ForceNoHierarchy: string;
502 HierarchyHasIndention: string;
503}
504/**
505 * Determines the display mode of the given control or view
506 */
507export declare enum ControlMode {
508 Display = 1,
509 Edit = 2,
510 New = 3
511}
512export interface IListInfo {
513 AllowContentTypes: boolean;
514 AllowDeletion: boolean;
515 BaseTemplate: number;
516 BaseType: any;
517 BrowserFileHandling: any;
518 ContentTypes: any[];
519 ContentTypesEnabled: boolean;
520 CrawlNonDefaultViews: boolean;
521 CreatablesInfo: any;
522 Created: string;
523 CurrentChangeToken: any;
524 CustomActionElements: any[];
525 DataSource: any;
526 DefaultContentApprovalWorkflowId: string;
527 DefaultDisplayFormUrl: string;
528 DefaultEditFormUrl: string;
529 DefaultNewFormUrl: string;
530 DefaultView: any;
531 DefaultViewPath: any;
532 DefaultViewUrl: string;
533 Description: string;
534 DescriptionResource: any;
535 Direction: string;
536 DocumentTemplateUrl: string;
537 DraftVersionVisibility: any;
538 EffectiveBasePermissions: IBasePermissions;
539 EffectiveBasePermissionsForUI: IBasePermissions;
540 EnableAssignToEmail: boolean;
541 EnableAttachments: boolean;
542 EnableFolderCreation: boolean;
543 EnableMinorVersions: boolean;
544 EnableModeration: boolean;
545 EnableRequestSignOff: boolean;
546 EnableVersioning: boolean;
547 EntityTypeName: string;
548 EventReceivers: any[];
549 ExcludeFromOfflineClient: boolean;
550 ExemptFromBlockDownloadOfNonViewableFiles: boolean;
551 Fields: Partial<IFieldInfo>[];
552 FileSavePostProcessingEnabled: boolean;
553 ForceCheckout: boolean;
554 Forms: IFormInfo[];
555 HasExternalDataSource: boolean;
556 Hidden: boolean;
557 Id: string;
558 ImagePath: {
559 DecodedUrl: string;
560 };
561 ImageUrl: string;
562 InformationRightsManagementSettings: any[];
563 IrmEnabled: boolean;
564 IrmExpire: boolean;
565 IrmReject: boolean;
566 IsApplicationList: boolean;
567 IsCatalog: boolean;
568 IsPrivate: boolean;
569 IsSiteAssetsLibrary: boolean;
570 IsSystemList: boolean;
571 ItemCount: number;
572 LastItemDeletedDate: string;
573 LastItemModifiedDate: string;
574 LastItemUserModifiedDate: string;
575 ListExperienceOptions: number;
576 ListItemEntityTypeFullName: string;
577 MajorVersionLimit: number;
578 MajorWithMinorVersionsLimit: number;
579 MultipleDataList: boolean;
580 NoCrawl: boolean;
581 OnQuickLaunch: boolean;
582 ParentWebPath: {
583 DecodedUrl: string;
584 };
585 ParentWebUrl: string;
586 ParserDisabled: boolean;
587 ReadSecurity: number;
588 RootFolder: IFolderInfo;
589 SchemaXml: string;
590 ServerTemplateCanCreateFolders: boolean;
591 TemplateFeatureId: string;
592 Title: string;
593 UserCustomActions: IUserCustomActionInfo[];
594 ValidationFormula: string;
595 ValidationMessage: string;
596 Views: IViewInfo[];
597 WorkflowAssociations: any[];
598 WriteSecurity: number;
599}
600export interface IRenderListDataAsStreamResult {
601 CurrentFolderSpItemUrl: string;
602 FilterLink: string;
603 FirstRow: number;
604 FolderPermissions: string;
605 ForceNoHierarchy: string;
606 HierarchyHasIndention: string;
607 LastRow: number;
608 NextHref?: string;
609 Row: any[];
610 RowLimit: number;
611}
612export interface IListParentInfos {
613 List: {
614 Id: string;
615 RootFolderServerRelativePath: IResourcePath;
616 RootFolderServerRelativeUrl: string;
617 RootFolderUniqueId: string;
618 };
619 ParentWeb: {
620 Id: string;
621 ServerRelativePath: IResourcePath;
622 ServerRelativeUrl: string;
623 Url: string;
624 };
625}
626//# sourceMappingURL=types.d.ts.map
\No newline at end of file