Share via


File members

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.

The File type exposes the following members.

Constructors

  Name Description
Public method File Initializes a new instance of the File object.

Top

Properties

  Name Description
Public property Author Gets a value that specifies the user who added the file.
Public property CheckedOutByUser Gets a value that returns the user who has checked out the file.
Public property CheckInComment Gets a value that returns the comment used when a document is checked into a document library.
Public property CheckOutType Gets a value that specifies the type of check out associated with the file.
Public property ContentTag Returns internal version of content, used to validate document equality for read purposes.
Public property Context Returns the context that is associated with the client object. (Inherited from ClientObject.)
Public property CustomizedPageStatus Gets a value that specifies the customization status of the file.
Public property EffectiveInformationRightsManagementSettings
Public property ETag Gets a value that specifies the ETag value.
Public property Exists Gets a value that specifies whether the file exists.
Public property InformationRightsManagementSettings
Public property IrmEnabled
Public property Length Gets the size of the file in bytes, excluding the size of any Web Parts that are used in the file.
Public property Level Gets a value that specifies the publishing level of the file.
Public property LinkingUri
Public property LinkingUrl
Public property ListId
Public property ListItemAllFields Gets a value that specifies the list item field values for the list item corresponding to the file.
Public property LockedByUser Gets a value that returns the user that owns the current lock on the file.
Public property MajorVersion Gets a value that specifies the major version of the file.
Public property MinorVersion Gets a value that specifies the minor version of the file.
Public property ModifiedBy Gets a value that returns the user who last modified the file.
Public property Name Gets the name of the file including the extension.
Protected property ObjectData Gets the object data for the current client object. (Inherited from ClientObject.)
Public property ObjectVersion Gets a string that indicates the version of the current client object. This member is reserved for internal use and is not intended to be used directly from your code. (Inherited from ClientObject.)
Public property PageRenderType
Public property Path Tracks how a client object is created in the ClientRuntimeContext class so that the object can be recreated on the server. This member is reserved for internal use and is not intended to be used directly from your code. (Inherited from ClientObject.)
Public property Properties
Public property ServerObjectIsNull Gets the server object and returns null if the server object is null. (Inherited from ClientObject.)
Public property ServerRelativePath
Public property ServerRelativeUrl Gets the relative URL of the file based on the URL for the server.
Public property SiteId
Public property Tag Gets or sets data that is associated with the client object. (Inherited from ClientObject.)
Public property TimeCreated Gets a value that specifies when the file was created.
Public property TimeLastModified Gets a value that specifies when the file was last modified.
Public property Title Gets a value that specifies the display name of the file.
Public property TypedObject Gets the object with the correct type information returned from the server. (Inherited from ClientObject.)
Public property UIVersion Gets a value that specifies the implementation-specific version identifier of the file.
Public property UIVersionLabel Gets a value that specifies the implementation-specific version identifier of the file.
Public property UniqueId
Public property VersionEvents
Public property Versions Gets a value that returns a collection of file version objects that represent the versions of the file.
Public property WebId

Top

Methods

  Name Description
Public method Approve Approves the file submitted for content approval with the specified comment.
Public method CancelUpload Stops the chunk upload session without saving the uploaded data. If the file doesn’t already exist in the library, the partially updated file will be deleted. Use this in response to user action (as in a request to cancel an upload) or an error or exception.
Public method CheckIn Checks the file in to a document library based on the check-in type.
Public method CheckOut Checks out the file from a document library based on the check out type.
Protected method CheckUninitializedProperty Checks to determine whether the specified value type property of a ClientObject has been initialized. (Inherited from ClientObject.)
Public method ContinueUpload Continues the chunk upload session with an additional fragment. The current file content is not changed.
Public method CopyTo Copies the file to the destination URL. Server must overwrite an existing file of the same name if bOverwrite is true.
Public method CopyToUsingPath
Public method CustomFromJson Returns a Boolean value that indicates whether custom code was used to populate an object. This member is reserved for internal use and is not intended to be used directly from your code. (Inherited from ClientObject.)
Public method DeleteObject Deletes the file object.
Public method Deny Denies approval for a file that was submitted for content approval.
Public method ExecuteCobaltRequest
Public method FinishUpload Uploads the last file fragment and commits the file. The current file content is changed when this method completes.
Public method FromJson Indicates whether custom code was used to populate an object. This member is reserved for internal use and is not intended to be used directly from your code. (Inherited from ClientObject.)
Public methodStatic member GetContentVerFromTag Reserved for internal use only. This method exposes the internal ContentVersion value inside of a ContentTag.
Public method GetImagePreviewUri
Public method GetImagePreviewUrl
Public method GetLimitedWebPartManager Specifies the control set used to access, modify, or add Web Parts associated with this Web Part Page and view.
Public method GetPreAuthorizedAccessUrl
Public method GetUploadStatus
Public method GetWOPIFrameUrl
Protected method InitNonPropertyFieldFromJson Initializes a non-property field of the client object based on JavaScript Object Notation (JSON) data from the server. This member is reserved for internal use and is not intended to be used directly from your code. (Inherited from ClientObject.)
Protected method InitOnePropertyFromJson (Overrides ClientObject.InitOnePropertyFromJson(String, JsonReader).)
Public method IsObjectPropertyInstantiated Indicates whether the specified property of the client object is instantiated. (Inherited from ClientObject.)
Public method IsPropertyAvailable Returns a Boolean value that indicates whether the specified scalar property has been retrieved or set. (Inherited from ClientObject.)
Protected method LoadExpandoFields Initializes the extended properties associated with the client object when overridden in a derived class. (Inherited from ClientObject.)
Public method MoveTo Moves the file to the specified destination URL.
Public method MoveToUsingPath
Public methodStatic member OpenBinaryDirect Downloads the specified file from a SharePoint site without requiring an ExecuteQuery() method call.
Public method OpenBinaryStream Opens the file as a stream.
Public method Publish Submits the file for content approval with the specified comment.
Public method Recycle Moves the file to the Recycle Bin and returns the identifier of the new Recycle Bin item.
Public method RecycleWithETag
Public method RefreshLoad Reloads all scalar properties associated with the client object when overridden in a derived class. (Inherited from ClientObject.)
Protected method RemoveFromParentCollection Removes the current client object from the parent client object collection. (Inherited from ClientObject.)
Public method Retrieve() Retrieves all scalar properties associated with the object. This member is reserved for internal use and is not intended to be used directly from your code. (Inherited from ClientObject.)
Public method Retrieve([]) Retrieves the specified scalar properties associated with the object. This member is reserved for internal use and is not intended to be used directly from your code. (Inherited from ClientObject.)
Public method SaveBinary Saves the specified file into a document library.
Public methodStatic member SaveBinaryDirect(ClientContext, String, Stream, Boolean) Uploads the specified file to a SharePoint site without requiring an ExecuteQuery() method call.
Public methodStatic member SaveBinaryDirect(ClientContext, String, Stream, String) Uploads the specified file to a SharePoint site with the specified Etag without requiring an ExecuteQuery() method call.
Public method StartUpload 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(Guid) method or when you successfully complete the upload session by passing the rest of the file contents through the ContinueUpload(Guid, Int64, Stream) and FinishUpload(Guid, Int64, Stream) methods.For example, you can pass a 35 MB file by dividing it into three 10 MB streams and one 5 MB stream and uploading them this way (using the resulting offset values of 10, 20 and 30 MB):StartUpload(GUID, stream1)
ContinueUpload(GUID, 10 MB, stream2)
ContinueUpload(GUID, 20 MB, stream3)
FinishUpload(GUID, 30 MB, stream4)The StartUpload(Guid, Stream) and ContinueUpload(Guid, Int64, Stream) 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(Guid, Int64, Stream) and FinishUpload(Guid, Int64, Stream)
Public method ToString (Inherited from Object.)
Public method UndoCheckOut Reverts an existing checkout for the file.
Public method UnPublish Removes the file from content approval or unpublish a major version.
Public method Update
Protected method UpdateClientObjectPropertyType Updates the client object property's value to have correct type by using the type information returned from the server. (Inherited from ClientObject.)

Top

See also

Reference

File class

Microsoft.SharePoint.Client namespace