spws
Version:
SharePoint Web Services Wrapper
29 lines (28 loc) • 1.52 kB
TypeScript
import { SpwsResponse } from "../../types";
type SaveWebPartProps = {
pageURL: string;
storage: "None" | "Personal" | "Shared";
storageKey: string;
webPartXml: string;
allowTypeChange?: boolean;
webURL?: string;
};
export interface Operation extends SpwsResponse {
data: {
success: boolean;
};
}
/**
* @description Saves the Web Part configuration for a specified Web Part on a SharePoint page.
* This function sends the updated XML configuration for a given Web Part and applies it to the page.
* It uses the `SaveWebPart` SOAP operation provided by the SharePoint WebPartPages web service.
*
* @param {string} pageURL - The relative URL of the page that contains the Web Part (e.g., "/sites/mysite/pages/sample.aspx").
* @param {string} storageKey - A unique identifier (GUID) of the Web Part to be saved.
* @param {string} storage - Specifies the storage scope: "None", "Personal", or "Shared". Defaults to "Shared".
* @param {string} webPartXml - The XML representation of the Web Part configuration.
* @param {string} [webURL] - Optional: The base URL of the SharePoint site. If not provided, defaults to the value in `defaults.webURL`.
* @returns {Promise<Operation>} - A promise that resolves to an Operation object, including a success flag if the Web Part was saved successfully.
*/
declare const saveWebPart: ({ pageURL, storageKey, storage, webPartXml, webURL, }: SaveWebPartProps) => Promise<Operation>;
export default saveWebPart;