UNPKG

spws

Version:

SharePoint Web Services Wrapper

94 lines (93 loc) 5.47 kB
import { Item, KnownKeys, SpwsBatchResponse, SpwsResponse } from "../../../types"; interface Operation<T> extends SpwsBatchResponse { data: (KnownKeys<Item> & T)[]; } export type GetListItemsOptions<T> = { /** The SharePoint webURL */ webURL?: string; /** A callback function that is used to the parse an item after it as been * parsed by the default parser but before it is returned to the array of items. */ parseItem?: (item: Item & T) => Item & T; /** * If true, requests are batched to not exceed the list view threshold. * Batch sizes are automatically assigned to match the list view threshold limit. */ batch?: boolean; /** A callback function that is called before the batches are sent. */ onBatchStart?: (total: number) => void; /** A callback function that is called after each batch is sent. */ onBatchStep?: (params: { index: number; res: SpwsResponse & { data: (Item & T)[]; }; total: number; }) => void; /** * A string that contains the GUID for the view surrounded by curly braces ({}), * which determines the view to use for the default view attributes represented by the query, viewFields, and rowLimit parameters. * If this parameter contains an empty string, the default view is used. * If the view GUID is supplied, the value of the query, viewFields, or rowLimit parameter overrides the * equivalent setting within the view. * For example, if the view specified by the viewFields parameter has a row limit of 100 rows but the rowLimit * parameter contains 1000, then 1,000 rows are returned in the response. */ viewName?: string; /** A Query xml string containing the query that determines which records are returned and in what order */ query?: string; /** An array of strings that specifies which fields to return in the query and in what order */ fields?: string[]; /** rowLimit */ rowLimit?: number; /** An XML fragment in the following form that contains separate nodes for the various properties of the SPQuery object */ queryOptions?: { /** Specifies the format in which dates are returned. * If True, dates returned are in Coordinated Universal Time (UTC) format. * If False, dates returned are in [ISO-8601] format. */ DatesInUtc?: boolean; /** If set to True, specifies that fields in list items that are lookup fields * to the user information list are returned as if they were multi-value lookups, * including "Name", "EMail", "SipAddress", and "Title" fields from the user * information list for the looked up item. These values are separated by ";#", * and any commas in the lookup field name are encoded as ",,". */ ExpandUserField?: boolean; /** If set to True, the server MUST remove all characters that have an * ASCII valuein the range 0-31,other than 9, 10, or 13, in the field values * of the list items returned. */ RemoveInvalidXmlCharacters?: boolean; /** Specifies a URL used to filter document library items for items in the specified folder.*/ Folder?: string; /** Specifies that required fields and fields used by specified calculated fields * be returned in addition to the fields specified by the viewFields parameter, if set to True */ IncludeMandatoryColumns?: boolean; /** If it is True, the EffectivePermMask attribute is returned when the permissions of a * given row differ from the base permissions of the list */ IncludePermissions?: boolean; /** If set to True, specifies that the value returned for the Attachments field is a list of full URLs * separated by the delimiter ";#". */ IncludeAttachmentUrls?: boolean; /** This MUST be used only in conjunction with IncludeAttachmentUrls. * Specifying True causes the GUID and version number to be returned for attachments that * can be used for conflict detection on update. */ IncludeAttachmentVersion?: boolean; /** Specifies how to return lookup values when a list item that is the target of a lookup * is in an incomplete or draft state. * When False, the data returned will include the current lookup field values * When True, the query returns published lookup field values, if present, regardless of * whether the list item that is the target of the lookup is in an incomplete or draft state */ OptimizeLookups?: boolean; }; }; /** * Adds the user to the specified group * @param listName A string that contains either the display name or the GUID for the list * @link https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-services/ms772599(v=office.12) * @link https://docs.microsoft.com/en-us/openspecs/sharepoint_protocols/ms-listsws/fa650bde-c79b-4a2a-bb5d-c43e74166322?redirectedfrom=MSDN * @example * ``` * const res = await getListItems("Task Tracker") * ``` */ declare const getListItems: <T extends object = {}>(listName: string, { onBatchStart, onBatchStep, parseItem, batch, viewName, fields, query, webURL, queryOptions, rowLimit, }?: GetListItemsOptions<T>) => Promise<Operation<T>>; export default getListItems;