SP.File Methods (sp.js)

The following table lists the methods of the SP.File object.

Applies to: apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013

Methods

Method

Description

approve

Approves the file submitted for content approval with the specified comment.

cancelUpload

Stops the chunk upload session without saving the uploaded data. 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.

checkIn

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

checkOut

Checks out the file from a document library based on the check-out type.

continueUpload

Continues the chunk upload session with an additional fragment. The current file content is not changed.

copyTo

Copies the file to the destination URL.

deleteObject

Deletes the File object.

deny

Denies approval for a file that was submitted for content approval.

finishUpload

Uploads the last file fragment and commits the file. The current file content is changed when this method completes.

getContentVerFromTag

Reserved for internal use only. This method exposes the internal ContentVersion value inside of a ContentTag.

getLimitedWebPartManager

Specifies the control set used to access, modify, or add Web Parts associated with this Web Part Page and view.

initPropertiesFromJson

moveTo

Moves the file to the specified destination URL.

publish

Submits the file for content approval with the specified comment.

recycle

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

saveBinary

startUpload

Starts a new chunk upload session and uploads the first fragment.

undoCheckOut

Reverts an existing checkout for the file.

unPublish

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