diff --git a/dist/pnp-global-shim.d.ts b/dist/pnp-global-shim.d.ts
new file mode 100644
index 00000000..f6bae7e8
--- /dev/null
+++ b/dist/pnp-global-shim.d.ts
@@ -0,0 +1,3 @@
+///
+export * from "pnp";
+export as namespace $pnp;
\ No newline at end of file
diff --git a/dist/pnp.d.ts b/dist/pnp.d.ts
new file mode 100644
index 00000000..02954dad
--- /dev/null
+++ b/dist/pnp.d.ts
@@ -0,0 +1,6190 @@
+declare module "collections/collections" {
+ /**
+ * Interface defining an object with a known property type
+ */
+ export interface TypedHash {
+ [key: string]: T;
+ }
+ /**
+ * Generic dictionary
+ */
+ export class Dictionary {
+ private keys;
+ private values;
+ /**
+ * Creates a new instance of the Dictionary class
+ *
+ * @constructor
+ */
+ constructor(keys?: string[], values?: T[]);
+ /**
+ * Gets a value from the collection using the specified key
+ *
+ * @param key The key whose value we want to return, returns null if the key does not exist
+ */
+ get(key: string): T;
+ /**
+ * Adds the supplied key and value to the dictionary
+ *
+ * @param key The key to add
+ * @param o The value to add
+ */
+ add(key: string, o: T): void;
+ /**
+ * Merges the supplied typed hash into this dictionary instance. Existing values are updated and new ones are created as appropriate.
+ */
+ merge(source: TypedHash | Dictionary): void;
+ /**
+ * Removes a value from the dictionary
+ *
+ * @param key The key of the key/value pair to remove. Returns null if the key was not found.
+ */
+ remove(key: string): T;
+ /**
+ * Returns all the keys currently in the dictionary as an array
+ */
+ getKeys(): string[];
+ /**
+ * Returns all the values currently in the dictionary as an array
+ */
+ getValues(): T[];
+ /**
+ * Clears the current dictionary
+ */
+ clear(): void;
+ /**
+ * Gets a count of the items currently in the dictionary
+ */
+ count(): number;
+ }
+}
+declare module "utils/storage" {
+ /**
+ * A wrapper class to provide a consistent interface to browser based storage
+ *
+ */
+ export class PnPClientStorageWrapper implements PnPClientStore {
+ private store;
+ defaultTimeoutMinutes: number;
+ /**
+ * True if the wrapped storage is available; otherwise, false
+ */
+ enabled: boolean;
+ /**
+ * Creates a new instance of the PnPClientStorageWrapper class
+ *
+ * @constructor
+ */
+ constructor(store: Storage, defaultTimeoutMinutes?: number);
+ /**
+ * Get a value from storage, or null if that value does not exist
+ *
+ * @param key The key whose value we want to retrieve
+ */
+ get(key: string): T;
+ /**
+ * Adds a value to the underlying storage
+ *
+ * @param key The key to use when storing the provided value
+ * @param o The value to store
+ * @param expire Optional, if provided the expiration of the item, otherwise the default is used
+ */
+ put(key: string, o: any, expire?: Date): void;
+ /**
+ * Deletes a value from the underlying storage
+ *
+ * @param key The key of the pair we want to remove from storage
+ */
+ delete(key: string): void;
+ /**
+ * Gets an item from the underlying storage, or adds it if it does not exist using the supplied getter function
+ *
+ * @param key The key to use when storing the provided value
+ * @param getter A function which will upon execution provide the desired value
+ * @param expire Optional, if provided the expiration of the item, otherwise the default is used
+ */
+ getOrPut(key: string, getter: () => Promise, expire?: Date): Promise;
+ /**
+ * Used to determine if the wrapped storage is available currently
+ */
+ private test();
+ /**
+ * Creates the persistable to store
+ */
+ private createPersistable(o, expire?);
+ }
+ /**
+ * Interface which defines the operations provided by a client storage object
+ */
+ export interface PnPClientStore {
+ /**
+ * True if the wrapped storage is available; otherwise, false
+ */
+ enabled: boolean;
+ /**
+ * Get a value from storage, or null if that value does not exist
+ *
+ * @param key The key whose value we want to retrieve
+ */
+ get(key: string): any;
+ /**
+ * Adds a value to the underlying storage
+ *
+ * @param key The key to use when storing the provided value
+ * @param o The value to store
+ * @param expire Optional, if provided the expiration of the item, otherwise the default is used
+ */
+ put(key: string, o: any, expire?: Date): void;
+ /**
+ * Deletes a value from the underlying storage
+ *
+ * @param key The key of the pair we want to remove from storage
+ */
+ delete(key: string): void;
+ /**
+ * Gets an item from the underlying storage, or adds it if it does not exist using the supplied getter function
+ *
+ * @param key The key to use when storing the provided value
+ * @param getter A function which will upon execution provide the desired value
+ * @param expire Optional, if provided the expiration of the item, otherwise the default is used
+ */
+ getOrPut(key: string, getter: Function, expire?: Date): any;
+ }
+ /**
+ * A class that will establish wrappers for both local and session storage
+ */
+ export class PnPClientStorage {
+ /**
+ * Provides access to the local storage of the browser
+ */
+ local: PnPClientStore;
+ /**
+ * Provides access to the session storage of the browser
+ */
+ session: PnPClientStore;
+ /**
+ * Creates a new instance of the PnPClientStorage class
+ *
+ * @constructor
+ */
+ constructor();
+ }
+}
+declare module "sharepoint/caching" {
+ import { ODataParser } from "sharepoint/odata";
+ import { PnPClientStore, PnPClientStorage } from "utils/storage";
+ export interface ICachingOptions {
+ expiration?: Date;
+ storeName?: "session" | "local";
+ key: string;
+ }
+ export class CachingOptions implements ICachingOptions {
+ key: string;
+ protected static storage: PnPClientStorage;
+ expiration: Date;
+ storeName: "session" | "local";
+ constructor(key: string);
+ readonly store: PnPClientStore;
+ }
+ export class CachingParserWrapper implements ODataParser {
+ private _parser;
+ private _cacheOptions;
+ constructor(_parser: ODataParser, _cacheOptions: CachingOptions);
+ parse(response: Response): Promise;
+ }
+}
+declare module "utils/logging" {
+ /**
+ * A set of logging levels
+ *
+ */
+ export enum LogLevel {
+ Verbose = 0,
+ Info = 1,
+ Warning = 2,
+ Error = 3,
+ Off = 99,
+ }
+ /**
+ * Interface that defines a log entry
+ *
+ */
+ export interface LogEntry {
+ /**
+ * The main message to be logged
+ */
+ message: string;
+ /**
+ * The level of information this message represents
+ */
+ level: LogLevel;
+ /**
+ * Any associated data that a given logging listener may choose to log or ignore
+ */
+ data?: any;
+ }
+ /**
+ * Interface that defines a log listner
+ *
+ */
+ export interface LogListener {
+ /**
+ * Any associated data that a given logging listener may choose to log or ignore
+ *
+ * @param entry The information to be logged
+ */
+ log(entry: LogEntry): void;
+ }
+ /**
+ * Class used to subscribe ILogListener and log messages throughout an application
+ *
+ */
+ export class Logger {
+ private static _instance;
+ static activeLogLevel: LogLevel;
+ private static readonly instance;
+ /**
+ * Adds ILogListener instances to the set of subscribed listeners
+ *
+ * @param listeners One or more listeners to subscribe to this log
+ */
+ static subscribe(...listeners: LogListener[]): void;
+ /**
+ * Clears the subscribers collection, returning the collection before modifiction
+ */
+ static clearSubscribers(): LogListener[];
+ /**
+ * Gets the current subscriber count
+ */
+ static readonly count: number;
+ /**
+ * Writes the supplied string to the subscribed listeners
+ *
+ * @param message The message to write
+ * @param level [Optional] if supplied will be used as the level of the entry (Default: LogLevel.Verbose)
+ */
+ static write(message: string, level?: LogLevel): void;
+ /**
+ * Writes the supplied string to the subscribed listeners
+ *
+ * @param json The json object to stringify and write
+ * @param level [Optional] if supplied will be used as the level of the entry (Default: LogLevel.Verbose)
+ */
+ static writeJSON(json: any, level?: LogLevel): void;
+ /**
+ * Logs the supplied entry to the subscribed listeners
+ *
+ * @param entry The message to log
+ */
+ static log(entry: LogEntry): void;
+ /**
+ * Logs performance tracking data for the the execution duration of the supplied function using console.profile
+ *
+ * @param name The name of this profile boundary
+ * @param f The function to execute and track within this performance boundary
+ */
+ static measure(name: string, f: () => T): T;
+ }
+ /**
+ * Implementation of ILogListener which logs to the browser console
+ *
+ */
+ export class ConsoleListener implements LogListener {
+ /**
+ * Any associated data that a given logging listener may choose to log or ignore
+ *
+ * @param entry The information to be logged
+ */
+ log(entry: LogEntry): void;
+ /**
+ * Formats the message
+ *
+ * @param entry The information to format into a string
+ */
+ private format(entry);
+ }
+ /**
+ * Implementation of ILogListener which logs to the supplied function
+ *
+ */
+ export class FunctionListener implements LogListener {
+ private method;
+ /**
+ * Creates a new instance of the FunctionListener class
+ *
+ * @constructor
+ * @param method The method to which any logging data will be passed
+ */
+ constructor(method: (entry: LogEntry) => void);
+ /**
+ * Any associated data that a given logging listener may choose to log or ignore
+ *
+ * @param entry The information to be logged
+ */
+ log(entry: LogEntry): void;
+ }
+}
+declare module "utils/exceptions" {
+ /**
+ * Represents an exception with an HttpClient request
+ *
+ */
+ export class ProcessHttpClientResponseException extends Error {
+ readonly status: number;
+ readonly statusText: string;
+ readonly data: any;
+ constructor(status: number, statusText: string, data: any);
+ }
+ export class NoCacheAvailableException extends Error {
+ constructor(msg?: string);
+ }
+ export class APIUrlException extends Error {
+ constructor(msg?: string);
+ }
+ export class AuthUrlException extends Error {
+ constructor(data: any, msg?: string);
+ }
+ export class NodeFetchClientUnsupportedException extends Error {
+ constructor(msg?: string);
+ }
+ export class SPRequestExecutorUndefinedException extends Error {
+ constructor();
+ }
+ export class MaxCommentLengthException extends Error {
+ constructor(msg?: string);
+ }
+ export class NotSupportedInBatchException extends Error {
+ constructor(operation?: string);
+ }
+ export class ODataIdException extends Error {
+ constructor(data: any, msg?: string);
+ }
+ export class BatchParseException extends Error {
+ constructor(msg: string);
+ }
+ export class AlreadyInBatchException extends Error {
+ constructor(msg?: string);
+ }
+ export class FunctionExpectedException extends Error {
+ constructor(msg?: string);
+ }
+ export class UrlException extends Error {
+ constructor(msg: string);
+ }
+}
+declare module "sharepoint/pipeline" {
+ import { ODataParser, ODataBatch } from "sharepoint/odata";
+ import { ICachingOptions } from "sharepoint/caching";
+ import { FetchOptions } from "net/httpclient";
+ /**
+ * Defines the context for a given request to be processed in the pipeline
+ */
+ export interface RequestContext {
+ batch: ODataBatch;
+ batchDependency: () => void;
+ cachingOptions: ICachingOptions;
+ hasResult?: boolean;
+ isBatched: boolean;
+ isCached: boolean;
+ options: FetchOptions;
+ parser: ODataParser;
+ pipeline?: Array<(c: RequestContext) => Promise>>;
+ requestAbsoluteUrl: string;
+ requestId: string;
+ result?: T;
+ verb: string;
+ }
+ /**
+ * Sets the result on the context
+ */
+ export function setResult(context: RequestContext, value: any): Promise>;
+ /**
+ * Executes the current request context's pipeline
+ *
+ * @param context Current context
+ */
+ export function pipe(context: RequestContext): Promise;
+ /**
+ * decorator factory applied to methods in the pipeline to control behavior
+ */
+ export function requestPipelineMethod(alwaysRun?: boolean): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
+ /**
+ * Contains the methods used within the request pipeline
+ */
+ export class PipelineMethods {
+ /**
+ * Logs the start of the request
+ */
+ static logStart(context: RequestContext): Promise>;
+ /**
+ * Handles caching of the request
+ */
+ static caching(context: RequestContext): Promise>;
+ /**
+ * Sends the request
+ */
+ static send(context: RequestContext): Promise>;
+ /**
+ * Logs the end of the request
+ */
+ static logEnd(context: RequestContext): Promise>;
+ static readonly default: ((context: RequestContext) => Promise>)[];
+ }
+}
+declare module "sharepoint/queryable" {
+ import { Dictionary } from "collections/collections";
+ import { FetchOptions } from "net/httpclient";
+ import { ODataParser, ODataBatch } from "sharepoint/odata";
+ import { ICachingOptions } from "sharepoint/caching";
+ export interface QueryableConstructor {
+ new (baseUrl: string | Queryable, path?: string): T;
+ }
+ /**
+ * Queryable Base Class
+ *
+ */
+ export class Queryable {
+ /**
+ * Tracks the query parts of the url
+ */
+ protected _query: Dictionary;
+ /**
+ * Tracks the batch of which this query may be part
+ */
+ private _batch;
+ /**
+ * Tracks the url as it is built
+ */
+ private _url;
+ /**
+ * Stores the parent url used to create this instance, for recursing back up the tree if needed
+ */
+ private _parentUrl;
+ /**
+ * Explicitly tracks if we are using caching for this request
+ */
+ private _useCaching;
+ /**
+ * Any options that were supplied when caching was enabled
+ */
+ private _cachingOptions;
+ /**
+ * Directly concatonates the supplied string to the current url, not normalizing "/" chars
+ *
+ * @param pathPart The string to concatonate to the url
+ */
+ concat(pathPart: string): this;
+ /**
+ * Appends the given string and normalizes "/" chars
+ *
+ * @param pathPart The string to append
+ */
+ protected append(pathPart: string): void;
+ /**
+ * Blocks a batch call from occuring, MUST be cleared by calling the returned function
+ */
+ protected addBatchDependency(): () => void;
+ /**
+ * Indicates if the current query has a batch associated
+ *
+ */
+ protected readonly hasBatch: boolean;
+ /**
+ * The batch currently associated with this query or null
+ *
+ */
+ protected readonly batch: ODataBatch;
+ /**
+ * Gets the parent url used when creating this instance
+ *
+ */
+ protected readonly parentUrl: string;
+ /**
+ * Provides access to the query builder for this url
+ *
+ */
+ readonly query: Dictionary;
+ /**
+ * Creates a new instance of the Queryable class
+ *
+ * @constructor
+ * @param baseUrl A string or Queryable that should form the base part of the url
+ *
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * Creates a new instance of the supplied factory and extends this into that new instance
+ *
+ * @param factory constructor for the new queryable
+ */
+ as(factory: QueryableConstructor): T;
+ /**
+ * Adds this query to the supplied batch
+ *
+ * @example
+ * ```
+ *
+ * let b = pnp.sp.createBatch();
+ * pnp.sp.web.inBatch(b).get().then(...);
+ * b.execute().then(...)
+ * ```
+ */
+ inBatch(batch: ODataBatch): this;
+ /**
+ * Enables caching for this request
+ *
+ * @param options Defines the options used when caching this request
+ */
+ usingCaching(options?: ICachingOptions): this;
+ /**
+ * Gets the currentl url, made absolute based on the availability of the _spPageContextInfo object
+ *
+ */
+ toUrl(): string;
+ /**
+ * Gets the full url with query information
+ *
+ */
+ toUrlAndQuery(): string;
+ /**
+ * Gets a parent for this instance as specified
+ *
+ * @param factory The contructor for the class to create
+ */
+ protected getParent(factory: QueryableConstructor, baseUrl?: string | Queryable, path?: string, batch?: ODataBatch): T;
+ /**
+ * Clones this queryable into a new queryable instance of T
+ * @param factory Constructor used to create the new instance
+ * @param additionalPath Any additional path to include in the clone
+ * @param includeBatch If true this instance's batch will be added to the cloned instance
+ */
+ protected clone(factory: QueryableConstructor, additionalPath?: string, includeBatch?: boolean): T;
+ /**
+ * Executes the currently built request
+ *
+ * @param parser Allows you to specify a parser to handle the result
+ * @param getOptions The options used for this request
+ */
+ get(parser?: ODataParser, getOptions?: FetchOptions): Promise;
+ getAs(parser?: ODataParser, getOptions?: FetchOptions): Promise;
+ protected post(postOptions?: FetchOptions, parser?: ODataParser): Promise;
+ protected postAs(postOptions?: FetchOptions, parser?: ODataParser): Promise;
+ protected patch(patchOptions?: FetchOptions, parser?: ODataParser): Promise;
+ protected delete(deleteOptions?: FetchOptions, parser?: ODataParser): Promise;
+ /**
+ * Converts the current instance to a request context
+ *
+ * @param verb The request verb
+ * @param options The set of supplied request options
+ * @param parser The supplied ODataParser instance
+ * @param pipeline Optional request processing pipeline
+ */
+ private toRequestContext(verb, options, parser, pipeline?);
+ }
+ /**
+ * Represents a REST collection which can be filtered, paged, and selected
+ *
+ */
+ export class QueryableCollection extends Queryable {
+ /**
+ * Filters the returned collection (https://msdn.microsoft.com/en-us/library/office/fp142385.aspx#bk_supported)
+ *
+ * @param filter The string representing the filter query
+ */
+ filter(filter: string): this;
+ /**
+ * Choose which fields to return
+ *
+ * @param selects One or more fields to return
+ */
+ select(...selects: string[]): this;
+ /**
+ * Expands fields such as lookups to get additional data
+ *
+ * @param expands The Fields for which to expand the values
+ */
+ expand(...expands: string[]): this;
+ /**
+ * Orders based on the supplied fields ascending
+ *
+ * @param orderby The name of the field to sort on
+ * @param ascending If false DESC is appended, otherwise ASC (default)
+ */
+ orderBy(orderBy: string, ascending?: boolean): this;
+ /**
+ * Skips the specified number of items
+ *
+ * @param skip The number of items to skip
+ */
+ skip(skip: number): this;
+ /**
+ * Limits the query to only return the specified number of items
+ *
+ * @param top The query row limit
+ */
+ top(top: number): this;
+ }
+ /**
+ * Represents an instance that can be selected
+ *
+ */
+ export class QueryableInstance extends Queryable {
+ /**
+ * Choose which fields to return
+ *
+ * @param selects One or more fields to return
+ */
+ select(...selects: string[]): this;
+ /**
+ * Expands fields such as lookups to get additional data
+ *
+ * @param expands The Fields for which to expand the values
+ */
+ expand(...expands: string[]): this;
+ }
+}
+declare module "sharepoint/odata" {
+ import { QueryableConstructor } from "sharepoint/queryable";
+ export function extractOdataId(candidate: any): string;
+ export interface ODataParser {
+ parse(r: Response): Promise;
+ }
+ export abstract class ODataParserBase implements ODataParser {
+ parse(r: Response): Promise;
+ protected handleError(r: Response, reject: (reason?: any) => void): boolean;
+ protected parseODataJSON(json: any): U;
+ }
+ export class ODataDefaultParser extends ODataParserBase {
+ }
+ export class ODataRawParserImpl implements ODataParser {
+ parse(r: Response): Promise;
+ }
+ export function getEntityUrl(entity: any): string;
+ export let ODataRaw: ODataRawParserImpl;
+ export function ODataValue(): ODataParser;
+ export function ODataEntity(factory: QueryableConstructor): ODataParser;
+ export function ODataEntityArray(factory: QueryableConstructor): ODataParser;
+ /**
+ * Manages a batch of OData operations
+ */
+ export class ODataBatch {
+ private baseUrl;
+ private _batchId;
+ private _dependencies;
+ private _requests;
+ constructor(baseUrl: string, _batchId?: string);
+ readonly batchId: string;
+ /**
+ * Adds a request to a batch (not designed for public use)
+ *
+ * @param url The full url of the request
+ * @param method The http method GET, POST, etc
+ * @param options Any options to include in the request
+ * @param parser The parser that will hadle the results of the request
+ */
+ add(url: string, method: string, options: any, parser: ODataParser): Promise;
+ /**
+ * Adds a dependency insuring that some set of actions will occur before a batch is processed.
+ * MUST be cleared using the returned resolve delegate to allow batches to run
+ */
+ addDependency(): () => void;
+ /**
+ * Execute the current batch and resolve the associated promises
+ *
+ * @returns A promise which will be resolved once all of the batch's child promises have resolved
+ */
+ execute(): Promise;
+ private executeImpl();
+ /**
+ * Parses the response from a batch request into an array of Response instances
+ *
+ * @param body Text body of the response from the batch request
+ */
+ private _parseResponse(body);
+ }
+ export class TextFileParser implements ODataParser {
+ parse(r: Response): Promise;
+ }
+ export class BlobFileParser implements ODataParser {
+ parse(r: Response): Promise;
+ }
+ export class JSONFileParser implements ODataParser {
+ parse(r: Response): Promise;
+ }
+ export class BufferFileParser implements ODataParser {
+ parse(r: any): Promise;
+ }
+}
+declare module "net/digestcache" {
+ import { Dictionary } from "collections/collections";
+ import { HttpClient } from "net/httpclient";
+ export class CachedDigest {
+ expiration: Date;
+ value: string;
+ }
+ export class DigestCache {
+ private _httpClient;
+ private _digests;
+ constructor(_httpClient: HttpClient, _digests?: Dictionary);
+ getDigest(webUrl: string): Promise;
+ clear(): void;
+ }
+}
+declare module "net/httpclient" {
+ export interface FetchOptions {
+ method?: string;
+ headers?: string[][] | {
+ [key: string]: string;
+ };
+ body?: any;
+ mode?: "navigate" | "same-origin" | "no-cors" | "cors";
+ credentials?: "omit" | "same-origin" | "include";
+ cache?: "default" | "no-store" | "reload" | "no-cache" | "force-cache" | "only-if-cached";
+ }
+ export class HttpClient {
+ private _digestCache;
+ private _impl;
+ constructor();
+ fetch(url: string, options?: FetchOptions): Promise;
+ fetchRaw(url: string, options?: FetchOptions): Promise;
+ get(url: string, options?: FetchOptions): Promise;
+ post(url: string, options?: FetchOptions): Promise;
+ patch(url: string, options?: FetchOptions): Promise;
+ delete(url: string, options?: FetchOptions): Promise;
+ private mergeHeaders(target, source);
+ }
+ export interface HttpClientImpl {
+ fetch(url: string, options: FetchOptions): Promise;
+ }
+}
+declare module "net/fetchclient" {
+ import { HttpClientImpl } from "net/httpclient";
+ /**
+ * Makes requests using the fetch API
+ */
+ export class FetchClient implements HttpClientImpl {
+ fetch(url: string, options: any): Promise;
+ }
+}
+declare module "configuration/pnplibconfig" {
+ import { TypedHash } from "collections/collections";
+ import { HttpClientImpl } from "net/httpclient";
+ export interface LibraryConfiguration {
+ /**
+ * Any headers to apply to all requests
+ */
+ headers?: TypedHash;
+ /**
+ * Allows caching to be global disabled, default: false
+ */
+ globalCacheDisable?: boolean;
+ /**
+ * Defines the default store used by the usingCaching method, default: session
+ */
+ defaultCachingStore?: "session" | "local";
+ /**
+ * Defines the default timeout in seconds used by the usingCaching method, default 30
+ */
+ defaultCachingTimeoutSeconds?: number;
+ /**
+ * Defines a factory method used to create fetch clients
+ */
+ fetchClientFactory?: () => HttpClientImpl;
+ /**
+ * The base url used for all requests
+ */
+ baseUrl?: string;
+ /**
+ * Used to supply the current context from an SPFx webpart to the library
+ */
+ spfxContext?: any;
+ }
+ export class RuntimeConfigImpl {
+ private _headers;
+ private _defaultCachingStore;
+ private _defaultCachingTimeoutSeconds;
+ private _globalCacheDisable;
+ private _fetchClientFactory;
+ private _baseUrl;
+ private _spfxContext;
+ constructor();
+ set(config: LibraryConfiguration): void;
+ readonly headers: TypedHash;
+ readonly defaultCachingStore: "session" | "local";
+ readonly defaultCachingTimeoutSeconds: number;
+ readonly globalCacheDisable: boolean;
+ readonly fetchClientFactory: () => HttpClientImpl;
+ readonly baseUrl: string;
+ }
+ export let RuntimeConfig: RuntimeConfigImpl;
+ export function setRuntimeConfig(config: LibraryConfiguration): void;
+}
+declare module "utils/util" {
+ import { TypedHash } from "collections/collections";
+ export class Util {
+ /**
+ * Gets a callback function which will maintain context across async calls.
+ * Allows for the calling pattern getCtxCallback(thisobj, method, methodarg1, methodarg2, ...)
+ *
+ * @param context The object that will be the 'this' value in the callback
+ * @param method The method to which we will apply the context and parameters
+ * @param params Optional, additional arguments to supply to the wrapped method when it is invoked
+ */
+ static getCtxCallback(context: any, method: Function, ...params: any[]): Function;
+ /**
+ * Tests if a url param exists
+ *
+ * @param name The name of the url paramter to check
+ */
+ static urlParamExists(name: string): boolean;
+ /**
+ * Gets a url param value by name
+ *
+ * @param name The name of the paramter for which we want the value
+ */
+ static getUrlParamByName(name: string): string;
+ /**
+ * Gets a url param by name and attempts to parse a bool value
+ *
+ * @param name The name of the paramter for which we want the boolean value
+ */
+ static getUrlParamBoolByName(name: string): boolean;
+ /**
+ * Inserts the string s into the string target as the index specified by index
+ *
+ * @param target The string into which we will insert s
+ * @param index The location in target to insert s (zero based)
+ * @param s The string to insert into target at position index
+ */
+ static stringInsert(target: string, index: number, s: string): string;
+ /**
+ * Adds a value to a date
+ *
+ * @param date The date to which we will add units, done in local time
+ * @param interval The name of the interval to add, one of: ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second']
+ * @param units The amount to add to date of the given interval
+ *
+ * http://stackoverflow.com/questions/1197928/how-to-add-30-minutes-to-a-javascript-date-object
+ */
+ static dateAdd(date: Date, interval: string, units: number): Date;
+ /**
+ * Loads a stylesheet into the current page
+ *
+ * @param path The url to the stylesheet
+ * @param avoidCache If true a value will be appended as a query string to avoid browser caching issues
+ */
+ static loadStylesheet(path: string, avoidCache: boolean): void;
+ /**
+ * Combines an arbitrary set of paths ensuring that the slashes are normalized
+ *
+ * @param paths 0 to n path parts to combine
+ */
+ static combinePaths(...paths: string[]): string;
+ /**
+ * Gets a random string of chars length
+ *
+ * @param chars The length of the random string to generate
+ */
+ static getRandomString(chars: number): string;
+ /**
+ * Gets a random GUID value
+ *
+ * http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
+ */
+ static getGUID(): string;
+ /**
+ * Determines if a given value is a function
+ *
+ * @param candidateFunction The thing to test for being a function
+ */
+ static isFunction(candidateFunction: any): boolean;
+ /**
+ * @returns whether the provided parameter is a JavaScript Array or not.
+ */
+ static isArray(array: any): boolean;
+ /**
+ * Determines if a string is null or empty or undefined
+ *
+ * @param s The string to test
+ */
+ static stringIsNullOrEmpty(s: string): boolean;
+ /**
+ * Provides functionality to extend the given object by doing a shallow copy
+ *
+ * @param target The object to which properties will be copied
+ * @param source The source object from which properties will be copied
+ * @param noOverwrite If true existing properties on the target are not overwritten from the source
+ *
+ */
+ static extend(target: any, source: TypedHash, noOverwrite?: boolean): any;
+ /**
+ * Determines if a given url is absolute
+ *
+ * @param url The url to check to see if it is absolute
+ */
+ static isUrlAbsolute(url: string): boolean;
+ /**
+ * Ensures that a given url is absolute for the current web based on context
+ *
+ * @param candidateUrl The url to make absolute
+ *
+ */
+ static toAbsoluteUrl(candidateUrl: string): Promise;
+ }
+}
+declare module "configuration/configuration" {
+ import { TypedHash } from "collections/collections";
+ /**
+ * Interface for configuration providers
+ *
+ */
+ export interface IConfigurationProvider {
+ /**
+ * Gets the configuration from the provider
+ */
+ getConfiguration(): Promise>;
+ }
+ /**
+ * Class used to manage the current application settings
+ *
+ */
+ export class Settings {
+ /**
+ * The settings currently stored in this instance
+ */
+ private _settings;
+ /**
+ * Creates a new instance of the settings class
+ *
+ * @constructor
+ */
+ constructor();
+ /**
+ * Adds a new single setting, or overwrites a previous setting with the same key
+ *
+ * @param {string} key The key used to store this setting
+ * @param {string} value The setting value to store
+ */
+ add(key: string, value: string): void;
+ /**
+ * Adds a JSON value to the collection as a string, you must use getJSON to rehydrate the object when read
+ *
+ * @param {string} key The key used to store this setting
+ * @param {any} value The setting value to store
+ */
+ addJSON(key: string, value: any): void;
+ /**
+ * Applies the supplied hash to the setting collection overwriting any existing value, or created new values
+ *
+ * @param {TypedHash} hash The set of values to add
+ */
+ apply(hash: TypedHash): Promise;
+ /**
+ * Loads configuration settings into the collection from the supplied provider and returns a Promise
+ *
+ * @param {IConfigurationProvider} provider The provider from which we will load the settings
+ */
+ load(provider: IConfigurationProvider): Promise;
+ /**
+ * Gets a value from the configuration
+ *
+ * @param {string} key The key whose value we want to return. Returns null if the key does not exist
+ * @return {string} string value from the configuration
+ */
+ get(key: string): string;
+ /**
+ * Gets a JSON value, rehydrating the stored string to the original object
+ *
+ * @param {string} key The key whose value we want to return. Returns null if the key does not exist
+ * @return {any} object from the configuration
+ */
+ getJSON(key: string): any;
+ }
+}
+declare module "sharepoint/search" {
+ import { Queryable, QueryableInstance } from "sharepoint/queryable";
+ import { Dictionary } from "collections/collections";
+ /**
+ * Allows for the fluent construction of search queries
+ */
+ export class SearchQueryBuilder {
+ private _query;
+ static create(queryText?: string, queryTemplate?: SearchQuery): SearchQueryBuilder;
+ constructor(queryText?: string, _query?: {});
+ text(queryText: string): this;
+ template(template: string): this;
+ sourceId(id: string): this;
+ readonly enableInterleaving: this;
+ readonly enableStemming: this;
+ readonly trimDuplicates: this;
+ readonly enableNicknames: this;
+ readonly enableFql: this;
+ readonly enablePhonetic: this;
+ readonly bypassResultTypes: this;
+ readonly processBestBets: this;
+ readonly enableQueryRules: this;
+ readonly enableSorting: this;
+ readonly generateBlockRankLog: this;
+ rankingModelId(id: string): this;
+ startRow(id: number): this;
+ rowLimit(id: number): this;
+ rowsPerPage(id: number): this;
+ selectProperties(...properties: string[]): this;
+ culture(culture: number): this;
+ refinementFilters(...filters: string[]): this;
+ refiners(refiners: string): this;
+ hiddenConstraints(constraints: string): this;
+ sortList(...sorts: Sort[]): this;
+ timeout(milliseconds: number): this;
+ hithighlightedProperties(...properties: string[]): this;
+ clientType(clientType: string): this;
+ personalizationData(data: string): this;
+ resultsURL(url: string): this;
+ queryTag(...tags: string[]): this;
+ properties(...properties: SearchProperty[]): this;
+ readonly processPersonalFavorites: this;
+ queryTemplatePropertiesUrl(url: string): this;
+ reorderingRules(...rules: ReorderingRule[]): this;
+ hitHighlightedMultivaluePropertyLimit(limit: number): this;
+ readonly enableOrderingHitHighlightedProperty: this;
+ collapseSpecification(spec: string): this;
+ uiLanguage(lang: number): this;
+ desiredSnippetLength(len: number): this;
+ maxSnippetLength(len: number): this;
+ summaryLength(len: number): this;
+ toSearchQuery(): SearchQuery;
+ private extendQuery(part);
+ }
+ /**
+ * Describes the search API
+ *
+ */
+ export class Search extends QueryableInstance {
+ /**
+ * Creates a new instance of the Search class
+ *
+ * @param baseUrl The url for the search context
+ * @param query The SearchQuery object to execute
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * .......
+ * @returns Promise
+ */
+ execute(query: SearchQuery): Promise;
+ /**
+ * Fixes up properties that expect to consist of a "results" collection when needed
+ *
+ * @param prop property to fixup for container struct
+ */
+ private fixupProp(prop);
+ }
+ /**
+ * Describes the SearchResults class, which returns the formatted and raw version of the query response
+ */
+ export class SearchResults {
+ private _url;
+ private _query;
+ private _raw;
+ private _primary;
+ /**
+ * Creates a new instance of the SearchResult class
+ *
+ */
+ constructor(rawResponse: any, _url: string, _query: SearchQuery, _raw?: SearchResponse, _primary?: SearchResult[]);
+ readonly ElapsedTime: number;
+ readonly RowCount: number;
+ readonly TotalRows: number;
+ readonly TotalRowsIncludingDuplicates: number;
+ readonly RawSearchResults: SearchResponse;
+ readonly PrimarySearchResults: SearchResult[];
+ /**
+ * Gets a page of results
+ *
+ * @param pageNumber Index of the page to return. Used to determine StartRow
+ * @param pageSize Optional, items per page (default = 10)
+ */
+ getPage(pageNumber: number, pageSize?: number): Promise;
+ /**
+ * Formats a search results array
+ *
+ * @param rawResults The array to process
+ */
+ protected formatSearchResults(rawResults: any): SearchResult[];
+ }
+ /**
+ * Describes the SearchQuery interface
+ */
+ export interface SearchQuery {
+ /**
+ * A string that contains the text for the search query.
+ */
+ Querytext?: string;
+ /**
+ * A string that contains the text that replaces the query text, as part of a query transform.
+ */
+ QueryTemplate?: string;
+ /**
+ * A Boolean value that specifies whether the result tables that are returned for
+ * the result block are mixed with the result tables that are returned for the original query.
+ */
+ EnableInterleaving?: boolean;
+ /**
+ * A Boolean value that specifies whether stemming is enabled.
+ */
+ EnableStemming?: boolean;
+ /**
+ * A Boolean value that specifies whether duplicate items are removed from the results.
+ */
+ TrimDuplicates?: boolean;
+ /**
+ * A Boolean value that specifies whether the exact terms in the search query are used to find matches, or if nicknames are used also.
+ */
+ EnableNicknames?: boolean;
+ /**
+ * A Boolean value that specifies whether the query uses the FAST Query Language (FQL).
+ */
+ EnableFql?: boolean;
+ /**
+ * A Boolean value that specifies whether the phonetic forms of the query terms are used to find matches.
+ */
+ EnablePhonetic?: boolean;
+ /**
+ * A Boolean value that specifies whether to perform result type processing for the query.
+ */
+ BypassResultTypes?: boolean;
+ /**
+ * A Boolean value that specifies whether to return best bet results for the query.
+ * This parameter is used only when EnableQueryRules is set to true, otherwise it is ignored.
+ */
+ ProcessBestBets?: boolean;
+ /**
+ * A Boolean value that specifies whether to enable query rules for the query.
+ */
+ EnableQueryRules?: boolean;
+ /**
+ * A Boolean value that specifies whether to sort search results.
+ */
+ EnableSorting?: boolean;
+ /**
+ * Specifies whether to return block rank log information in the BlockRankLog property of the interleaved result table.
+ * A block rank log contains the textual information on the block score and the documents that were de-duplicated.
+ */
+ GenerateBlockRankLog?: boolean;
+ /**
+ * The result source ID to use for executing the search query.
+ */
+ SourceId?: string;
+ /**
+ * The ID of the ranking model to use for the query.
+ */
+ RankingModelId?: string;
+ /**
+ * The first row that is included in the search results that are returned.
+ * You use this parameter when you want to implement paging for search results.
+ */
+ StartRow?: number;
+ /**
+ * The maximum number of rows overall that are returned in the search results.
+ * Compared to RowsPerPage, RowLimit is the maximum number of rows returned overall.
+ */
+ RowLimit?: number;
+ /**
+ * The maximum number of rows to return per page.
+ * Compared to RowLimit, RowsPerPage refers to the maximum number of rows to return per page,
+ * and is used primarily when you want to implement paging for search results.
+ */
+ RowsPerPage?: number;
+ /**
+ * The managed properties to return in the search results.
+ */
+ SelectProperties?: string[];
+ /**
+ * The locale ID (LCID) for the query.
+ */
+ Culture?: number;
+ /**
+ * The set of refinement filters used when issuing a refinement query (FQL)
+ */
+ RefinementFilters?: string[];
+ /**
+ * The set of refiners to return in a search result.
+ */
+ Refiners?: string;
+ /**
+ * The additional query terms to append to the query.
+ */
+ HiddenConstraints?: string;
+ /**
+ * The list of properties by which the search results are ordered.
+ */
+ SortList?: Sort[];
+ /**
+ * The amount of time in milliseconds before the query request times out.
+ */
+ Timeout?: number;
+ /**
+ * The properties to highlight in the search result summary when the property value matches the search terms entered by the user.
+ */
+ HithighlightedProperties?: string[];
+ /**
+ * The type of the client that issued the query.
+ */
+ ClientType?: string;
+ /**
+ * The GUID for the user who submitted the search query.
+ */
+ PersonalizationData?: string;
+ /**
+ * The URL for the search results page.
+ */
+ ResultsURL?: string;
+ /**
+ * Custom tags that identify the query. You can specify multiple query tags
+ */
+ QueryTag?: string[];
+ /**
+ * Properties to be used to configure the search query
+ */
+ Properties?: SearchProperty[];
+ /**
+ * A Boolean value that specifies whether to return personal favorites with the search results.
+ */
+ ProcessPersonalFavorites?: boolean;
+ /**
+ * The location of the queryparametertemplate.xml file. This file is used to enable anonymous users to make Search REST queries.
+ */
+ QueryTemplatePropertiesUrl?: string;
+ /**
+ * Special rules for reordering search results.
+ * These rules can specify that documents matching certain conditions are ranked higher or lower in the results.
+ * This property applies only when search results are sorted based on rank.
+ */
+ ReorderingRules?: ReorderingRule[];
+ /**
+ * The number of properties to show hit highlighting for in the search results.
+ */
+ HitHighlightedMultivaluePropertyLimit?: number;
+ /**
+ * A Boolean value that specifies whether the hit highlighted properties can be ordered.
+ */
+ EnableOrderingHitHighlightedProperty?: boolean;
+ /**
+ * The managed properties that are used to determine how to collapse individual search results.
+ * Results are collapsed into one or a specified number of results if they match any of the individual collapse specifications.
+ * In a collapse specification, results are collapsed if their properties match all individual properties in the collapse specification.
+ */
+ CollapseSpecification?: string;
+ /**
+ * The locale identifier (LCID) of the user interface
+ */
+ UIlanguage?: number;
+ /**
+ * The preferred number of characters to display in the hit-highlighted summary generated for a search result.
+ */
+ DesiredSnippetLength?: number;
+ /**
+ * The maximum number of characters to display in the hit-highlighted summary generated for a search result.
+ */
+ MaxSnippetLength?: number;
+ /**
+ * The number of characters to display in the result summary for a search result.
+ */
+ SummaryLength?: number;
+ }
+ /**
+ * Provides hints at the properties which may be available on the result object
+ */
+ export interface SearchResult {
+ Rank?: number;
+ DocId?: number;
+ WorkId?: number;
+ Title?: string;
+ Author?: string;
+ Size?: number;
+ Path?: string;
+ Description?: string;
+ Write?: Date;
+ LastModifiedTime?: Date;
+ CollapsingStatus?: number;
+ HitHighlightedSummary?: string;
+ HitHighlightedProperties?: string;
+ contentclass?: string;
+ PictureThumbnailURL?: string;
+ ServerRedirectedURL?: string;
+ ServerRedirectedEmbedURL?: string;
+ ServerRedirectedPreviewURL?: string;
+ FileExtension?: string;
+ ContentTypeId?: string;
+ ParentLink?: string;
+ ViewsLifeTime?: number;
+ ViewsRecent?: number;
+ SectionNames?: string;
+ SectionIndexes?: string;
+ SiteLogo?: string;
+ SiteDescription?: string;
+ importance?: number;
+ SiteName?: string;
+ IsDocument?: boolean;
+ FileType?: string;
+ IsContainer?: boolean;
+ WebTemplate?: string;
+ SPWebUrl?: string;
+ UniqueId?: string;
+ ProgId?: string;
+ OriginalPath?: string;
+ RenderTemplateId?: string;
+ PartitionId?: string;
+ UrlZone?: number;
+ Culture?: string;
+ }
+ export interface SearchResponse {
+ ElapsedTime: number;
+ Properties?: {
+ Key: string;
+ Value: any;
+ ValueType: string;
+ }[];
+ PrimaryQueryResult?: ResultTableCollection;
+ SecondaryQueryResults?: ResultTableCollection;
+ SpellingSuggestion?: string;
+ TriggeredRules?: any[];
+ }
+ export interface ResultTableCollection {
+ QueryErrors?: Dictionary;
+ QueryId?: string;
+ QueryRuleId?: string;
+ CustomResults?: ResultTable;
+ RefinementResults?: ResultTable;
+ RelevantResults?: ResultTable;
+ SpecialTermResults?: ResultTable;
+ }
+ export interface ResultTable {
+ GroupTemplateId?: string;
+ ItemTemplateId?: string;
+ Properties?: {
+ Key: string;
+ Value: any;
+ ValueType: string;
+ }[];
+ Table: {
+ Rows: {
+ Cells: {
+ Key: string;
+ Value: any;
+ ValueType: string;
+ }[];
+ }[];
+ };
+ ResultTitle?: string;
+ ResultTitleUrl?: string;
+ RowCount?: number;
+ TableType?: string;
+ TotalRows?: number;
+ TotalRowsIncludingDuplicates?: number;
+ }
+ /**
+ * Defines how search results are sorted.
+ */
+ export interface Sort {
+ /**
+ * The name for a property by which the search results are ordered.
+ */
+ Property: string;
+ /**
+ * The direction in which search results are ordered.
+ */
+ Direction: SortDirection;
+ }
+ /**
+ * Defines one search property
+ */
+ export interface SearchProperty {
+ Name: string;
+ Value: SearchPropertyValue;
+ }
+ /**
+ * Defines one search property value. Set only one of StrlVal/BoolVal/IntVal/StrArray.
+ */
+ export interface SearchPropertyValue {
+ StrVal?: string;
+ BoolVal?: boolean;
+ Intval?: number;
+ StrArray?: string[];
+ QueryPropertyValueTypeIndex: QueryPropertyValueType;
+ }
+ /**
+ * defines the SortDirection enum
+ */
+ export enum SortDirection {
+ Ascending = 0,
+ Descending = 1,
+ FQLFormula = 2,
+ }
+ /**
+ * Defines how ReorderingRule interface, used for reordering results
+ */
+ export interface ReorderingRule {
+ /**
+ * The value to match on
+ */
+ MatchValue: string;
+ /**
+ * The rank boosting
+ */
+ Boost: number;
+ /**
+ * The rank boosting
+ */
+ MatchType: ReorderingRuleMatchType;
+ }
+ /**
+ * defines the ReorderingRuleMatchType enum
+ */
+ export enum ReorderingRuleMatchType {
+ ResultContainsKeyword = 0,
+ TitleContainsKeyword = 1,
+ TitleMatchesKeyword = 2,
+ UrlStartsWith = 3,
+ UrlExactlyMatches = 4,
+ ContentTypeIs = 5,
+ FileExtensionMatches = 6,
+ ResultHasTag = 7,
+ ManualCondition = 8,
+ }
+ /**
+ * Specifies the type value for the property
+ */
+ export enum QueryPropertyValueType {
+ None = 0,
+ StringType = 1,
+ Int32TYpe = 2,
+ BooleanType = 3,
+ StringArrayType = 4,
+ UnSupportedType = 5,
+ }
+ export class SearchBuiltInSourceId {
+ static readonly Documents: string;
+ static readonly ItemsMatchingContentType: string;
+ static readonly ItemsMatchingTag: string;
+ static readonly ItemsRelatedToCurrentUser: string;
+ static readonly ItemsWithSameKeywordAsThisItem: string;
+ static readonly LocalPeopleResults: string;
+ static readonly LocalReportsAndDataResults: string;
+ static readonly LocalSharePointResults: string;
+ static readonly LocalVideoResults: string;
+ static readonly Pages: string;
+ static readonly Pictures: string;
+ static readonly Popular: string;
+ static readonly RecentlyChangedItems: string;
+ static readonly RecommendedItems: string;
+ static readonly Wiki: string;
+ }
+}
+declare module "sharepoint/searchsuggest" {
+ import { Queryable, QueryableInstance } from "sharepoint/queryable";
+ /**
+ * Defines a query execute against the search/suggest endpoint (see https://msdn.microsoft.com/en-us/library/office/dn194079.aspx)
+ */
+ export interface SearchSuggestQuery {
+ /**
+ * A string that contains the text for the search query.
+ */
+ querytext: string;
+ /**
+ * The number of query suggestions to retrieve. Must be greater than zero (0). The default value is 5.
+ */
+ count?: number;
+ /**
+ * The number of personal results to retrieve. Must be greater than zero (0). The default value is 5.
+ */
+ personalCount?: number;
+ /**
+ * A Boolean value that specifies whether to retrieve pre-query or post-query suggestions. true to return pre-query suggestions; otherwise, false. The default value is false.
+ */
+ preQuery?: boolean;
+ /**
+ * A Boolean value that specifies whether to hit-highlight or format in bold the query suggestions. true to format in bold the terms in the returned query suggestions
+ * that match terms in the specified query; otherwise, false. The default value is true.
+ */
+ hitHighlighting?: boolean;
+ /**
+ * A Boolean value that specifies whether to capitalize the first letter in each term in the returned query suggestions. true to capitalize the first letter in each term;
+ * otherwise, false. The default value is false.
+ */
+ capitalize?: boolean;
+ /**
+ * The locale ID (LCID) for the query (see https://msdn.microsoft.com/en-us/library/cc233982.aspx).
+ */
+ culture?: string;
+ /**
+ * A Boolean value that specifies whether stemming is enabled. true to enable stemming; otherwise, false. The default value is true.
+ */
+ stemming?: boolean;
+ /**
+ * A Boolean value that specifies whether to include people names in the returned query suggestions. true to include people names in the returned query suggestions;
+ * otherwise, false. The default value is true.
+ */
+ includePeople?: boolean;
+ /**
+ * A Boolean value that specifies whether to turn on query rules for this query. true to turn on query rules; otherwise, false. The default value is true.
+ */
+ queryRules?: boolean;
+ /**
+ * A Boolean value that specifies whether to return query suggestions for prefix matches. true to return query suggestions based on prefix matches, otherwise, false when
+ * query suggestions should match the full query word.
+ */
+ prefixMatch?: boolean;
+ }
+ export class SearchSuggest extends QueryableInstance {
+ constructor(baseUrl: string | Queryable, path?: string);
+ execute(query: SearchSuggestQuery): Promise;
+ private mapQueryToQueryString(query);
+ }
+ export class SearchSuggestResult {
+ PeopleNames: string[];
+ PersonalResults: PersonalResultSuggestion[];
+ Queries: any[];
+ constructor(json: any);
+ }
+ export interface PersonalResultSuggestion {
+ HighlightedTitle?: string;
+ IsBestBet?: boolean;
+ Title?: string;
+ TypeId?: string;
+ Url?: string;
+ }
+}
+declare module "sharepoint/siteusers" {
+ import { Queryable, QueryableInstance, QueryableCollection } from "sharepoint/queryable";
+ import { SiteGroups } from "sharepoint/sitegroups";
+ import { TypedHash } from "collections/collections";
+ /**
+ * Properties that provide both a getter, and a setter.
+ *
+ */
+ export interface UserUpdateResult {
+ user: SiteUser;
+ data: any;
+ }
+ /**
+ * Describes a collection of all site collection users
+ *
+ */
+ export class SiteUsers extends QueryableCollection {
+ /**
+ * Creates a new instance of the SiteUsers class
+ *
+ * @param baseUrl The url or Queryable which forms the parent of this user collection
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * Gets a user from the collection by email
+ *
+ * @param email The email address of the user to retrieve
+ */
+ getByEmail(email: string): SiteUser;
+ /**
+ * Gets a user from the collection by id
+ *
+ * @param id The id of the user to retrieve
+ */
+ getById(id: number): SiteUser;
+ /**
+ * Gets a user from the collection by login name
+ *
+ * @param loginName The login name of the user to retrieve
+ */
+ getByLoginName(loginName: string): SiteUser;
+ /**
+ * Removes a user from the collection by id
+ *
+ * @param id The id of the user to remove
+ */
+ removeById(id: number | Queryable): Promise;
+ /**
+ * Removes a user from the collection by login name
+ *
+ * @param loginName The login name of the user to remove
+ */
+ removeByLoginName(loginName: string): Promise;
+ /**
+ * Adds a user to a group
+ *
+ * @param loginName The login name of the user to add to the group
+ *
+ */
+ add(loginName: string): Promise;
+ }
+ /**
+ * Describes a single user
+ *
+ */
+ export class SiteUser extends QueryableInstance {
+ /**
+ * Gets the groups for this user
+ *
+ */
+ readonly groups: SiteGroups;
+ /**
+ * Updates this user instance with the supplied properties
+ *
+ * @param properties A plain object of property names and values to update for the user
+ */
+ update(properties: TypedHash): Promise;
+ /**
+ * Delete this user
+ *
+ */
+ delete(): Promise;
+ }
+ /**
+ * Represents the current user
+ */
+ export class CurrentUser extends QueryableInstance {
+ constructor(baseUrl: string | Queryable, path?: string);
+ }
+ export interface SiteUserProps {
+ Email: string;
+ Id: number;
+ IsHiddenInUI: boolean;
+ IsShareByEmailGuestUser: boolean;
+ IsSiteAdmin: boolean;
+ LoginName: string;
+ PrincipalType: number;
+ Title: string;
+ }
+}
+declare module "sharepoint/sitegroups" {
+ import { Queryable, QueryableInstance, QueryableCollection } from "sharepoint/queryable";
+ import { SiteUsers } from "sharepoint/siteusers";
+ import { TypedHash } from "collections/collections";
+ /**
+ * Principal Type enum
+ *
+ */
+ export enum PrincipalType {
+ None = 0,
+ User = 1,
+ DistributionList = 2,
+ SecurityGroup = 4,
+ SharePointGroup = 8,
+ All = 15,
+ }
+ /**
+ * Results from updating a group
+ *
+ */
+ export interface GroupUpdateResult {
+ group: SiteGroup;
+ data: any;
+ }
+ /**
+ * Results from adding a group
+ *
+ */
+ export interface GroupAddResult {
+ group: SiteGroup;
+ data: any;
+ }
+ /**
+ * Describes a collection of site groups
+ *
+ */
+ export class SiteGroups extends QueryableCollection {
+ /**
+ * Creates a new instance of the SiteGroups class
+ *
+ * @param baseUrl The url or Queryable which forms the parent of this group collection
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * Adds a new group to the site collection
+ *
+ * @param props The group properties object of property names and values to be set for the group
+ */
+ add(properties: TypedHash): Promise;
+ /**
+ * Gets a group from the collection by name
+ *
+ * @param groupName The name of the group to retrieve
+ */
+ getByName(groupName: string): SiteGroup;
+ /**
+ * Gets a group from the collection by id
+ *
+ * @param id The id of the group to retrieve
+ */
+ getById(id: number): SiteGroup;
+ /**
+ * Removes the group with the specified member id from the collection
+ *
+ * @param id The id of the group to remove
+ */
+ removeById(id: number): Promise;
+ /**
+ * Removes the cross-site group with the specified name from the collection
+ *
+ * @param loginName The name of the group to remove
+ */
+ removeByLoginName(loginName: string): Promise;
+ }
+ /**
+ * Describes a single group
+ *
+ */
+ export class SiteGroup extends QueryableInstance {
+ /**
+ * Gets the users for this group
+ *
+ */
+ readonly users: SiteUsers;
+ /**
+ * Updates this group instance with the supplied properties
+ *
+ * @param properties A GroupWriteableProperties object of property names and values to update for the group
+ */
+ update(properties: TypedHash): Promise;
+ }
+ export interface SiteGroupAddResult {
+ group: SiteGroup;
+ data: any;
+ }
+}
+declare module "sharepoint/types" {
+ import { TypedHash } from "collections/collections";
+ /**
+ * Represents the unique sequential location of a change within the change log.
+ */
+ export interface ChangeToken {
+ /**
+ * Gets or sets a string value that contains the serialized representation of the change token generated by the protocol server.
+ */
+ StringValue: string;
+ }
+ /**
+ * Defines a query that is performed against the change log.
+ */
+ export interface ChangeQuery {
+ /**
+ * Gets or sets a value that specifies whether add changes are included in the query.
+ */
+ Add?: boolean;
+ /**
+ * Gets or sets a value that specifies whether changes to alerts are included in the query.
+ */
+ Alert?: boolean;
+ /**
+ * Gets or sets a value that specifies the end date and end time for changes that are returned through the query.
+ */
+ ChangeTokenEnd?: ChangeToken;
+ /**
+ * Gets or sets a value that specifies the start date and start time for changes that are returned through the query.
+ */
+ ChangeTokenStart?: ChangeToken;
+ /**
+ * Gets or sets a value that specifies whether changes to content types are included in the query.
+ */
+ ContentType?: boolean;
+ /**
+ * Gets or sets a value that specifies whether deleted objects are included in the query.
+ */
+ DeleteObject?: boolean;
+ /**
+ * Gets or sets a value that specifies whether changes to fields are included in the query.
+ */
+ Field?: boolean;
+ /**
+ * Gets or sets a value that specifies whether changes to files are included in the query.
+ */
+ File?: boolean;
+ /**
+ * Gets or sets value that specifies whether changes to folders are included in the query.
+ */
+ Folder?: boolean;
+ /**
+ * Gets or sets a value that specifies whether changes to groups are included in the query.
+ */
+ Group?: boolean;
+ /**
+ * Gets or sets a value that specifies whether adding users to groups is included in the query.
+ */
+ GroupMembershipAdd?: boolean;
+ /**
+ * Gets or sets a value that specifies whether deleting users from the groups is included in the query.
+ */
+ GroupMembershipDelete?: boolean;
+ /**
+ * Gets or sets a value that specifies whether general changes to list items are included in the query.
+ */
+ Item?: boolean;
+ /**
+ * Gets or sets a value that specifies whether changes to lists are included in the query.
+ */
+ List?: boolean;
+ /**
+ * Gets or sets a value that specifies whether move changes are included in the query.
+ */
+ Move?: boolean;
+ /**
+ * Gets or sets a value that specifies whether changes to the navigation structure of a site collection are included in the query.
+ */
+ Navigation?: boolean;
+ /**
+ * Gets or sets a value that specifies whether renaming changes are included in the query.
+ */
+ Rename?: boolean;
+ /**
+ * Gets or sets a value that specifies whether restoring items from the recycle bin or from backups is included in the query.
+ */
+ Restore?: boolean;
+ /**
+ * Gets or sets a value that specifies whether adding role assignments is included in the query.
+ */
+ RoleAssignmentAdd?: boolean;
+ /**
+ * Gets or sets a value that specifies whether adding role assignments is included in the query.
+ */
+ RoleAssignmentDelete?: boolean;
+ /**
+ * Gets or sets a value that specifies whether adding role assignments is included in the query.
+ */
+ RoleDefinitionAdd?: boolean;
+ /**
+ * Gets or sets a value that specifies whether adding role assignments is included in the query.
+ */
+ RoleDefinitionDelete?: boolean;
+ /**
+ * Gets or sets a value that specifies whether adding role assignments is included in the query.
+ */
+ RoleDefinitionUpdate?: boolean;
+ /**
+ * Gets or sets a value that specifies whether modifications to security policies are included in the query.
+ */
+ SecurityPolicy?: boolean;
+ /**
+ * Gets or sets a value that specifies whether changes to site collections are included in the query.
+ */
+ Site?: boolean;
+ /**
+ * Gets or sets a value that specifies whether updates made using the item SystemUpdate method are included in the query.
+ */
+ SystemUpdate?: boolean;
+ /**
+ * Gets or sets a value that specifies whether update changes are included in the query.
+ */
+ Update?: boolean;
+ /**
+ * Gets or sets a value that specifies whether changes to users are included in the query.
+ */
+ User?: boolean;
+ /**
+ * Gets or sets a value that specifies whether changes to views are included in the query.
+ */
+ View?: boolean;
+ /**
+ * Gets or sets a value that specifies whether changes to Web sites are included in the query.
+ */
+ Web?: boolean;
+ }
+ /**
+ * Specifies a Collaborative Application Markup Language (CAML) query on a list or joined lists.
+ */
+ export interface CamlQuery {
+ /**
+ * Gets or sets a value that indicates whether the query returns dates in Coordinated Universal Time (UTC) format.
+ */
+ DatesInUtc?: boolean;
+ /**
+ * Gets or sets a value that specifies the server relative URL of a list folder from which results will be returned.
+ */
+ FolderServerRelativeUrl?: string;
+ /**
+ * Gets or sets a value that specifies the information required to get the next page of data for the list view.
+ */
+ ListItemCollectionPosition?: ListItemCollectionPosition;
+ /**
+ * Gets or sets value that specifies the XML schema that defines the list view.
+ */
+ ViewXml?: string;
+ }
+ /**
+ * Specifies the information required to get the next page of data for a list view.
+ */
+ export interface ListItemCollectionPosition {
+ /**
+ * Gets or sets a value that specifies information, as name-value pairs, required to get the next page of data for a list view.
+ */
+ PagingInfo: string;
+ }
+ /**
+ * Represents the input parameter of the GetListItemChangesSinceToken method.
+ */
+ export interface ChangeLogitemQuery {
+ /**
+ * The change token for the request.
+ */
+ ChangeToken?: string;
+ /**
+ * The XML element that defines custom filtering for the query.
+ */
+ Contains?: string;
+ /**
+ * The records from the list to return and their return order.
+ */
+ Query?: string;
+ /**
+ * The options for modifying the query.
+ */
+ QueryOptions?: string;
+ /**
+ * RowLimit
+ */
+ RowLimit?: string;
+ /**
+ * The names of the fields to include in the query result.
+ */
+ ViewFields?: string;
+ /**
+ * The GUID of the view.
+ */
+ ViewName?: string;
+ }
+ /**
+ * Determines the display mode of the given control or view
+ */
+ export enum ControlMode {
+ Display = 1,
+ Edit = 2,
+ New = 3,
+ }
+ /**
+ * Represents properties of a list item field and its value.
+ */
+ export interface ListItemFormUpdateValue {
+ /**
+ * The error message result after validating the value for the field.
+ */
+ ErrorMessage?: string;
+ /**
+ * The internal name of the field.
+ */
+ FieldName?: string;
+ /**
+ * The value of the field, in string format.
+ */
+ FieldValue?: string;
+ /**
+ * Indicates whether there was an error result after validating the value for the field.
+ */
+ HasException?: boolean;
+ }
+ /**
+ * Specifies the type of the field.
+ */
+ export enum FieldTypes {
+ Invalid = 0,
+ Integer = 1,
+ Text = 2,
+ Note = 3,
+ DateTime = 4,
+ Counter = 5,
+ Choice = 6,
+ Lookup = 7,
+ Boolean = 8,
+ Number = 9,
+ Currency = 10,
+ URL = 11,
+ Computed = 12,
+ Threading = 13,
+ Guid = 14,
+ MultiChoice = 15,
+ GridChoice = 16,
+ Calculated = 17,
+ File = 18,
+ Attachments = 19,
+ User = 20,
+ Recurrence = 21,
+ CrossProjectLink = 22,
+ ModStat = 23,
+ Error = 24,
+ ContentTypeId = 25,
+ PageSeparator = 26,
+ ThreadIndex = 27,
+ WorkflowStatus = 28,
+ AllDayEvent = 29,
+ WorkflowEventType = 30,
+ }
+ export enum DateTimeFieldFormatType {
+ DateOnly = 0,
+ DateTime = 1,
+ }
+ /**
+ * Specifies the control settings while adding a field.
+ */
+ export enum AddFieldOptions {
+ /**
+ * Specify that a new field added to the list must also be added to the default content type in the site collection
+ */
+ DefaultValue = 0,
+ /**
+ * Specify that a new field added to the list must also be added to the default content type in the site collection.
+ */
+ AddToDefaultContentType = 1,
+ /**
+ * Specify that a new field must not be added to any other content type
+ */
+ AddToNoContentType = 2,
+ /**
+ * Specify that a new field that is added to the specified list must also be added to all content types in the site collection
+ */
+ AddToAllContentTypes = 4,
+ /**
+ * Specify adding an internal field name hint for the purpose of avoiding possible database locking or field renaming operations
+ */
+ AddFieldInternalNameHint = 8,
+ /**
+ * Specify that a new field that is added to the specified list must also be added to the default list view
+ */
+ AddFieldToDefaultView = 16,
+ /**
+ * Specify to confirm that no other field has the same display name
+ */
+ AddFieldCheckDisplayName = 32,
+ }
+ export interface XmlSchemaFieldCreationInformation {
+ Options?: AddFieldOptions;
+ SchemaXml: string;
+ }
+ export enum CalendarType {
+ Gregorian = 1,
+ Japan = 3,
+ Taiwan = 4,
+ Korea = 5,
+ Hijri = 6,
+ Thai = 7,
+ Hebrew = 8,
+ GregorianMEFrench = 9,
+ GregorianArabic = 10,
+ GregorianXLITEnglish = 11,
+ GregorianXLITFrench = 12,
+ KoreaJapanLunar = 14,
+ ChineseLunar = 15,
+ SakaEra = 16,
+ UmAlQura = 23,
+ }
+ export enum UrlFieldFormatType {
+ Hyperlink = 0,
+ Image = 1,
+ }
+ export interface BasePermissions {
+ Low: number;
+ High: number;
+ }
+ export enum PermissionKind {
+ /**
+ * Has no permissions on the Site. Not available through the user interface.
+ */
+ EmptyMask = 0,
+ /**
+ * View items in lists, documents in document libraries, and Web discussion comments.
+ */
+ ViewListItems = 1,
+ /**
+ * Add items to lists, documents to document libraries, and Web discussion comments.
+ */
+ AddListItems = 2,
+ /**
+ * Edit items in lists, edit documents in document libraries, edit Web discussion comments
+ * in documents, and customize Web Part Pages in document libraries.
+ */
+ EditListItems = 3,
+ /**
+ * Delete items from a list, documents from a document library, and Web discussion
+ * comments in documents.
+ */
+ DeleteListItems = 4,
+ /**
+ * Approve a minor version of a list item or document.
+ */
+ ApproveItems = 5,
+ /**
+ * View the source of documents with server-side file handlers.
+ */
+ OpenItems = 6,
+ /**
+ * View past versions of a list item or document.
+ */
+ ViewVersions = 7,
+ /**
+ * Delete past versions of a list item or document.
+ */
+ DeleteVersions = 8,
+ /**
+ * Discard or check in a document which is checked out to another user.
+ */
+ CancelCheckout = 9,
+ /**
+ * Create, change, and delete personal views of lists.
+ */
+ ManagePersonalViews = 10,
+ /**
+ * Create and delete lists, add or remove columns in a list, and add or remove public views of a list.
+ */
+ ManageLists = 12,
+ /**
+ * View forms, views, and application pages, and enumerate lists.
+ */
+ ViewFormPages = 13,
+ /**
+ * Make content of a list or document library retrieveable for anonymous users through SharePoint search.
+ * The list permissions in the site do not change.
+ */
+ AnonymousSearchAccessList = 14,
+ /**
+ * Allow users to open a Site, list, or folder to access items inside that container.
+ */
+ Open = 17,
+ /**
+ * View pages in a Site.
+ */
+ ViewPages = 18,
+ /**
+ * Add, change, or delete HTML pages or Web Part Pages, and edit the Site using
+ * a Windows SharePoint Services compatible editor.
+ */
+ AddAndCustomizePages = 19,
+ /**
+ * Apply a theme or borders to the entire Site.
+ */
+ ApplyThemeAndBorder = 20,
+ /**
+ * Apply a style sheet (.css file) to the Site.
+ */
+ ApplyStyleSheets = 21,
+ /**
+ * View reports on Site usage.
+ */
+ ViewUsageData = 22,
+ /**
+ * Create a Site using Self-Service Site Creation.
+ */
+ CreateSSCSite = 23,
+ /**
+ * Create subsites such as team sites, Meeting Workspace sites, and Document Workspace sites.
+ */
+ ManageSubwebs = 24,
+ /**
+ * Create a group of users that can be used anywhere within the site collection.
+ */
+ CreateGroups = 25,
+ /**
+ * Create and change permission levels on the Site and assign permissions to users
+ * and groups.
+ */
+ ManagePermissions = 26,
+ /**
+ * Enumerate files and folders in a Site using Microsoft Office SharePoint Designer
+ * and WebDAV interfaces.
+ */
+ BrowseDirectories = 27,
+ /**
+ * View information about users of the Site.
+ */
+ BrowseUserInfo = 28,
+ /**
+ * Add or remove personal Web Parts on a Web Part Page.
+ */
+ AddDelPrivateWebParts = 29,
+ /**
+ * Update Web Parts to display personalized information.
+ */
+ UpdatePersonalWebParts = 30,
+ /**
+ * Grant the ability to perform all administration tasks for the Site as well as
+ * manage content, activate, deactivate, or edit properties of Site scoped Features
+ * through the object model or through the user interface (UI). When granted on the
+ * root Site of a Site Collection, activate, deactivate, or edit properties of
+ * site collection scoped Features through the object model. To browse to the Site
+ * Collection Features page and activate or deactivate Site Collection scoped Features
+ * through the UI, you must be a Site Collection administrator.
+ */
+ ManageWeb = 31,
+ /**
+ * Content of lists and document libraries in the Web site will be retrieveable for anonymous users through
+ * SharePoint search if the list or document library has AnonymousSearchAccessList set.
+ */
+ AnonymousSearchAccessWebLists = 32,
+ /**
+ * Use features that launch client applications. Otherwise, users must work on documents
+ * locally and upload changes.
+ */
+ UseClientIntegration = 37,
+ /**
+ * Use SOAP, WebDAV, or Microsoft Office SharePoint Designer interfaces to access the Site.
+ */
+ UseRemoteAPIs = 38,
+ /**
+ * Manage alerts for all users of the Site.
+ */
+ ManageAlerts = 39,
+ /**
+ * Create e-mail alerts.
+ */
+ CreateAlerts = 40,
+ /**
+ * Allows a user to change his or her user information, such as adding a picture.
+ */
+ EditMyUserInfo = 41,
+ /**
+ * Enumerate permissions on Site, list, folder, document, or list item.
+ */
+ EnumeratePermissions = 63,
+ /**
+ * Has all permissions on the Site. Not available through the user interface.
+ */
+ FullMask = 65,
+ }
+ export interface FollowedContent {
+ FollowedDocumentsUrl: string;
+ FollowedSitesUrl: string;
+ }
+ export interface UserProfile {
+ /**
+ * An object containing the user's FollowedDocumentsUrl and FollowedSitesUrl.
+ */
+ FollowedContent?: FollowedContent;
+ /**
+ * The account name of the user. (SharePoint Online only)
+ */
+ AccountName?: string;
+ /**
+ * The display name of the user. (SharePoint Online only)
+ */
+ DisplayName?: string;
+ /**
+ * The FirstRun flag of the user. (SharePoint Online only)
+ */
+ O15FirstRunExperience?: number;
+ /**
+ * The personal site of the user.
+ */
+ PersonalSite?: string;
+ /**
+ * The capabilities of the user's personal site. Represents a bitwise PersonalSiteCapabilities value:
+ * None = 0; Profile Value = 1; Social Value = 2; Storage Value = 4; MyTasksDashboard Value = 8; Education Value = 16; Guest Value = 32.
+ */
+ PersonalSiteCapabilities?: number;
+ /**
+ * The error thrown when the user's personal site was first created, if any. (SharePoint Online only)
+ */
+ PersonalSiteFirstCreationError?: string;
+ /**
+ * The date and time when the user's personal site was first created. (SharePoint Online only)
+ */
+ PersonalSiteFirstCreationTime?: Date;
+ /**
+ * The status for the state of the personal site instantiation
+ */
+ PersonalSiteInstantiationState?: number;
+ /**
+ * The date and time when the user's personal site was last created. (SharePoint Online only)
+ */
+ PersonalSiteLastCreationTime?: Date;
+ /**
+ * The number of attempts made to create the user's personal site. (SharePoint Online only)
+ */
+ PersonalSiteNumberOfRetries?: number;
+ /**
+ * Indicates whether the user's picture is imported from Exchange.
+ */
+ PictureImportEnabled?: boolean;
+ /**
+ * The public URL of the personal site of the current user. (SharePoint Online only)
+ */
+ PublicUrl?: string;
+ /**
+ * The URL used to create the user's personal site.
+ */
+ UrlToCreatePersonalSite?: string;
+ }
+ export interface HashTag {
+ /**
+ * The hash tag's internal name.
+ */
+ Name?: string;
+ /**
+ * The number of times that the hash tag is used.
+ */
+ UseCount?: number;
+ }
+ export interface HashTagCollection {
+ Items: HashTag[];
+ }
+ export interface UserIdInfo {
+ NameId?: string;
+ NameIdIssuer?: string;
+ }
+ export enum PrincipalType {
+ None = 0,
+ User = 1,
+ DistributionList = 2,
+ SecurityGroup = 4,
+ SharePointGroup = 8,
+ All = 15,
+ }
+ export enum PrincipalSource {
+ None = 0,
+ UserInfoList = 1,
+ Windows = 2,
+ MembershipProvider = 4,
+ RoleProvider = 8,
+ All = 15,
+ }
+ export enum RoleType {
+ None = 0,
+ Guest = 1,
+ Reader = 2,
+ Contributor = 3,
+ WebDesigner = 4,
+ Administrator = 5,
+ }
+ export interface PrincipalInfo {
+ Department: string;
+ DisplayName: string;
+ Email: string;
+ JobTitle: string;
+ LoginName: string;
+ Mobile: string;
+ PrincipalId: number;
+ PrincipalType: PrincipalType;
+ SIPAddress: string;
+ }
+ export interface DocumentLibraryInformation {
+ AbsoluteUrl?: string;
+ Modified?: Date;
+ ModifiedFriendlyDisplay?: string;
+ ServerRelativeUrl?: string;
+ Title?: string;
+ }
+ export interface ContextInfo {
+ FormDigestTimeoutSeconds?: number;
+ FormDigestValue?: number;
+ LibraryVersion?: string;
+ SiteFullUrl?: string;
+ SupportedSchemaVersions?: string[];
+ WebFullUrl?: string;
+ }
+ export interface RenderListData {
+ Row: any[];
+ FirstRow: number;
+ FolderPermissions: string;
+ LastRow: number;
+ FilterLink: string;
+ ForceNoHierarchy: string;
+ HierarchyHasIndention: string;
+ }
+ export enum PageType {
+ Invalid = -1,
+ DefaultView = 0,
+ NormalView = 1,
+ DialogView = 2,
+ View = 3,
+ DisplayForm = 4,
+ DisplayFormDialog = 5,
+ EditForm = 6,
+ EditFormDialog = 7,
+ NewForm = 8,
+ NewFormDialog = 9,
+ SolutionForm = 10,
+ PAGE_MAXITEMS = 11,
+ }
+ export interface ListFormData {
+ ContentType?: string;
+ Title?: string;
+ Author?: string;
+ Editor?: string;
+ Created?: Date;
+ Modified: Date;
+ Attachments?: any;
+ ListSchema?: any;
+ FormControlMode?: number;
+ FieldControlModes?: {
+ Title?: number;
+ Author?: number;
+ Editor?: number;
+ Created?: number;
+ Modified?: number;
+ Attachments?: number;
+ };
+ WebAttributes?: {
+ WebUrl?: string;
+ EffectivePresenceEnabled?: boolean;
+ AllowScriptableWebParts?: boolean;
+ PermissionCustomizePages?: boolean;
+ LCID?: number;
+ CurrentUserId?: number;
+ };
+ ItemAttributes?: {
+ Id?: number;
+ FsObjType?: number;
+ ExternalListItem?: boolean;
+ Url?: string;
+ EffectiveBasePermissionsLow?: number;
+ EffectiveBasePermissionsHigh?: number;
+ };
+ ListAttributes?: {
+ Id?: string;
+ BaseType?: number;
+ Direction?: string;
+ ListTemplateType?: number;
+ DefaultItemOpen?: number;
+ EnableVersioning?: boolean;
+ };
+ CSRCustomLayout?: boolean;
+ PostBackRequired?: boolean;
+ PreviousPostBackHandled?: boolean;
+ UploadMode?: boolean;
+ SubmitButtonID?: string;
+ ItemContentTypeName?: string;
+ ItemContentTypeId?: string;
+ JSLinks?: string;
+ }
+ export enum SharingLinkKind {
+ /**
+ * Uninitialized link
+ */
+ Uninitialized = 0,
+ /**
+ * Direct link to the object being shared
+ */
+ Direct = 1,
+ /**
+ * Organization-shareable link to the object being shared with view permissions
+ */
+ OrganizationView = 2,
+ /**
+ * Organization-shareable link to the object being shared with edit permissions
+ */
+ OrganizationEdit = 3,
+ /**
+ * View only anonymous link
+ */
+ AnonymousView = 4,
+ /**
+ * Read/Write anonymous link
+ */
+ AnonymousEdit = 5,
+ /**
+ * Flexible sharing Link where properties can change without affecting link URL
+ */
+ Flexible = 6,
+ }
+ export interface ShareObjectOptions {
+ url?: string;
+ loginNames?: string | string[];
+ role: SharingRole;
+ emailData?: SharingEmailData;
+ group?: RoleType;
+ propagateAcl?: boolean;
+ includeAnonymousLinkInEmail?: boolean;
+ useSimplifiedRoles?: boolean;
+ }
+ /**
+ * Indicates the role of the sharing link
+ */
+ export enum SharingRole {
+ None = 0,
+ View = 1,
+ Edit = 2,
+ Owner = 3,
+ }
+ /**
+ * Represents email data.
+ */
+ export interface SharingEmailData {
+ /**
+ * The e-mail subject.
+ */
+ subject?: string;
+ /**
+ * The e-mail body.
+ */
+ body: string;
+ }
+ export interface ShareLinkSettings {
+ /**
+ * The optional unique identifier of an existing sharing link to be retrieved and updated if necessary.
+ */
+ shareId?: string;
+ /**
+ * The kind of the sharing link to be created.
+ */
+ linkKind: SharingLinkKind;
+ /**
+ * A date/time string for which the format conforms to the ISO 8601:2004(E) complete representation for calendar date and time of day and
+ * which represents the time and date of expiry for the anonymous link. Both the minutes and hour value must be specified for the
+ * difference between the local and UTC time. Midnight is represented as 00:00:00.
+ */
+ expiration?: string;
+ /**
+ * The role to be used for the sharing link. This is required for Flexible links, and ignored for legacy link kinds.
+ */
+ role?: SharingRole;
+ /**
+ * Indicates if the sharing link, should support anonymous access. This is required for Flexible links, and ignored for legacy link kinds.
+ */
+ allowAnonymousAccess?: boolean;
+ }
+ export interface ShareLinkRequest {
+ /**
+ * A string of JSON representing users in people picker format. Only needed if an e-mail notification should be sent.
+ */
+ peoplePickerInput?: string;
+ /**
+ * Whether to create the link or not if it doesn't exist yet.
+ */
+ createLink: boolean;
+ /**
+ * The e-mail data. Only needed if an e-mail notification should be sent.
+ */
+ emailData?: SharingEmailData;
+ /**
+ * The settings for the sharing link to be created/updated
+ */
+ settings: ShareLinkSettings;
+ }
+ /**
+ * Represents a response for sharing a link
+ */
+ export interface ShareLinkResponse {
+ /**
+ * A SharingLinkInfo that represents the sharing link. Will be populated if sharing operation is returning a sharing link.
+ */
+ sharingLinkInfo: SharingLinkInfo;
+ }
+ export interface SharingLinkInfo {
+ AllowsAnonymousAccess: boolean;
+ Created: string;
+ CreatedBy: PrincipalInfo;
+ Expiration: string;
+ IsActive: boolean;
+ IsEditLink: boolean;
+ IsFormsLink: boolean;
+ IsUnhealthy: boolean;
+ LastModified: string;
+ LastModifiedBy: PrincipalInfo;
+ LinkKind: SharingLinkKind;
+ ShareId: string;
+ Url: string;
+ }
+ export enum SharingOperationStatusCode {
+ /**
+ * The share operation completed without errors.
+ */
+ CompletedSuccessfully = 0,
+ /**
+ * The share operation completed and generated requests for access.
+ */
+ AccessRequestsQueued = 1,
+ /**
+ * The share operation failed as there were no resolved users.
+ */
+ NoResolvedUsers = -1,
+ /**
+ * The share operation failed due to insufficient permissions.
+ */
+ AccessDenied = -2,
+ /**
+ * The share operation failed when attempting a cross site share, which is not supported.
+ */
+ CrossSiteRequestNotSupported = -3,
+ /**
+ * The sharing operation failed due to an unknown error.
+ */
+ UnknowError = -4,
+ /**
+ * The text you typed is too long. Please shorten it.
+ */
+ EmailBodyTooLong = -5,
+ /**
+ * The maximum number of unique scopes in the list has been exceeded.
+ */
+ ListUniqueScopesExceeded = -6,
+ /**
+ * The share operation failed because a sharing capability is disabled in the site.
+ */
+ CapabilityDisabled = -7,
+ /**
+ * The specified object for the share operation is not supported.
+ */
+ ObjectNotSupported = -8,
+ /**
+ * A SharePoint group cannot contain another SharePoint group.
+ */
+ NestedGroupsNotSupported = -9,
+ }
+ export interface SharingResult {
+ /**
+ * The relative URL of a page which can be navigated to, to show permissions.
+ */
+ PermissionsPageRelativeUrl?: string;
+ /**
+ * A collection of users which have new pending access requests as a result of sharing.
+ */
+ UsersWithAccessRequests?: any[];
+ /**
+ * An enumeration which summarizes the result of the sharing operation.
+ */
+ StatusCode?: SharingOperationStatusCode;
+ /**
+ * An error message about the failure if sharing was unsuccessful.
+ */
+ ErrorMessage?: string;
+ /**
+ * A list of UserSharingResults from attempting to share a securable with unique permissions.
+ */
+ UniquelyPermissionedUsers?: UserSharingResult[];
+ /**
+ * Groups which were granted permissions.
+ */
+ GroupsSharedWith?: any[];
+ /**
+ * The SharePoint group users were added to, if any were added to a group.
+ */
+ GroupUsersAddedTo?: any;
+ /**
+ * A list of users being added to a SharePoint permissions goup
+ */
+ UsersAddedToGroup?: UserSharingResult[];
+ /**
+ * A list of SPInvitationCreationResult for external users being invited to have access.
+ */
+ InvitedUsers?: SPInvitationCreationResult[];
+ /**
+ * The name of the securable being shared.
+ */
+ Name?: string;
+ /**
+ * The url of the securable being shared.
+ */
+ Url?: string;
+ /**
+ * IconUrl
+ */
+ IconUrl?: string;
+ }
+ export interface UserSharingResult {
+ IsUserKnown?: boolean;
+ Status?: boolean;
+ Message?: string;
+ User?: string;
+ DisplayName?: string;
+ Email?: string;
+ CurrentRole?: SharingRole;
+ AllowedRoles?: SharingRole[];
+ InvitationLink?: string;
+ }
+ export interface SPInvitationCreationResult {
+ Succeeded?: boolean;
+ Email?: string;
+ InvitationLink?: string;
+ }
+ export interface SharingRecipient {
+ email?: string;
+ alias?: string;
+ }
+ export interface SharingEntityPermission {
+ /**
+ * The Input Entity provided to the Call.
+ */
+ inputEntity: string;
+ /**
+ * The Resolved Entity after resolving using PeoplePicker API.
+ */
+ resolvedEntity: string;
+ /**
+ * Does the Entity have Access to the Securable Object
+ */
+ hasAccess: boolean;
+ /**
+ * Role of the Entity on ListItem
+ */
+ role: SharingRole;
+ }
+ export interface SharingInformationRequest {
+ /**
+ * Max Principal's to return.
+ */
+ maxPrincipalsToReturn: number;
+ /**
+ * Supported Features (For future use by Office Client).
+ */
+ clientSupportedFeatures: string;
+ }
+ export interface ObjectSharingSettings {
+ /**
+ * The URL pointing to the containing SPWeb object
+ */
+ WebUrl: string;
+ /**
+ * The unique ID of the parent list (if applicable)
+ */
+ ListId?: string;
+ /**
+ * The list item ID (if applicable)
+ */
+ ItemId?: string;
+ /**
+ * The object title
+ */
+ ItemName: string;
+ /**
+ * The server relative object URL
+ */
+ ItemUrl: string;
+ /**
+ * Contains information about the sharing state of a shareable object
+ */
+ ObjectSharingInformation: any;
+ /**
+ * Boolean indicating whether the sharing context operates under the access request mode
+ */
+ AccessRequestMode: boolean;
+ /**
+ * Boolean indicating whether the sharing context operates under the permissions only mode
+ * (i.e. adding to a group or hiding the groups dropdown in the SharePoint UI)
+ */
+ PermissionsOnlyMode: boolean;
+ /**
+ * URL of the site from which the shared object inherits permissions
+ */
+ InheritingWebLink: string;
+ /**
+ * Boolean flag denoting if guest users are enabled for the site collection
+ */
+ ShareByEmailEnabled: boolean;
+ /**
+ * Boolean indicating whether the current user is a guest user
+ */
+ IsGuestUser: boolean;
+ /**
+ * Boolean indicating whether the site has the standard "Editor" role
+ */
+ HasEditRole: boolean;
+ /**
+ * Boolean indicating whether the site has the standard "Reader" role
+ */
+ HasReadRole: boolean;
+ /**
+ * Boolean indicating whether the object to share is a picture library
+ */
+ IsPictureLibrary: boolean;
+ /**
+ * Boolean indicating whether the folder object can be shared
+ */
+ CanShareFolder: boolean;
+ /**
+ * Boolean indicating whether email invitations can be sent
+ */
+ CanSendEmail: boolean;
+ /**
+ * Default share link type
+ */
+ DefaultShareLinkType: SharingLinkKind;
+ /**
+ * Boolean indicating whether the object to share supports ACL propagation
+ */
+ SupportsAclPropagation: boolean;
+ /**
+ * Boolean indicating whether the current user can only share within the tenancy
+ */
+ CanCurrentUserShareInternally: boolean;
+ /**
+ * Boolean indicating whether the current user can share outside the tenancy, by inviting external users
+ */
+ CanCurrentUserShareExternally: boolean;
+ /**
+ * Boolean indicating whether the current user can retrieve an anonymous View link, if one has already been created
+ * If one has not been created, the user cannot create one
+ */
+ CanCurrentUserRetrieveReadonlyLink: boolean;
+ /**
+ * Boolean indicating whether the current user can create or disable an anonymous Edit link
+ */
+ CanCurrentUserManageReadonlyLink: boolean;
+ /**
+ * Boolean indicating whether the current user can retrieve an anonymous Edit link, if one has already been created
+ * If one has not been created, the user cannot create one
+ */
+ CanCurrentUserRetrieveReadWriteLink: boolean;
+ /**
+ * Boolean indicating whether the current user can create or disable an anonymous Edit link
+ */
+ CanCurrentUserManageReadWriteLink: boolean;
+ /**
+ * Boolean indicating whether the current user can retrieve an organization View link, if one has already been created
+ * If one has not been created, the user cannot create one
+ */
+ CanCurrentUserRetrieveOrganizationReadonlyLink: boolean;
+ /**
+ * Boolean indicating whether the current user can create or disable an organization Edit link
+ */
+ CanCurrentUserManageOrganizationReadonlyLink: boolean;
+ /**
+ * Boolean indicating whether the current user can retrieve an organization Edit link, if one has already been created
+ * If one has not been created, the user cannot create one
+ */
+ CanCurrentUserRetrieveOrganizationReadWriteLink: boolean;
+ /**
+ * Boolean indicating whether the current user can create or disable an organization Edit link
+ */
+ CanCurrentUserManageOrganizationReadWriteLink: boolean;
+ /**
+ * Boolean indicating whether the current user can make use of Share-By-Link
+ */
+ CanSendLink: boolean;
+ /**
+ * Boolean indicating whether the client logic should warn the user
+ * that they are about to share with external email addresses.
+ */
+ ShowExternalSharingWarning: boolean;
+ /**
+ * A list of SharingPermissionInformation objects that can be used to share
+ */
+ SharingPermissions: any[];
+ /**
+ * A dictionary object that lists the display name and the id of
+ * the SharePoint simplified roles (edit, view)
+ */
+ SimplifiedRoles: {
+ [key: string]: string;
+ };
+ /**
+ * A dictionary object that lists the display name and the id of the SharePoint groups
+ */
+ GroupsList: {
+ [key: string]: string;
+ };
+ /**
+ * A dictionary object that lists the display name and the id of the SharePoint regular roles
+ */
+ Roles: {
+ [key: string]: string;
+ };
+ /**
+ * An object containing the SharePoint UI specific sharing settings.
+ */
+ SharePointSettings: any;
+ /**
+ * Boolean indicating whether the current user is a site collection administrator
+ */
+ IsUserSiteAdmin: boolean;
+ /**
+ * A value that indicates number of days an anonymous link can be valid before it expires
+ */
+ RequiredAnonymousLinkExpirationInDays: number;
+ }
+ export interface SharingInformation {
+ /**
+ * External Sharing.
+ */
+ canAddExternalPrincipal?: boolean;
+ /**
+ * Internal Sharing.
+ */
+ canAddInternalPrincipal?: boolean;
+ /**
+ * Can Send Email.
+ */
+ canSendEmail?: boolean;
+ /**
+ * Can Use Simplified Roles present in Roles Enum.
+ */
+ canUseSimplifiedRoles?: boolean;
+ /**
+ * Has Unique Permissions.
+ */
+ hasUniquePermissions?: boolean;
+ /**
+ * Current Users Role on the Item.
+ */
+ currentRole?: SharingRole;
+ /**
+ * Does the User+Item require Approval from Admin for Sharing.
+ */
+ requiresAccessApproval?: boolean;
+ /**
+ * (Owners only)Whether there are pending access requests for the securable object.
+ */
+ hasPendingAccessRequests?: boolean;
+ /**
+ * (Owners only)The link to the access requests page for the securable object, or an empty string if the link is not available.
+ */
+ pendingAccessRequestsLink?: string;
+ /**
+ * sharedObjectType
+ */
+ sharedObjectType?: SPSharedObjectType;
+ /**
+ * Url for the Securable Object (Encoded).
+ */
+ directUrl?: string;
+ /**
+ * Parent Web Url for the Securable Object (Encoded).
+ */
+ webUrl?: string;
+ /**
+ * Default SharingLinkKind.
+ */
+ defaultLinkKind?: SharingLinkKind;
+ /**
+ * Tenant's SharingDomainRestrictionMode.
+ */
+ domainRestrictionMode?: SharingDomainRestrictionMode;
+ /**
+ * Tenant's RestrictedDomains.
+ */
+ RestrictedDomains?: string;
+ /**
+ * Tenant's Anonymous Link Expiration Restriction in Days.
+ */
+ anonymousLinkExpirationRestrictionDays?: number;
+ /**
+ * The PermissionCollection that are on the Securable Object (Princpals & Links)
+ */
+ permissionsInformation?: any;
+ /**
+ * PickerSettings used by the PeoplePicker Control.
+ */
+ pickerSettings?: any;
+ }
+ export enum SPSharedObjectType {
+ Unknown = 0,
+ File = 1,
+ Folder = 2,
+ Item = 3,
+ List = 4,
+ Web = 5,
+ Max = 6,
+ }
+ export enum SharingDomainRestrictionMode {
+ None = 0,
+ AllowList = 1,
+ BlockList = 2,
+ }
+ export interface EmailProperties {
+ To: string[];
+ CC?: string[];
+ BCC?: string[];
+ Subject: string;
+ Body: string;
+ AdditionalHeaders?: TypedHash;
+ From?: string;
+ }
+ export interface WikiPageCreationInformation {
+ /**
+ * The server-relative-url of the wiki page to be created.
+ */
+ ServerRelativeUrl: string;
+ /**
+ * The wiki content to be set in the wiki page.
+ */
+ WikiHtmlContent: string;
+ }
+}
+declare module "sharepoint/roles" {
+ import { Queryable, QueryableInstance, QueryableCollection } from "sharepoint/queryable";
+ import { SiteGroups } from "sharepoint/sitegroups";
+ import { BasePermissions } from "sharepoint/types";
+ import { TypedHash } from "collections/collections";
+ /**
+ * Describes a set of role assignments for the current scope
+ *
+ */
+ export class RoleAssignments extends QueryableCollection {
+ /**
+ * Creates a new instance of the RoleAssignments class
+ *
+ * @param baseUrl The url or Queryable which forms the parent of this role assignments collection
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * Adds a new role assignment with the specified principal and role definitions to the collection
+ *
+ * @param principalId The id of the user or group to assign permissions to
+ * @param roleDefId The id of the role definition that defines the permissions to assign
+ *
+ */
+ add(principalId: number, roleDefId: number): Promise;
+ /**
+ * Removes the role assignment with the specified principal and role definition from the collection
+ *
+ * @param principalId The id of the user or group in the role assignment
+ * @param roleDefId The id of the role definition in the role assignment
+ *
+ */
+ remove(principalId: number, roleDefId: number): Promise;
+ /**
+ * Gets the role assignment associated with the specified principal id from the collection.
+ *
+ * @param id The id of the role assignment
+ */
+ getById(id: number): RoleAssignment;
+ }
+ /**
+ * Describes a role assignment
+ *
+ */
+ export class RoleAssignment extends QueryableInstance {
+ /**
+ * Gets the groups that directly belong to the access control list (ACL) for this securable object
+ *
+ */
+ readonly groups: SiteGroups;
+ /**
+ * Gets the role definition bindings for this role assignment
+ *
+ */
+ readonly bindings: RoleDefinitionBindings;
+ /**
+ * Deletes this role assignment
+ *
+ */
+ delete(): Promise;
+ }
+ /**
+ * Describes a collection of role definitions
+ *
+ */
+ export class RoleDefinitions extends QueryableCollection {
+ /**
+ * Creates a new instance of the RoleDefinitions class
+ *
+ * @param baseUrl The url or Queryable which forms the parent of this role definitions collection
+ *
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * Gets the role definition with the specified id from the collection
+ *
+ * @param id The id of the role definition
+ *
+ */
+ getById(id: number): RoleDefinition;
+ /**
+ * Gets the role definition with the specified name
+ *
+ * @param name The name of the role definition
+ *
+ */
+ getByName(name: string): RoleDefinition;
+ /**
+ * Gets the role definition with the specified role type
+ *
+ * @param roleTypeKind The roletypekind of the role definition (None=0, Guest=1, Reader=2, Contributor=3, WebDesigner=4, Administrator=5, Editor=6, System=7)
+ *
+ */
+ getByType(roleTypeKind: number): RoleDefinition;
+ /**
+ * Creates a role definition
+ *
+ * @param name The new role definition's name
+ * @param description The new role definition's description
+ * @param order The order in which the role definition appears
+ * @param basePermissions The permissions mask for this role definition
+ *
+ */
+ add(name: string, description: string, order: number, basePermissions: BasePermissions): Promise;
+ }
+ /**
+ * Describes a role definition
+ *
+ */
+ export class RoleDefinition extends QueryableInstance {
+ /**
+ * Updates this role definition with the supplied properties
+ *
+ * @param properties A plain object hash of values to update for the role definition
+ */
+ update(properties: TypedHash): Promise;
+ /**
+ * Deletes this role definition
+ *
+ */
+ delete(): Promise;
+ }
+ /**
+ * Result from updating a role definition
+ *
+ */
+ export interface RoleDefinitionUpdateResult {
+ definition: RoleDefinition;
+ data: any;
+ }
+ /**
+ * Result from adding a role definition
+ *
+ */
+ export interface RoleDefinitionAddResult {
+ definition: RoleDefinition;
+ data: any;
+ }
+ /**
+ * Describes the role definitons bound to a role assignment object
+ *
+ */
+ export class RoleDefinitionBindings extends QueryableCollection {
+ /**
+ * Creates a new instance of the RoleDefinitionBindings class
+ *
+ * @param baseUrl The url or Queryable which forms the parent of this role definition bindings collection
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ }
+}
+declare module "sharepoint/queryablesecurable" {
+ import { RoleAssignments } from "sharepoint/roles";
+ import { BasePermissions, PermissionKind } from "sharepoint/types";
+ import { QueryableInstance } from "sharepoint/queryable";
+ export class QueryableSecurable extends QueryableInstance {
+ /**
+ * Gets the set of role assignments for this item
+ *
+ */
+ readonly roleAssignments: RoleAssignments;
+ /**
+ * Gets the closest securable up the security hierarchy whose permissions are applied to this list item
+ *
+ */
+ readonly firstUniqueAncestorSecurableObject: QueryableInstance;
+ /**
+ * Gets the effective permissions for the user supplied
+ *
+ * @param loginName The claims username for the user (ex: i:0#.f|membership|user@domain.com)
+ */
+ getUserEffectivePermissions(loginName: string): Promise;
+ /**
+ * Gets the effective permissions for the current user
+ */
+ getCurrentUserEffectivePermissions(): Promise;
+ /**
+ * Breaks the security inheritance at this level optinally copying permissions and clearing subscopes
+ *
+ * @param copyRoleAssignments If true the permissions are copied from the current parent scope
+ * @param clearSubscopes Optional. true to make all child securable objects inherit role assignments from the current object
+ */
+ breakRoleInheritance(copyRoleAssignments?: boolean, clearSubscopes?: boolean): Promise;
+ /**
+ * Removes the local role assignments so that it re-inherit role assignments from the parent object.
+ *
+ */
+ resetRoleInheritance(): Promise;
+ /**
+ * Determines if a given user has the appropriate permissions
+ *
+ * @param loginName The user to check
+ * @param permission The permission being checked
+ */
+ userHasPermissions(loginName: string, permission: PermissionKind): Promise;
+ /**
+ * Determines if the current user has the requested permissions
+ *
+ * @param permission The permission we wish to check
+ */
+ currentUserHasPermissions(permission: PermissionKind): Promise;
+ /**
+ * Taken from sp.js, checks the supplied permissions against the mask
+ *
+ * @param value The security principal's permissions on the given object
+ * @param perm The permission checked against the value
+ */
+ hasPermissions(value: BasePermissions, perm: PermissionKind): boolean;
+ }
+}
+declare module "sharepoint/queryableshareable" {
+ import { Queryable, QueryableInstance } from "sharepoint/queryable";
+ import { QueryableSecurable } from "sharepoint/queryablesecurable";
+ import { RoleType, SharingLinkKind, ShareLinkResponse, SharingRole, SharingEmailData, SharingResult, SharingRecipient, SharingEntityPermission, SharingInformationRequest, ObjectSharingSettings, SharingInformation, ShareObjectOptions } from "sharepoint/types";
+ /**
+ * Internal helper class used to augment classes to include sharing functionality
+ */
+ export class QueryableShareable extends Queryable {
+ /**
+ * Gets a sharing link for the supplied
+ *
+ * @param kind The kind of link to share
+ * @param expiration The optional expiration for this link
+ */
+ getShareLink(kind: SharingLinkKind, expiration?: Date): Promise;
+ /**
+ * Shares this instance with the supplied users
+ *
+ * @param loginNames Resolved login names to share
+ * @param role The role
+ * @param requireSignin True to require the user is authenticated, otherwise false
+ * @param propagateAcl True to apply this share to all children
+ * @param emailData If supplied an email will be sent with the indicated properties
+ */
+ shareWith(loginNames: string | string[], role: SharingRole, requireSignin?: boolean, propagateAcl?: boolean, emailData?: SharingEmailData): Promise;
+ /**
+ * Shares an object based on the supplied options
+ *
+ * @param options The set of options to send to the ShareObject method
+ * @param bypass If true any processing is skipped and the options are sent directly to the ShareObject method
+ */
+ shareObject(options: ShareObjectOptions, bypass?: boolean): Promise;
+ /**
+ * Calls the web's UnshareObject method
+ *
+ * @param url The url of the object to unshare
+ */
+ unshareObjectWeb(url: string): Promise;
+ /**
+ * Checks Permissions on the list of Users and returns back role the users have on the Item.
+ *
+ * @param recipients The array of Entities for which Permissions need to be checked.
+ */
+ checkPermissions(recipients: SharingRecipient[]): Promise;
+ /**
+ * Get Sharing Information.
+ *
+ * @param request The SharingInformationRequest Object.
+ */
+ getSharingInformation(request?: SharingInformationRequest): Promise;
+ /**
+ * Gets the sharing settings of an item.
+ *
+ * @param useSimplifiedRoles Determines whether to use simplified roles.
+ */
+ getObjectSharingSettings(useSimplifiedRoles?: boolean): Promise;
+ /**
+ * Unshares this object
+ */
+ unshareObject(): Promise;
+ /**
+ * Deletes a link by type
+ *
+ * @param kind Deletes a sharing link by the kind of link
+ */
+ deleteLinkByKind(kind: SharingLinkKind): Promise;
+ /**
+ * Removes the specified link to the item.
+ *
+ * @param kind The kind of link to be deleted.
+ * @param shareId
+ */
+ unshareLink(kind: SharingLinkKind, shareId?: string): Promise;
+ /**
+ * Calculates the roleValue string used in the sharing query
+ *
+ * @param role The Sharing Role
+ * @param group The Group type
+ */
+ protected getRoleValue(role: SharingRole, group: RoleType): Promise;
+ private getShareObjectWeb(candidate);
+ private sendShareObjectRequest(options);
+ }
+ export class QueryableShareableWeb extends QueryableSecurable {
+ /**
+ * Shares this web with the supplied users
+ * @param loginNames The resolved login names to share
+ * @param role The role to share this web
+ * @param emailData Optional email data
+ */
+ shareWith(loginNames: string | string[], role?: SharingRole, emailData?: SharingEmailData): Promise;
+ /**
+ * Provides direct access to the static web.ShareObject method
+ *
+ * @param url The url to share
+ * @param loginNames Resolved loginnames string[] of a single login name string
+ * @param roleValue Role value
+ * @param emailData Optional email data
+ * @param groupId Optional group id
+ * @param propagateAcl
+ * @param includeAnonymousLinkInEmail
+ * @param useSimplifiedRoles
+ */
+ shareObject(url: string, loginNames: string | string[], role: SharingRole, emailData?: SharingEmailData, group?: RoleType, propagateAcl?: boolean, includeAnonymousLinkInEmail?: boolean, useSimplifiedRoles?: boolean): Promise;
+ /**
+ * Supplies a method to pass any set of arguments to ShareObject
+ *
+ * @param options The set of options to send to ShareObject
+ */
+ shareObjectRaw(options: any): Promise;
+ /**
+ * Unshares the object
+ *
+ * @param url The url of the object to stop sharing
+ */
+ unshareObject(url: string): Promise;
+ }
+ export class QueryableShareableItem extends QueryableSecurable {
+ /**
+ * Gets a link suitable for sharing for this item
+ *
+ * @param kind The type of link to share
+ * @param expiration The optional expiration date
+ */
+ getShareLink(kind?: SharingLinkKind, expiration?: Date): Promise;
+ /**
+ * Shares this item with one or more users
+ *
+ * @param loginNames string or string[] of resolved login names to which this item will be shared
+ * @param role The role (View | Edit) applied to the share
+ * @param emailData Optional, if inlucded an email will be sent. Note subject currently has no effect.
+ */
+ shareWith(loginNames: string | string[], role?: SharingRole, requireSignin?: boolean, emailData?: SharingEmailData): Promise;
+ /**
+ * Checks Permissions on the list of Users and returns back role the users have on the Item.
+ *
+ * @param recipients The array of Entities for which Permissions need to be checked.
+ */
+ checkSharingPermissions(recipients: SharingRecipient[]): Promise;
+ /**
+ * Get Sharing Information.
+ *
+ * @param request The SharingInformationRequest Object.
+ */
+ getSharingInformation(request?: SharingInformationRequest): Promise;
+ /**
+ * Gets the sharing settings of an item.
+ *
+ * @param useSimplifiedRoles Determines whether to use simplified roles.
+ */
+ getObjectSharingSettings(useSimplifiedRoles?: boolean): Promise;
+ /**
+ * Unshare this item
+ */
+ unshare(): Promise;
+ /**
+ * Deletes a sharing link by kind
+ *
+ * @param kind Deletes a sharing link by the kind of link
+ */
+ deleteSharingLinkByKind(kind: SharingLinkKind): Promise;
+ /**
+ * Removes the specified link to the item.
+ *
+ * @param kind The kind of link to be deleted.
+ * @param shareId
+ */
+ unshareLink(kind: SharingLinkKind, shareId?: string): Promise;
+ }
+ export class FileFolderShared extends QueryableInstance {
+ /**
+ * Gets a link suitable for sharing
+ *
+ * @param kind The kind of link to get
+ * @param expiration Optional, an expiration for this link
+ */
+ getShareLink(kind?: SharingLinkKind, expiration?: Date): Promise;
+ /**
+ * Checks Permissions on the list of Users and returns back role the users have on the Item.
+ *
+ * @param recipients The array of Entities for which Permissions need to be checked.
+ */
+ checkSharingPermissions(recipients: SharingRecipient[]): Promise;
+ /**
+ * Get Sharing Information.
+ *
+ * @param request The SharingInformationRequest Object.
+ */
+ getSharingInformation(request?: SharingInformationRequest): Promise;
+ /**
+ * Gets the sharing settings of an item.
+ *
+ * @param useSimplifiedRoles Determines whether to use simplified roles.
+ */
+ getObjectSharingSettings(useSimplifiedRoles?: boolean): Promise;
+ /**
+ * Unshare this item
+ */
+ unshare(): Promise;
+ /**
+ * Deletes a sharing link by the kind of link
+ *
+ * @param kind The kind of link to be deleted.
+ */
+ deleteSharingLinkByKind(kind: SharingLinkKind): Promise;
+ /**
+ * Removes the specified link to the item.
+ *
+ * @param kind The kind of link to be deleted.
+ * @param shareId The share id to delete
+ */
+ unshareLink(kind: SharingLinkKind, shareId?: string): Promise;
+ /**
+ * For files and folders we need to use the associated item end point
+ */
+ protected getShareable(): Promise;
+ }
+ export class QueryableShareableFile extends FileFolderShared {
+ /**
+ * Shares this item with one or more users
+ *
+ * @param loginNames string or string[] of resolved login names to which this item will be shared
+ * @param role The role (View | Edit) applied to the share
+ * @param shareEverything Share everything in this folder, even items with unique permissions.
+ * @param requireSignin If true the user must signin to view link, otherwise anyone with the link can access the resource
+ * @param emailData Optional, if inlucded an email will be sent. Note subject currently has no effect.
+ */
+ shareWith(loginNames: string | string[], role?: SharingRole, requireSignin?: boolean, emailData?: SharingEmailData): Promise;
+ }
+ export class QueryableShareableFolder extends FileFolderShared {
+ /**
+ * Shares this item with one or more users
+ *
+ * @param loginNames string or string[] of resolved login names to which this item will be shared
+ * @param role The role (View | Edit) applied to the share
+ * @param shareEverything Share everything in this folder, even items with unique permissions.
+ * @param requireSignin If true the user must signin to view link, otherwise anyone with the link can access the resource
+ * @param emailData Optional, if inlucded an email will be sent. Note subject currently has no effect.
+ */
+ shareWith(loginNames: string | string[], role?: SharingRole, requireSignin?: boolean, shareEverything?: boolean, emailData?: SharingEmailData): Promise;
+ }
+}
+declare module "sharepoint/webparts" {
+ import { Queryable, QueryableInstance, QueryableCollection } from "sharepoint/queryable";
+ export class LimitedWebPartManager extends Queryable {
+ /**
+ * Gets the set of web part definitions contained by this web part manager
+ *
+ */
+ readonly webparts: WebPartDefinitions;
+ /**
+ * Exports a webpart definition
+ *
+ * @param id the GUID id of the definition to export
+ */
+ export(id: string): Promise;
+ /**
+ * Imports a webpart
+ *
+ * @param xml webpart definition which must be valid XML in the .dwp or .webpart format
+ */
+ import(xml: string): Promise;
+ }
+ export class WebPartDefinitions extends QueryableCollection {
+ /**
+ * Gets a web part definition from the collection by id
+ *
+ * @param id The storage ID of the SPWebPartDefinition to retrieve
+ */
+ getById(id: string): WebPartDefinition;
+ /**
+ * Gets a web part definition from the collection by storage id
+ *
+ * @param id The WebPart.ID of the SPWebPartDefinition to retrieve
+ */
+ getByControlId(id: string): WebPartDefinition;
+ }
+ export class WebPartDefinition extends QueryableInstance {
+ /**
+ * Gets the webpart information associated with this definition
+ */
+ readonly webpart: WebPart;
+ /**
+ * Saves changes to the Web Part made using other properties and methods on the SPWebPartDefinition object
+ */
+ saveChanges(): Promise;
+ /**
+ * Moves the Web Part to a different location on a Web Part Page
+ *
+ * @param zoneId The ID of the Web Part Zone to which to move the Web Part
+ * @param zoneIndex A Web Part zone index that specifies the position at which the Web Part is to be moved within the destination Web Part zone
+ */
+ moveTo(zoneId: string, zoneIndex: number): Promise;
+ /**
+ * Closes the Web Part. If the Web Part is already closed, this method does nothing
+ */
+ close(): Promise;
+ /**
+ * Opens the Web Part. If the Web Part is already closed, this method does nothing
+ */
+ open(): Promise;
+ /**
+ * Removes a webpart from a page, all settings will be lost
+ */
+ delete(): Promise;
+ }
+ export class WebPart extends QueryableInstance {
+ /**
+ * Creates a new instance of the WebPart class
+ *
+ * @param baseUrl The url or Queryable which forms the parent of this fields collection
+ * @param path Optional, if supplied will be appended to the supplied baseUrl
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ }
+}
+declare module "sharepoint/files" {
+ import { Queryable, QueryableCollection, QueryableInstance } from "sharepoint/queryable";
+ import { LimitedWebPartManager } from "sharepoint/webparts";
+ import { Item } from "sharepoint/items";
+ import { QueryableShareableFile } from "sharepoint/queryableshareable";
+ export interface ChunkedFileUploadProgressData {
+ stage: "starting" | "continue" | "finishing";
+ blockNumber: number;
+ totalBlocks: number;
+ chunkSize: number;
+ currentPointer: number;
+ fileSize: number;
+ }
+ /**
+ * Describes a collection of File objects
+ *
+ */
+ export class Files extends QueryableCollection {
+ /**
+ * Creates a new instance of the Files class
+ *
+ * @param baseUrl The url or Queryable which forms the parent of this fields collection
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * Gets a File by filename
+ *
+ * @param name The name of the file, including extension.
+ */
+ getByName(name: string): File;
+ /**
+ * Uploads a file. Not supported for batching
+ *
+ * @param url The folder-relative url of the file.
+ * @param content The file contents blob.
+ * @param shouldOverWrite Should a file with the same name in the same location be overwritten? (default: true)
+ * @returns The new File and the raw response.
+ */
+ add(url: string, content: string | ArrayBuffer | Blob, shouldOverWrite?: boolean): Promise;
+ /**
+ * Uploads a file. Not supported for batching
+ *
+ * @param url The folder-relative url of the file.
+ * @param content The Blob file content to add
+ * @param progress A callback function which can be used to track the progress of the upload
+ * @param shouldOverWrite Should a file with the same name in the same location be overwritten? (default: true)
+ * @param chunkSize The size of each file slice, in bytes (default: 10485760)
+ * @returns The new File and the raw response.
+ */
+ addChunked(url: string, content: Blob, progress?: (data: ChunkedFileUploadProgressData) => void, shouldOverWrite?: boolean, chunkSize?: number): Promise;
+ /**
+ * Adds a ghosted file to an existing list or document library. Not supported for batching.
+ *
+ * @param fileUrl The server-relative url where you want to save the file.
+ * @param templateFileType The type of use to create the file.
+ * @returns The template file that was added and the raw response.
+ */
+ addTemplateFile(fileUrl: string, templateFileType: TemplateFileType): Promise;
+ }
+ /**
+ * Describes a single File instance
+ *
+ */
+ export class File extends QueryableShareableFile {
+ /**
+ * Gets a value that specifies the list item field values for the list item corresponding to the file.
+ *
+ */
+ readonly listItemAllFields: QueryableCollection;
+ /**
+ * Gets a collection of versions
+ *
+ */
+ readonly versions: Versions;
+ /**
+ * Approves the file submitted for content approval with the specified comment.
+ * Only documents in lists that are enabled for content approval can be approved.
+ *
+ * @param comment The comment for the approval.
+ */
+ approve(comment?: string): Promise;
+ /**
+ * Stops the chunk upload session without saving the uploaded data. Does not support batching.
+ * If the file doesn’t already exist in the library, the partially uploaded file will be deleted.
+ * Use this in response to user action (as in a request to cancel an upload) or an error or exception.
+ * Use the uploadId value that was passed to the StartUpload method that started the upload session.
+ * This method is currently available only on Office 365.
+ *
+ * @param uploadId The unique identifier of the upload session.
+ */
+ cancelUpload(uploadId: string): Promise;
+ /**
+ * Checks the file in to a document library based on the check-in type.
+ *
+ * @param comment A comment for the check-in. Its length must be <= 1023.
+ * @param checkinType The check-in type for the file.
+ */
+ checkin(comment?: string, checkinType?: CheckinType): Promise;
+ /**
+ * Checks out the file from a document library.
+ */
+ checkout(): Promise;
+ /**
+ * Copies the file to the destination url.
+ *
+ * @param url The absolute url or server relative url of the destination file path to copy to.
+ * @param shouldOverWrite Should a file with the same name in the same location be overwritten?
+ */
+ copyTo(url: string, shouldOverWrite?: boolean): Promise;
+ /**
+ * Delete this file.
+ *
+ * @param eTag Value used in the IF-Match header, by default "*"
+ */
+ delete(eTag?: string): Promise;
+ /**
+ * Denies approval for a file that was submitted for content approval.
+ * Only documents in lists that are enabled for content approval can be denied.
+ *
+ * @param comment The comment for the denial.
+ */
+ deny(comment?: string): Promise;
+ /**
+ * Specifies the control set used to access, modify, or add Web Parts associated with this Web Part Page and view.
+ * An exception is thrown if the file is not an ASPX page.
+ *
+ * @param scope The WebPartsPersonalizationScope view on the Web Parts page.
+ */
+ getLimitedWebPartManager(scope?: WebPartsPersonalizationScope): LimitedWebPartManager;
+ /**
+ * Moves the file to the specified destination url.
+ *
+ * @param url The absolute url or server relative url of the destination file path to move to.
+ * @param moveOperations The bitwise MoveOperations value for how to move the file.
+ */
+ moveTo(url: string, moveOperations?: MoveOperations): Promise;
+ /**
+ * Submits the file for content approval with the specified comment.
+ *
+ * @param comment The comment for the published file. Its length must be <= 1023.
+ */
+ publish(comment?: string): Promise;
+ /**
+ * Moves the file to the Recycle Bin and returns the identifier of the new Recycle Bin item.
+ *
+ * @returns The GUID of the recycled file.
+ */
+ recycle(): Promise;
+ /**
+ * Reverts an existing checkout for the file.
+ *
+ */
+ undoCheckout(): Promise;
+ /**
+ * Removes the file from content approval or unpublish a major version.
+ *
+ * @param comment The comment for the unpublish operation. Its length must be <= 1023.
+ */
+ unpublish(comment?: string): Promise;
+ /**
+ * Gets the contents of the file as text. Not supported in batching.
+ *
+ */
+ getText(): Promise;
+ /**
+ * Gets the contents of the file as a blob, does not work in Node.js. Not supported in batching.
+ *
+ */
+ getBlob(): Promise;
+ /**
+ * Gets the contents of a file as an ArrayBuffer, works in Node.js. Not supported in batching.
+ */
+ getBuffer(): Promise;
+ /**
+ * Gets the contents of a file as an ArrayBuffer, works in Node.js. Not supported in batching.
+ */
+ getJSON(): Promise;
+ /**
+ * Sets the content of a file, for large files use setContentChunked. Not supported in batching.
+ *
+ * @param content The file content
+ *
+ */
+ setContent(content: string | ArrayBuffer | Blob): Promise;
+ /**
+ * Gets the associated list item for this folder, loading the default properties
+ */
+ getItem(...selects: string[]): Promise- ;
+ /**
+ * Sets the contents of a file using a chunked upload approach. Not supported in batching.
+ *
+ * @param file The file to upload
+ * @param progress A callback function which can be used to track the progress of the upload
+ * @param chunkSize The size of each file slice, in bytes (default: 10485760)
+ */
+ setContentChunked(file: Blob, progress?: (data: ChunkedFileUploadProgressData) => void, chunkSize?: number): Promise;
+ /**
+ * Starts a new chunk upload session and uploads the first fragment.
+ * The current file content is not changed when this method completes.
+ * The method is idempotent (and therefore does not change the result) as long as you use the same values for uploadId and stream.
+ * The upload session ends either when you use the CancelUpload method or when you successfully
+ * complete the upload session by passing the rest of the file contents through the ContinueUpload and FinishUpload methods.
+ * The StartUpload and ContinueUpload methods return the size of the running total of uploaded data in bytes,
+ * so you can pass those return values to subsequent uses of ContinueUpload and FinishUpload.
+ * This method is currently available only on Office 365.
+ *
+ * @param uploadId The unique identifier of the upload session.
+ * @param fragment The file contents.
+ * @returns The size of the total uploaded data in bytes.
+ */
+ private startUpload(uploadId, fragment);
+ /**
+ * Continues the chunk upload session with an additional fragment.
+ * The current file content is not changed.
+ * Use the uploadId value that was passed to the StartUpload method that started the upload session.
+ * This method is currently available only on Office 365.
+ *
+ * @param uploadId The unique identifier of the upload session.
+ * @param fileOffset The size of the offset into the file where the fragment starts.
+ * @param fragment The file contents.
+ * @returns The size of the total uploaded data in bytes.
+ */
+ private continueUpload(uploadId, fileOffset, fragment);
+ /**
+ * Uploads the last file fragment and commits the file. The current file content is changed when this method completes.
+ * Use the uploadId value that was passed to the StartUpload method that started the upload session.
+ * This method is currently available only on Office 365.
+ *
+ * @param uploadId The unique identifier of the upload session.
+ * @param fileOffset The size of the offset into the file where the fragment starts.
+ * @param fragment The file contents.
+ * @returns The newly uploaded file.
+ */
+ private finishUpload(uploadId, fileOffset, fragment);
+ }
+ /**
+ * Describes a collection of Version objects
+ *
+ */
+ export class Versions extends QueryableCollection {
+ /**
+ * Creates a new instance of the File class
+ *
+ * @param baseUrl The url or Queryable which forms the parent of this fields collection
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * Gets a version by id
+ *
+ * @param versionId The id of the version to retrieve
+ */
+ getById(versionId: number): Version;
+ /**
+ * Deletes all the file version objects in the collection.
+ *
+ */
+ deleteAll(): Promise;
+ /**
+ * Deletes the specified version of the file.
+ *
+ * @param versionId The ID of the file version to delete.
+ */
+ deleteById(versionId: number): Promise;
+ /**
+ * Deletes the file version object with the specified version label.
+ *
+ * @param label The version label of the file version to delete, for example: 1.2
+ */
+ deleteByLabel(label: string): Promise;
+ /**
+ * Creates a new file version from the file specified by the version label.
+ *
+ * @param label The version label of the file version to restore, for example: 1.2
+ */
+ restoreByLabel(label: string): Promise;
+ }
+ /**
+ * Describes a single Version instance
+ *
+ */
+ export class Version extends QueryableInstance {
+ /**
+ * Delete a specific version of a file.
+ *
+ * @param eTag Value used in the IF-Match header, by default "*"
+ */
+ delete(eTag?: string): Promise;
+ }
+ export enum CheckinType {
+ Minor = 0,
+ Major = 1,
+ Overwrite = 2,
+ }
+ export interface FileAddResult {
+ file: File;
+ data: any;
+ }
+ export enum WebPartsPersonalizationScope {
+ User = 0,
+ Shared = 1,
+ }
+ export enum MoveOperations {
+ Overwrite = 1,
+ AllowBrokenThickets = 8,
+ }
+ export enum TemplateFileType {
+ StandardPage = 0,
+ WikiPage = 1,
+ FormPage = 2,
+ }
+}
+declare module "sharepoint/folders" {
+ import { Queryable, QueryableCollection, QueryableInstance } from "sharepoint/queryable";
+ import { QueryableShareableFolder } from "sharepoint/queryableshareable";
+ import { Files } from "sharepoint/files";
+ import { TypedHash } from "collections/collections";
+ import { Item } from "sharepoint/items";
+ /**
+ * Describes a collection of Folder objects
+ *
+ */
+ export class Folders extends QueryableCollection {
+ /**
+ * Creates a new instance of the Folders class
+ *
+ * @param baseUrl The url or Queryable which forms the parent of this fields collection
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * Gets a folder by folder name
+ *
+ */
+ getByName(name: string): Folder;
+ /**
+ * Adds a new folder to the current folder (relative) or any folder (absolute)
+ *
+ * @param url The relative or absolute url where the new folder will be created. Urls starting with a forward slash are absolute.
+ * @returns The new Folder and the raw response.
+ */
+ add(url: string): Promise;
+ }
+ /**
+ * Describes a single Folder instance
+ *
+ */
+ export class Folder extends QueryableShareableFolder {
+ /**
+ * Specifies the sequence in which content types are displayed.
+ *
+ */
+ readonly contentTypeOrder: QueryableCollection;
+ /**
+ * Gets this folder's files
+ *
+ */
+ readonly files: Files;
+ /**
+ * Gets this folder's sub folders
+ *
+ */
+ readonly folders: Folders;
+ /**
+ * Gets this folder's list item field values
+ *
+ */
+ readonly listItemAllFields: QueryableCollection;
+ /**
+ * Gets the parent folder, if available
+ *
+ */
+ readonly parentFolder: Folder;
+ /**
+ * Gets this folder's properties
+ *
+ */
+ readonly properties: QueryableInstance;
+ /**
+ * Gets this folder's server relative url
+ *
+ */
+ readonly serverRelativeUrl: Queryable;
+ /**
+ * Gets a value that specifies the content type order.
+ *
+ */
+ readonly uniqueContentTypeOrder: QueryableCollection;
+ update(properties: TypedHash): Promise;
+ /**
+ * Delete this folder
+ *
+ * @param eTag Value used in the IF-Match header, by default "*"
+ */
+ delete(eTag?: string): Promise;
+ /**
+ * Moves the folder to the Recycle Bin and returns the identifier of the new Recycle Bin item.
+ */
+ recycle(): Promise;
+ /**
+ * Gets the associated list item for this folder, loading the default properties
+ */
+ getItem(...selects: string[]): Promise
- ;
+ }
+ export interface FolderAddResult {
+ folder: Folder;
+ data: any;
+ }
+ export interface FolderUpdateResult {
+ folder: Folder;
+ data: any;
+ }
+}
+declare module "sharepoint/contenttypes" {
+ import { TypedHash } from "collections/collections";
+ import { Queryable, QueryableCollection, QueryableInstance } from "sharepoint/queryable";
+ /**
+ * Describes a collection of content types
+ *
+ */
+ export class ContentTypes extends QueryableCollection {
+ /**
+ * Creates a new instance of the ContentTypes class
+ *
+ * @param baseUrl The url or Queryable which forms the parent of this content types collection
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * Gets a ContentType by content type id
+ */
+ getById(id: string): ContentType;
+ /**
+ * Adds an existing contenttype to a content type collection
+ *
+ * @param contentTypeId in the following format, for example: 0x010102
+ */
+ addAvailableContentType(contentTypeId: string): Promise;
+ /**
+ * Adds a new content type to the collection
+ *
+ * @param id The desired content type id for the new content type (also determines the parent content type)
+ * @param name The name of the content type
+ * @param description The description of the content type
+ * @param group The group in which to add the content type
+ * @param additionalSettings Any additional settings to provide when creating the content type
+ *
+ */
+ add(id: string, name: string, description?: string, group?: string, additionalSettings?: TypedHash): Promise;
+ }
+ /**
+ * Describes a single ContentType instance
+ *
+ */
+ export class ContentType extends QueryableInstance {
+ /**
+ * Gets the column (also known as field) references in the content type.
+ */
+ readonly fieldLinks: FieldLinks;
+ /**
+ * Gets a value that specifies the collection of fields for the content type.
+ */
+ readonly fields: QueryableCollection;
+ /**
+ * Gets the parent content type of the content type.
+ */
+ readonly parent: ContentType;
+ /**
+ * Gets a value that specifies the collection of workflow associations for the content type.
+ */
+ readonly workflowAssociations: QueryableCollection;
+ /**
+ * Delete this content type
+ */
+ delete(): Promise;
+ }
+ export interface ContentTypeAddResult {
+ contentType: ContentType;
+ data: any;
+ }
+ /**
+ * Represents a collection of field link instances
+ */
+ export class FieldLinks extends QueryableCollection {
+ /**
+ * Creates a new instance of the ContentType class
+ *
+ * @param baseUrl The url or Queryable which forms the parent of this content type instance
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * Gets a FieldLink by GUID id
+ *
+ * @param id The GUID id of the field link
+ */
+ getById(id: string): FieldLink;
+ }
+ /**
+ * Represents a field link instance
+ */
+ export class FieldLink extends QueryableInstance {
+ }
+}
+declare module "sharepoint/attachmentfiles" {
+ import { Queryable, QueryableInstance, QueryableCollection } from "sharepoint/queryable";
+ export interface AttachmentFileInfo {
+ name: string;
+ content: string | Blob | ArrayBuffer;
+ }
+ /**
+ * Describes a collection of Item objects
+ *
+ */
+ export class AttachmentFiles extends QueryableCollection {
+ /**
+ * Creates a new instance of the AttachmentFiles class
+ *
+ * @param baseUrl The url or Queryable which forms the parent of this attachments collection
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * Gets a Attachment File by filename
+ *
+ * @param name The name of the file, including extension.
+ */
+ getByName(name: string): AttachmentFile;
+ /**
+ * Adds a new attachment to the collection. Not supported for batching.
+ *
+ * @param name The name of the file, including extension.
+ * @param content The Base64 file content.
+ */
+ add(name: string, content: string | Blob | ArrayBuffer): Promise;
+ /**
+ * Adds mjultiple new attachment to the collection. Not supported for batching.
+ *
+ * @files name The collection of files to add
+ */
+ addMultiple(files: AttachmentFileInfo[]): Promise;
+ }
+ /**
+ * Describes a single attachment file instance
+ *
+ */
+ export class AttachmentFile extends QueryableInstance {
+ /**
+ * Gets the contents of the file as text
+ *
+ */
+ getText(): Promise;
+ /**
+ * Gets the contents of the file as a blob, does not work in Node.js
+ *
+ */
+ getBlob(): Promise;
+ /**
+ * Gets the contents of a file as an ArrayBuffer, works in Node.js
+ */
+ getBuffer(): Promise;
+ /**
+ * Gets the contents of a file as an ArrayBuffer, works in Node.js
+ */
+ getJSON(): Promise;
+ /**
+ * Sets the content of a file. Not supported for batching
+ *
+ * @param content The value to set for the file contents
+ */
+ setContent(content: string | ArrayBuffer | Blob): Promise;
+ /**
+ * Delete this attachment file
+ *
+ * @param eTag Value used in the IF-Match header, by default "*"
+ */
+ delete(eTag?: string): Promise;
+ }
+ export interface AttachmentFileAddResult {
+ file: AttachmentFile;
+ data: any;
+ }
+}
+declare module "sharepoint/items" {
+ import { Queryable, QueryableCollection, QueryableInstance } from "sharepoint/queryable";
+ import { QueryableShareableItem } from "sharepoint/queryableshareable";
+ import { Folder } from "sharepoint/folders";
+ import { File } from "sharepoint/files";
+ import { ContentType } from "sharepoint/contenttypes";
+ import { TypedHash } from "collections/collections";
+ import { ListItemFormUpdateValue } from "sharepoint/types";
+ import { AttachmentFiles } from "sharepoint/attachmentfiles";
+ /**
+ * Describes a collection of Item objects
+ *
+ */
+ export class Items extends QueryableCollection {
+ /**
+ * Creates a new instance of the Items class
+ *
+ * @param baseUrl The url or Queryable which forms the parent of this fields collection
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * Gets an Item by id
+ *
+ * @param id The integer id of the item to retrieve
+ */
+ getById(id: number): Item;
+ /**
+ * Skips the specified number of items (https://msdn.microsoft.com/en-us/library/office/fp142385.aspx#sectionSection6)
+ *
+ * @param skip The starting id where the page should start, use with top to specify pages
+ */
+ skip(skip: number): this;
+ /**
+ * Gets a collection designed to aid in paging through data
+ *
+ */
+ getPaged(): Promise>;
+ /**
+ * Adds a new item to the collection
+ *
+ * @param properties The new items's properties
+ */
+ add(properties?: TypedHash, listItemEntityTypeFullName?: string): Promise;
+ /**
+ * Ensures we have the proper list item entity type name, either from the value provided or from the list
+ *
+ * @param candidatelistItemEntityTypeFullName The potential type name
+ */
+ private ensureListItemEntityTypeName(candidatelistItemEntityTypeFullName);
+ }
+ /**
+ * Descrines a single Item instance
+ *
+ */
+ export class Item extends QueryableShareableItem {
+ /**
+ * Gets the set of attachments for this item
+ *
+ */
+ readonly attachmentFiles: AttachmentFiles;
+ /**
+ * Gets the content type for this item
+ *
+ */
+ readonly contentType: ContentType;
+ /**
+ * Gets the effective base permissions for the item
+ *
+ */
+ readonly effectiveBasePermissions: Queryable;
+ /**
+ * Gets the effective base permissions for the item in a UI context
+ *
+ */
+ readonly effectiveBasePermissionsForUI: Queryable;
+ /**
+ * Gets the field values for this list item in their HTML representation
+ *
+ */
+ readonly fieldValuesAsHTML: QueryableInstance;
+ /**
+ * Gets the field values for this list item in their text representation
+ *
+ */
+ readonly fieldValuesAsText: QueryableInstance;
+ /**
+ * Gets the field values for this list item for use in editing controls
+ *
+ */
+ readonly fieldValuesForEdit: QueryableInstance;
+ /**
+ * Gets the folder associated with this list item (if this item represents a folder)
+ *
+ */
+ readonly folder: Folder;
+ /**
+ * Gets the folder associated with this list item (if this item represents a folder)
+ *
+ */
+ readonly file: File;
+ /**
+ * Updates this list intance with the supplied properties
+ *
+ * @param properties A plain object hash of values to update for the list
+ * @param eTag Value used in the IF-Match header, by default "*"
+ */
+ update(properties: TypedHash, eTag?: string): Promise;
+ /**
+ * Delete this item
+ *
+ * @param eTag Value used in the IF-Match header, by default "*"
+ */
+ delete(eTag?: string): Promise;
+ /**
+ * Moves the list item to the Recycle Bin and returns the identifier of the new Recycle Bin item.
+ */
+ recycle(): Promise;
+ /**
+ * Gets a string representation of the full URL to the WOPI frame.
+ * If there is no associated WOPI application, or no associated action, an empty string is returned.
+ *
+ * @param action Display mode: 0: view, 1: edit, 2: mobileView, 3: interactivePreview
+ */
+ getWopiFrameUrl(action?: number): Promise;
+ /**
+ * Validates and sets the values of the specified collection of fields for the list item.
+ *
+ * @param formValues The fields to change and their new values.
+ * @param newDocumentUpdate true if the list item is a document being updated after upload; otherwise false.
+ */
+ validateUpdateListItem(formValues: ListItemFormUpdateValue[], newDocumentUpdate?: boolean): Promise;
+ }
+ export interface ItemAddResult {
+ item: Item;
+ data: any;
+ }
+ export interface ItemUpdateResult {
+ item: Item;
+ data: ItemUpdateResultData;
+ }
+ export interface ItemUpdateResultData {
+ "odata.etag": string;
+ }
+ /**
+ * Provides paging functionality for list items
+ */
+ export class PagedItemCollection {
+ private nextUrl;
+ results: T;
+ constructor(nextUrl: string, results: T);
+ /**
+ * If true there are more results available in the set, otherwise there are not
+ */
+ readonly hasNext: boolean;
+ /**
+ * Gets the next set of results, or resolves to null if no results are available
+ */
+ getNext(): Promise>;
+ }
+}
+declare module "sharepoint/views" {
+ import { Queryable, QueryableCollection, QueryableInstance } from "sharepoint/queryable";
+ import { TypedHash } from "collections/collections";
+ /**
+ * Describes the views available in the current context
+ *
+ */
+ export class Views extends QueryableCollection {
+ /**
+ * Creates a new instance of the Views class
+ *
+ * @param baseUrl The url or Queryable which forms the parent of this fields collection
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * Gets a view by guid id
+ *
+ * @param id The GUID id of the view
+ */
+ getById(id: string): View;
+ /**
+ * Gets a view by title (case-sensitive)
+ *
+ * @param title The case-sensitive title of the view
+ */
+ getByTitle(title: string): View;
+ /**
+ * Adds a new view to the collection
+ *
+ * @param title The new views's title
+ * @param personalView True if this is a personal view, otherwise false, default = false
+ * @param additionalSettings Will be passed as part of the view creation body
+ */
+ add(title: string, personalView?: boolean, additionalSettings?: TypedHash): Promise;
+ }
+ /**
+ * Describes a single View instance
+ *
+ */
+ export class View extends QueryableInstance {
+ readonly fields: ViewFields;
+ /**
+ * Updates this view intance with the supplied properties
+ *
+ * @param properties A plain object hash of values to update for the view
+ */
+ update(properties: TypedHash): Promise;
+ /**
+ * Delete this view
+ *
+ */
+ delete(): Promise;
+ /**
+ * Returns the list view as HTML.
+ *
+ */
+ renderAsHtml(): Promise;
+ }
+ export class ViewFields extends QueryableCollection {
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * Gets a value that specifies the XML schema that represents the collection.
+ */
+ getSchemaXml(): Promise;
+ /**
+ * Adds the field with the specified field internal name or display name to the collection.
+ *
+ * @param fieldTitleOrInternalName The case-sensitive internal name or display name of the field to add.
+ */
+ add(fieldTitleOrInternalName: string): Promise;
+ /**
+ * Moves the field with the specified field internal name to the specified position in the collection.
+ *
+ * @param fieldInternalName The case-sensitive internal name of the field to move.
+ * @param index The zero-based index of the new position for the field.
+ */
+ move(fieldInternalName: string, index: number): Promise;
+ /**
+ * Removes all the fields from the collection.
+ */
+ removeAll(): Promise;
+ /**
+ * Removes the field with the specified field internal name from the collection.
+ *
+ * @param fieldInternalName The case-sensitive internal name of the field to remove from the view.
+ */
+ remove(fieldInternalName: string): Promise;
+ }
+ export interface ViewAddResult {
+ view: View;
+ data: any;
+ }
+ export interface ViewUpdateResult {
+ view: View;
+ data: any;
+ }
+}
+declare module "sharepoint/fields" {
+ import { Queryable, QueryableCollection, QueryableInstance } from "sharepoint/queryable";
+ import { TypedHash } from "collections/collections";
+ import { XmlSchemaFieldCreationInformation, DateTimeFieldFormatType, FieldTypes, CalendarType, UrlFieldFormatType } from "sharepoint/types";
+ /**
+ * Describes a collection of Field objects
+ *
+ */
+ export class Fields extends QueryableCollection {
+ /**
+ * Creates a new instance of the Fields class
+ *
+ * @param baseUrl The url or Queryable which forms the parent of this fields collection
+ */
+ constructor(baseUrl: string | Queryable, path?: string);
+ /**
+ * Gets a field from the collection by title
+ *
+ * @param title The case-sensitive title of the field
+ */
+ getByTitle(title: string): Field;
+ /**
+ * Gets a field from the collection by using internal name or title
+ *
+ * @param name The case-sensitive internal name or title of the field
+ */
+ getByInternalNameOrTitle(name: string): Field;
+ /**
+ * Gets a list from the collection by guid id
+ *
+ * @param title The Id of the list
+ */
+ getById(id: string): Field;
+ /**
+ * Creates a field based on the specified schema
+ */
+ createFieldAsXml(xml: string | XmlSchemaFieldCreationInformation): Promise;
+ /**
+ * Adds a new list to the collection
+ *
+ * @param title The new field's title
+ * @param fieldType The new field's type (ex: SP.FieldText)
+ * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
+ */
+ add(title: string, fieldType: string, properties?: TypedHash): Promise;
+ /**
+ * Adds a new SP.FieldText to the collection
+ *
+ * @param title The field title
+ * @param maxLength The maximum number of characters allowed in the value of the field.
+ * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
+ */
+ addText(title: string, maxLength?: number, properties?: TypedHash): Promise