UNPKG

spws

Version:

SharePoint Web Services Wrapper

76 lines (75 loc) 2.95 kB
import { SpwsResponse, FieldType, Field as SpwsField } from "../../types"; interface Operation extends SpwsResponse { data: undefined; } export type ListProperties = { AllowMultiResponses?: boolean; Description?: string; Direction?: "LTR" | "RTL" | "None"; EnableAssignedToEmail?: boolean; EnableAttachments?: boolean; EnableModeration?: boolean; EnableVersioning?: boolean; Hidden?: boolean; MultipleDataList?: boolean; Ordered?: boolean; ShowUser?: boolean; Title?: string; }; export type Field = { StaticName: string; DisplayName: string; Type: FieldType; } & Pick<SpwsField, "AllowDeletion" | "Choices" | "Default" | "DefaultFormula" | "DefaultFormulaValue" | "Description" | "EnforceUniqueValues" | "FillInChoice" | "Filterable" | "Format" | "Formula" | "Formula" | "Hidden" | "Indexed" | "LinkToItem" | "ListItemMenu" | "Max" | "MaxLength" | "Min" | "Mult" | "NumLines" | "Percentage" | "Required" | "ResultType" | "RichText" | "RichTextMode" | "Sealed" | "ShowField" | "ShowInDisplayForm" | "ShowInEditForm" | "ShowInFileDlg" | "ShowInNewForm" | "ShowInVersionHistory" | "ShowInViewForms" | "Sortable" | "UnlimitedLengthInDocumentLibrary" | "UserSelectionMode" | "UserSelectionScope" | "Validation" | "Version">; export interface NewField extends Field { StaticName: string; DisplayName: string; Type: FieldType; } export interface UpdateField extends Field { StaticName: string; Type: FieldType; DisplayName: string; } /** An array of static names */ type DeleteField = string; type UpdateListParams = { /** A string that contains the Display Name or GUID for the list. */ listName: string; /** The SharePoint webURL */ webURL?: string; /** List Properties */ listProperties?: ListProperties; /** New Fields */ newFields?: NewField[]; /** Update Fields */ updateFields?: UpdateField[]; /** Delete Fields */ deleteFields?: DeleteField[]; }; /** * Updates a list based on the specified field definitions and list properties. * * @link https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-services/ms774660(v=office.12) * @link https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ms437580(v=office.14) * @example * ``` * // Update list * const res = await updateList({ * listName: "Announcements", * webURL: "/sites/other", * listProperties: { Description: "Demo description" }, * deleteFields: ["Age"], * newFields: [ * { * StaticName: "DateOfBirth", * DisplayName: "Date of Birth", * Type: "DateTime", * Format: "DateOnly", * }, * ], *}); * ``` */ declare const updateList: ({ listName, webURL, listProperties, deleteFields, newFields, updateFields, }: UpdateListParams) => Promise<Operation>; export default updateList;