interface IFile {
    _inheritingObservers: boolean;
    _url: string;
    delete: ((this: ISPQueryable<any>, eTag?: string) => Promise<void>);
    InternalPromise: symbol;
    InternalReject: symbol;
    InternalResolve: symbol;
    moments: {
        auth: ((observers: QueryableAuthObserver[], url: URL, init: RequestInit) => Promise<[url: URL, init: RequestInit]>);
        construct: ((observers: QueryableConstructObserver[], init: QueryableInit, path?: string) => Timeline<any>);
        data: ((observers: QueryableDataObserver<any>[], ...args: any[]) => void);
        parse: ((observers: QueryableParseObserver[], url: URL, response: Response, result: any) => Promise<[url: URL, response: Response, result: any]>);
        post: ((observers: QueryablePostObserver[], url: URL, result: any) => Promise<[url: URL, result: any]>);
        pre: ((observers: QueryablePreObserver[], url: string, init: RequestInit, result: any) => Promise<[url: string, init: RequestInit, result: any]>);
        send: ((observers: QueryableSendObserver[], url: URL, init: RequestInit) => Promise<Promise<Response>>);
    };
    observers: ObserverCollection;
    parentUrl: string;
    get emit(): EmitProxyType<T>;
    get listItemAllFields(): ISPInstance<any>;
    get on(): OnProxyType<T>;
    get query(): URLSearchParams;
    get versions(): IVersions;
    approve(comment?: string): Promise<void>;
    cancelUpload(uploadId: string): Promise<void>;
    checkin(comment?: string, checkinType?: CheckinType): Promise<void>;
    checkout(): Promise<void>;
    cloneObserversOnChange(): void;
    concat(pathPart: string): this;
    continueUpload(uploadId: string, fileOffset: number, fragment: Blob | ArrayBuffer): Promise<number>;
    copyByPath(destUrl: string, shouldOverWrite: boolean, options: Partial<Omit<IMoveCopyOptions, "RetainEditorAndModifiedOnMove">>): Promise<IFile>;
    copyByPath(destUrl: string, shouldOverWrite: boolean, KeepBoth?: boolean): Promise<IFile>;
    copyTo(url: string, shouldOverWrite?: boolean): Promise<void>;
    deleteWithParams(parameters: Partial<IFileDeleteParams>): Promise<void>;
    deny(comment?: string): Promise<void>;
    error(e?: any): void;
    execute(userInit: RequestInit): Promise<void>;
    exists(): Promise<boolean>;
    expand(...expands: string[]): this;
    finishUpload(uploadId: string, fileOffset: number, fragment: Blob | ArrayBuffer): Promise<IFileAddResult>;
    getBlob(): Promise<Blob>;
    getBuffer(): Promise<ArrayBuffer>;
    getContextInfo(path?: string): Promise<IContextInfo>;
    getItem<T>(...selects: string[]): Promise<IItem & T>;
    getJSON(): Promise<any>;
    getLockedByUser(): Promise<ISiteUserProps>;
    getParent<T>(factory: ISPInvokableFactory<any>, path?: string, base?: string): T;
    getText(): Promise<string>;
    log(message: string, level?: number): void;
    moveByPath(destUrl: string, shouldOverWrite: boolean, options: Partial<Omit<IMoveCopyOptions, "ResetAuthorAndCreatedOnCopy">>): Promise<IFile>;
    moveByPath(destUrl: string, shouldOverWrite: boolean, KeepBoth?: boolean): Promise<IFile>;
    moveCopyImpl(destUrl: string, options: Partial<IMoveCopyOptions>, overwrite: boolean, methodName: string): Promise<IFile>;
    publish(comment?: string): Promise<void>;
    recycle(): Promise<string>;
    select(...selects: string[]): this;
    setContent(content: string | Blob | ArrayBuffer): Promise<IFile>;
    setContentChunked(file: Blob, progress?: ((data: IFileUploadProgressData) => void), chunkSize?: number): Promise<IFileAddResult>;
    start(init?: any): Promise<any>;
    startUpload(uploadId: string, fragment: Blob | ArrayBuffer): Promise<number>;
    toRequestUrl(): string;
    toUrl(): string;
    undoCheckout(): Promise<void>;
    unpublish(comment?: string): Promise<void>;
    using(...behaviors: TimelinePipe<any>[]): this;
    <T>(init?: RequestInit): Promise<T>;
}

Hierarchy

  • _File
  • IDeleteableWithETag
    • IFile
  • Type Parameters

    • T = IFileInfo

    Parameters

    • Optionalinit: RequestInit

    Returns Promise<T>

Properties

_inheritingObservers: boolean
_url: string
delete: ((this: ISPQueryable<any>, eTag?: string) => Promise<void>)
InternalPromise: symbol
InternalReject: symbol
InternalResolve: symbol
moments: {
    auth: ((observers: QueryableAuthObserver[], url: URL, init: RequestInit) => Promise<[url: URL, init: RequestInit]>);
    construct: ((observers: QueryableConstructObserver[], init: QueryableInit, path?: string) => Timeline<any>);
    data: ((observers: QueryableDataObserver<any>[], ...args: any[]) => void);
    parse: ((observers: QueryableParseObserver[], url: URL, response: Response, result: any) => Promise<[url: URL, response: Response, result: any]>);
    post: ((observers: QueryablePostObserver[], url: URL, result: any) => Promise<[url: URL, result: any]>);
    pre: ((observers: QueryablePreObserver[], url: string, init: RequestInit, result: any) => Promise<[url: string, init: RequestInit, result: any]>);
    send: ((observers: QueryableSendObserver[], url: URL, init: RequestInit) => Promise<Promise<Response>>);
}
observers: ObserverCollection
parentUrl: string

Accessors

  • get emit(): EmitProxyType<T>
  • Property allowing access to invoke a moment from within this timeline

    Returns EmitProxyType<T>

  • get listItemAllFields(): ISPInstance<any>
  • Gets a value that specifies the list item field values for the list item corresponding to the file.

    Returns ISPInstance<any>

  • get on(): OnProxyType<T>
  • Property allowing access to manage observers on moments within this timeline

    Returns OnProxyType<T>

  • get query(): URLSearchParams
  • Querystring key, value pairs which will be included in the request

    Returns URLSearchParams

  • get versions(): IVersions
  • Gets a collection of versions

    Returns IVersions

Methods

  • Approves the file submitted for content approval with the specified comment. Only documents in lists that are enabled for content approval can be approved.

    Parameters

    • Optionalcomment: string

      The comment for the approval.

    Returns Promise<void>

  • 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.

    Parameters

    • uploadId: string

      The unique identifier of the upload session.

    Returns Promise<void>

  • Checks the file in to a document library based on the check-in type.

    Parameters

    • Optionalcomment: string

      A comment for the check-in. Its length must be <= 1023.

    • OptionalcheckinType: CheckinType

      The check-in type for the file.

    Returns Promise<void>

  • Checks out the file from a document library.

    Returns Promise<void>

  • By default a timeline references the same observer collection as a parent timeline, if any changes are made to the observers this method first clones them ensuring we maintain a local copy and de-ref the parent

    Returns void

  • Directly concatenates the supplied string to the current url, not normalizing "/" chars

    Parameters

    • pathPart: string

      The string to concatenate to the url

    Returns this

  • 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.

    Parameters

    • uploadId: string

      The unique identifier of the upload session.

    • fileOffset: number

      The size of the offset into the file where the fragment starts.

    • fragment: Blob | ArrayBuffer

      The file contents.

    Returns Promise<number>

    The size of the total uploaded data in bytes.

  • Moves the file by path to the specified destination url. Also works with different site collections.

    Parameters

    • destUrl: string

      The absolute url or server relative url of the destination file path to move to.

    • shouldOverWrite: boolean

      Should a file with the same name in the same location be overwritten?

    • options: Partial<Omit<IMoveCopyOptions, "RetainEditorAndModifiedOnMove">>

      Allows you to supply the full set of options controlling the copy behavior

    Returns Promise<IFile>

  • Moves the file by path to the specified destination url. Also works with different site collections.

    Parameters

    • destUrl: string

      The absolute url or server relative url of the destination file path to move to.

    • shouldOverWrite: boolean

      Should a file with the same name in the same location be overwritten?

    • OptionalKeepBoth: boolean

    Returns Promise<IFile>

  • Copies the file to the destination url.

    Parameters

    • url: string

      The absolute url or server relative url of the destination file path to copy to.

    • OptionalshouldOverWrite: boolean

      Should a file with the same name in the same location be overwritten?

    Returns Promise<void>

  • Deletes the file object with options.

    Parameters

    • parameters: Partial<IFileDeleteParams>

      Specifies the options to use when deleting a file.

    Returns Promise<void>

  • Denies approval for a file that was submitted for content approval. Only documents in lists that are enabled for content approval can be denied.

    Parameters

    • Optionalcomment: string

      The comment for the denial.

    Returns Promise<void>

  • Shorthand method to emit an error event tied to this timeline

    Parameters

    • Optionale: any

      Optional. Any error object to emit. If none is provided no emit occurs

    Returns void

  • Method orchestrating the emit calls for the moments defined in inheriting classes

    Parameters

    • userInit: RequestInit

    Returns Promise<void>

  • Checks to see if the file represented by this object exists

    Returns Promise<boolean>

  • Expands fields such as lookups to get additional data

    Parameters

    • Rest...expands: string[]

      The Fields for which to expand the values

    Returns this

  • 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.

    Parameters

    • uploadId: string

      The unique identifier of the upload session.

    • fileOffset: number

      The size of the offset into the file where the fragment starts.

    • fragment: Blob | ArrayBuffer

      The file contents.

    Returns Promise<IFileAddResult>

    The newly uploaded file.

  • Gets the contents of the file as a blob, does not work in Node.js. Not supported in batching.

    Returns Promise<Blob>

  • Gets the contents of a file as an ArrayBuffer, works in Node.js. Not supported in batching.

    Returns Promise<ArrayBuffer>

  • Gets the context info for the specified path

    Parameters

    • Optionalpath: string

      Optional. Absolute path to a SharePoint resource [Default: this.parentUrl]

    Returns Promise<IContextInfo>

  • Gets the associated list item for this folder, loading the default properties

    Type Parameters

    • T

    Parameters

    • Rest...selects: string[]

    Returns Promise<IItem & T>

  • Gets the contents of a file as an ArrayBuffer, works in Node.js. Not supported in batching.

    Returns Promise<any>

  • Gets the current locked by user

    Returns Promise<ISiteUserProps>

  • Gets a parent for this instance as specified

    Type Parameters

    • T extends ISPQueryable<any>

    Parameters

    • factory: ISPInvokableFactory<any>

      The contructor for the class to create

    • Optionalpath: string
    • Optionalbase: string

    Returns T

  • Gets the contents of the file as text. Not supported in batching.

    Returns Promise<string>

  • Shorthand method to emit a logging event tied to this timeline

    Parameters

    • message: string

      The message to log

    • Optionallevel: number

      The level at which the message applies

    Returns void

  • Moves the file by path to the specified destination url. Also works with different site collections.

    Parameters

    • destUrl: string

      The absolute url or server relative url of the destination file path to move to.

    • shouldOverWrite: boolean

      Should a file with the same name in the same location be overwritten?

    • options: Partial<Omit<IMoveCopyOptions, "ResetAuthorAndCreatedOnCopy">>

      Allows you to supply the full set of options controlling the move behavior

    Returns Promise<IFile>

  • Moves the file by path to the specified destination url. Also works with different site collections.

    Parameters

    • destUrl: string

      The absolute url or server relative url of the destination file path to move to.

    • shouldOverWrite: boolean

      Should a file with the same name in the same location be overwritten?

    • OptionalKeepBoth: boolean

    Returns Promise<IFile>

  • Parameters

    • destUrl: string
    • options: Partial<IMoveCopyOptions>
    • overwrite: boolean
    • methodName: string

    Returns Promise<IFile>

  • Submits the file for content approval with the specified comment.

    Parameters

    • Optionalcomment: string

      The comment for the published file. Its length must be <= 1023.

    Returns Promise<void>

  • Moves the file to the Recycle Bin and returns the identifier of the new Recycle Bin item.

    Returns Promise<string>

    The GUID of the recycled file.

  • Choose which fields to return

    Parameters

    • Rest...selects: string[]

      One or more fields to return

    Returns this

  • Sets the content of a file, for large files use setContentChunked. Not supported in batching.

    Parameters

    • content: string | Blob | ArrayBuffer

      The file content

    Returns Promise<IFile>

  • Sets the contents of a file using a chunked upload approach. Not supported in batching.

    Parameters

    • file: Blob

      The file to upload

    • Optionalprogress: ((data: IFileUploadProgressData) => void)

      A callback function which can be used to track the progress of the upload

        • (data): void
        • Parameters

          • data: IFileUploadProgressData

          Returns void

    • OptionalchunkSize: number

      The size of each file slice, in bytes (default: 10485760)

    Returns Promise<IFileAddResult>

  • Starts a timeline

    Parameters

    • Optionalinit: any

      A value passed into the execute logic from the initiator of the timeline

    Returns Promise<any>

    The result of this.execute

    This method first emits "init" to allow for any needed initial conditions then calls execute with any supplied init

  • 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.

    Parameters

    • uploadId: string

      The unique identifier of the upload session.

    • fragment: Blob | ArrayBuffer

      The file contents.

    Returns Promise<number>

    The size of the total uploaded data in bytes.

  • Gets the full url with query information

    Returns string

  • Gets the current url

    Returns string

  • Reverts an existing checkout for the file.

    Returns Promise<void>

  • Removes the file from content approval or unpublish a major version.

    Parameters

    • Optionalcomment: string

      The comment for the unpublish operation. Its length must be <= 1023.

    Returns Promise<void>

  • Apply the supplied behavior(s) to this timeline

    Parameters

    • Rest...behaviors: TimelinePipe<any>[]

      One or more behaviors

    Returns this

    this Timeline