SP.File object
Represents a file in a SharePoint Web site that can be a Web Part Page, an item in a document library, or a file in a folder.
Applies to: apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013
var object = new SP.File()
Members
The File object has the following members.
Constructor
The File object has the following constructor.
Constructor |
Description |
---|---|
Initializes a new instance of the SP.File object. |
Methods
The File object has the following methods.
Method |
Description |
---|---|
Approves the file submitted for content approval with the specified comment. |
|
Checks the file in to a document library based on the check-in type. |
|
Checks out the file from a document library based on the check-out type. |
|
Copies the file to the destination URL. |
|
Deletes the File object. |
|
Denies approval for a file that was submitted for content approval. |
|
Reserved for internal use only. This method exposes the internal ContentVersion value inside of a ContentTag. |
|
Specifies the control set used to access, modify, or add Web Parts associated with this Web Part Page and view. |
|
Moves the file to the specified destination URL. |
|
Submits the file for content approval with the specified comment. |
|
Moves the file to the Recycle Bin and returns the identifier of the new Recycle Bin item. |
|
Reverts an existing checkout for the file. |
|
Removes the file from content approval or unpublish a major version. |
Properties
The File object has the following properties.
Property |
Description |
---|---|
Gets a value that specifies the user who added the file. |
|
Gets a value that returns the user who has checked out the file. |
|
Gets a value that returns the comment used when a document is checked in to a document library. |
|
Gets a value that indicates how the file is checked out of a document library. |
|
Returns internal version of content, used to validate document equality for read purposes. |
|
Gets a value that specifies the customization status of the file. |
|
Gets a value that specifies the ETag value. |
|
Gets a value that specifies whether the file exists. |
|
Gets the size of the file in bytes, excluding the size of any Web Parts that are used in the file. |
|
Gets a value that specifies the publishing level of the file. |
|
Gets a value that specifies the list item field values for the list item corresponding to the file. |
|
Gets a value that returns the user that owns the current lock on the file. |
|
Gets a value that specifies the major version of the file. |
|
Gets a value that specifies the minor version of the file. |
|
Gets a value that returns the user who last modified the file. |
|
Gets the name of the file including the extension. |
|
Gets the relative URL of the file based on the URL for the server. |
|
Gets a value that specifies when the file was created. |
|
Gets a value that specifies when the file was last modified. |
|
Gets a value that specifies the display name of the file. |
|
Gets a value that specifies the implementation-specific version identifier of the file. |
|
Gets a value that specifies the implementation-specific version identifier of the file. |
|
Gets a value that returns a collection of file version objects that represent the versions of the file. |
REST resource endpoint
See File resource for more information.
Endpoint URI structure
http://<sitecollection>/<site>/_api/web/folders/getbyurl(folderrelativeurl)/files/getbyurl(filerelativeurl)
HTTP requests
This resource supports the following HTTP commands:
DELETE syntax
DELETE http://<sitecollection>/<site>/_api/web/folders/getbyurl(folderrelativeurl)/files/getbyurl(filerelativeurl)
POST syntax
POST http://<sitecollection>/<site>/_api/web/folders/getbyurl(folderrelativeurl)/files/getbyurl(filerelativeurl)