Interface IFile
Public interface to define a File object
Assembly: PnP.Core.dll
Syntax
public interface IFile : IDataModel<IFile>, IDataModelParent, IDataModelWithContext, ISupportModules<IFile>, IDataModelGet<IFile>, IDataModelLoad<IFile>, IDataModelUpdate, IDataModelDelete, IQueryableDataModel
Properties
A special property used to add an asterisk to a $select statement
Declaration
Property Value
Gets a value that specifies the user who added the file.
Declaration
ISharePointUser Author { get; }
Property Value
Gets a value that returns the user who has checked out the file.
Declaration
ISharePointUser CheckedOutByUser { get; }
Property Value
Gets a value that specifies the type of check out associated with the file.
Declaration
CheckOutType CheckOutType { get; }
Property Value
Returns internal version of content, used to validate document equality for read purposes.
Declaration
string ContentTag { get; }
Property Value
Gets a value that specifies the customization status of the file.
Declaration
CustomizedPageStatus CustomizedPageStatus { get; }
Property Value
Gets a value that specifies the ETag value.
Declaration
Property Value
Indicates whether this file has alternate streams with content.
Declaration
bool HasAlternateContentStreams { get; }
Property Value
Gets or sets whether Irm is enabled on the file.
Declaration
bool IrmEnabled { get; set; }
Property Value
Gets the file size of the file.
Declaration
Property Value
Level of the file (published or draft)
Declaration
PublishedStatus Level { get; }
Property Value
Gets the linking URI of the file.
Declaration
string LinkingUri { get; }
Property Value
Gets the linking URL of the file.
Declaration
string LinkingUrl { get; }
Property Value
Gets the id of the list containing the file.
Declaration
Property Value
Gets a value that specifies the list item field values for the list item corresponding to the file.
Declaration
IListItem ListItemAllFields { get; }
Property Value
Gets a value that returns the user who has locked the file.
Declaration
ISharePointUser LockedByUser { get; }
Property Value
Gets a value that specifies the major version of the file.
Declaration
int MajorVersion { get; }
Property Value
Gets a value that specifies the minor version of the file.
Declaration
int MinorVersion { get; }
Property Value
Gets a value that returns the last user who has modified the file.
Declaration
ISharePointUser ModifiedBy { get; }
Property Value
Gets the name of the file including the extension.
Declaration
Property Value
Gets the properties of the file.
Declaration
IPropertyValues Properties { get; }
Property Value
Gets the URL which opens the document in Office Web Apps.
Declaration
string ServerRedirectedUrl { get; }
Property Value
Gets the relative URL of the file based on the URL for the server.
Declaration
string ServerRelativeUrl { get; }
Property Value
Gets the Id of the Site collection in which the file is stored.
Declaration
Property Value
Gets a value that specifies when the file was created.
Declaration
DateTime TimeCreated { get; }
Property Value
Gets a value that specifies when the file was last modified.
Declaration
DateTime TimeLastModified { get; }
Property Value
Gets a value that specifies the display name of the file.
Declaration
Property Value
Gets a value that specifies the implementation-specific version identifier of the file.
Declaration
Property Value
Gets a value that specifies the implementation-specific version identifier of the file.
Declaration
string UIVersionLabel { get; }
Property Value
Gets the unique Id of the file.
Declaration
Property Value
Gets a value that returns a collection of file version event objects that represent the version events of the file.
Declaration
IFileVersionEventCollection VersionEvents { get; }
Property Value
Declaration
IFileVersionCollection Versions { get; }
Property Value
Get the Graph Drive ID of the drive to which the file belongs.
Declaration
string VroomDriveID { get; }
Property Value
Get the Graph DriveItem ID of the file.
Declaration
string VroomItemID { get; }
Property Value
Gets the Id of the site in which the file is stored.
Declaration
Property Value
Methods
Approves the file.
The approval comment
Declaration
void Approve(string comment = null)
Parameters
Approves the file.
The approval comment
Declaration
Task ApproveAsync(string comment = null)
Parameters
Returns
Approves the file.
The approval comment
The batch instance to use.
Declaration
void ApproveBatch(Batch batch, string comment = null)
Parameters
Batch
batch
|
System.String
comment
|
Approves the file.
The approval comment
Declaration
void ApproveBatch(string comment = null)
Parameters
Approves the file.
The approval comment
The batch instance to use.
Declaration
Task ApproveBatchAsync(Batch batch, string comment = null)
Parameters
Batch
batch
|
System.String
comment
|
Returns
Approves the file.
The approval comment
Declaration
Task ApproveBatchAsync(string comment = null)
Parameters
Returns
Checks in the file.
The check in comment.
The type of check in to use.
Declaration
void Checkin(string comment = null, CheckinType checkinType = default(CheckinType))
Parameters
Checks in the file.
The check in comment.
The type of check in to use.
Declaration
Task CheckinAsync(string comment = null, CheckinType checkinType = default(CheckinType))
Parameters
Returns
Checks in the file.
The check in comment.
The type of check in to use.
The batch instance to use.
Declaration
void CheckinBatch(Batch batch, string comment = null, CheckinType checkinType = default(CheckinType))
Parameters
Checks in the file.
The check in comment.
The type of check in to use.
Declaration
void CheckinBatch(string comment = null, CheckinType checkinType = default(CheckinType))
Parameters
Checks in the file.
The check in comment.
The type of check in to use.
The batch instance to use.
Declaration
Task CheckinBatchAsync(Batch batch, string comment = null, CheckinType checkinType = default(CheckinType))
Parameters
Returns
Checks in the file.
The check in comment.
The type of check in to use.
Declaration
Task CheckinBatchAsync(string comment = null, CheckinType checkinType = default(CheckinType))
Parameters
Returns
Checks out the file.
The batch instance to use.
Declaration
void CheckoutBatch(Batch batch)
Parameters
Declaration
Task CheckoutBatchAsync()
Returns
Checks out the file.
The batch instance to use.
Declaration
Task CheckoutBatchAsync(Batch batch)
Parameters
Returns
Requests Syntex AI models to classify and extract information from this file
Declaration
ISyntexClassifyAndExtractResult ClassifyAndExtract()
Returns
Requests Syntex AI models to classify and extract information from this file
Declaration
Task<ISyntexClassifyAndExtractResult> ClassifyAndExtractAsync()
Returns
Requests Syntex AI models to classify and extract information from this file
Declaration
IBatchSingleResult<ISyntexClassifyAndExtractResult> ClassifyAndExtractBatch()
Returns
Requests Syntex AI models to classify and extract information from this file
Declaration
IBatchSingleResult<ISyntexClassifyAndExtractResult> ClassifyAndExtractBatch(Batch batch)
Parameters
Batch
batch
Batch to add this request to
|
Returns
Requests Syntex AI models to classify and extract information from this file
Declaration
Task<IBatchSingleResult<ISyntexClassifyAndExtractResult>> ClassifyAndExtractBatchAsync()
Returns
Requests Syntex AI models to classify and extract information from this file
Declaration
Task<IBatchSingleResult<ISyntexClassifyAndExtractResult>> ClassifyAndExtractBatchAsync(Batch batch)
Parameters
Batch
batch
Batch to add this request to
|
Returns
Converts the file to PDF, JPG, Html or Glb
Declaration
Stream ConvertTo(ConvertToOptions options)
Parameters
Returns
Stream
Stream of the converted file
|
Converts the file to PDF, JPG, Html or Glb
Declaration
Task<Stream> ConvertToAsync(ConvertToOptions options)
Parameters
Returns
Task<Stream>
Stream of the converted file
|
Copies a file to the destination URL.
Declaration
void CopyTo(string destinationUrl, bool overwrite = false, MoveCopyOptions options = null)
Parameters
System.String
destinationUrl
The destination URL including file name.
|
System.Boolean
overwrite
Indicates whether the file should be overwritten if already existing.
|
MoveCopyOptions
options
Options of the copy operation.
|
Copies a file to the destination URL.
Declaration
Task CopyToAsync(string destinationUrl, bool overwrite = false, MoveCopyOptions options = null)
Parameters
System.String
destinationUrl
The destination URL including file name.
|
System.Boolean
overwrite
Indicates whether the file should be overwritten if already existing.
|
MoveCopyOptions
options
Options of the copy operation.
|
Returns
Copies a file to the destination URL.
Declaration
void CopyToBatch(Batch batch, string destinationUrl, bool overwrite = false, MoveCopyOptions options = null)
Parameters
Batch
batch
The batch instance to use.
|
System.String
destinationUrl
The destination URL including file name.
|
System.Boolean
overwrite
Indicates whether the file should be overwritten if already existing.
|
MoveCopyOptions
options
Options of the copy operation.
|
Copies a file to the destination URL.
Declaration
void CopyToBatch(string destinationUrl, bool overwrite = false, MoveCopyOptions options = null)
Parameters
System.String
destinationUrl
The destination URL including file name.
|
System.Boolean
overwrite
Indicates whether the file should be overwritten if already existing.
|
MoveCopyOptions
options
Options of the copy operation.
|
Copies a file to the destination URL.
Declaration
Task CopyToBatchAsync(Batch batch, string destinationUrl, bool overwrite = false, MoveCopyOptions options = null)
Parameters
Batch
batch
The batch instance to use.
|
System.String
destinationUrl
The destination URL including file name.
|
System.Boolean
overwrite
Indicates whether the file should be overwritten if already existing.
|
MoveCopyOptions
options
Options of the copy operation.
|
Returns
Copies a file to the destination URL.
Declaration
Task CopyToBatchAsync(string destinationUrl, bool overwrite = false, MoveCopyOptions options = null)
Parameters
System.String
destinationUrl
The destination URL including file name.
|
System.Boolean
overwrite
Indicates whether the file should be overwritten if already existing.
|
MoveCopyOptions
options
Options of the copy operation.
|
Returns
Creates an anonymous sharing link for a file
Declaration
IGraphPermission CreateAnonymousSharingLink(AnonymousLinkOptions anonymousLinkOptions)
Parameters
Returns
Creates an anonymous sharing link for a file
Declaration
Task<IGraphPermission> CreateAnonymousSharingLinkAsync(AnonymousLinkOptions anonymousLinkOptions)
Parameters
Returns
Creates an organization sharing link for a file
Declaration
IGraphPermission CreateOrganizationalSharingLink(OrganizationalLinkOptions organizationalLinkOptions)
Parameters
Returns
Creates an organization sharing link for a file
Declaration
Task<IGraphPermission> CreateOrganizationalSharingLinkAsync(OrganizationalLinkOptions organizationalLinkOptions)
Parameters
Returns
Creates a sharing invite to a specific user
Declaration
IGraphPermission CreateSharingInvite(InviteOptions inviteOptions)
Parameters
Returns
Creates a sharing invite to a specific user
Declaration
Task<IGraphPermission> CreateSharingInviteAsync(InviteOptions inviteOptions)
Parameters
Returns
Creates a user sharing link for a file
Declaration
IGraphPermission CreateUserSharingLink(UserLinkOptions userLinkOptions)
Parameters
Returns
Creates a user sharing link for a file
Declaration
Task<IGraphPermission> CreateUserSharingLinkAsync(UserLinkOptions userLinkOptions)
Parameters
Returns
Deletes the share links on the file item
Declaration
Deletes the share links on the file item
Declaration
Task DeleteShareLinksAsync()
Returns
Declaration
List<IActivityStat> GetAnalytics(AnalyticsOptions options = null)
Parameters
Returns
PnP.Core.Model.SharePoint.List<IActivityStat>
The requested analytics data
|
Declaration
Task<List<IActivityStat>> GetAnalyticsAsync(AnalyticsOptions options = null)
Parameters
Returns
Task<PnP.Core.Model.SharePoint.List<IActivityStat>>
The requested analytics data
|
Get the content of the file.
Declaration
Stream GetContent(bool streamContent = false)
Parameters
System.Boolean
streamContent
Already return the content before all bytes are read, needed for large file downloads
|
Returns
Stream
Stream containing the binary content of the file
|
Get the content of the file.
Declaration
Task<Stream> GetContentAsync(bool streamContent = false)
Parameters
System.Boolean
streamContent
Already return the content before all bytes are read, needed for large file downloads
|
Returns
Task<Stream>
Stream containing the binary content of the file
|
Get the content of the file.
Declaration
Returns
System.Byte[]
The binary content of the file
|
Get the content of the file.
Declaration
Task<byte[]> GetContentBytesAsync()
Returns
Task<System.Byte[]>
The binary content of the file
|
This action allows you to obtain short-lived embeddable URLs for an item in order to render a temporary preview.
The 'page' and 'zoom' options may not be available for all preview apps, but will be applied if the preview app supports it.
Declaration
IFilePreview GetPreview(PreviewOptions options = null)
Parameters
PreviewOptions
options
Options for configuring the created preview URL
|
Returns
IFilePreview
FilePreview object. Either getUrl, postUrl, or both might be returned depending on the current state of embed support for the specified options.
|
This action allows you to obtain short-lived embeddable URLs for an item in order to render a temporary preview.
The 'page' and 'zoom' options may not be available for all preview apps, but will be applied if the preview app supports it.
Declaration
Task<IFilePreview> GetPreviewAsync(PreviewOptions options = null)
Parameters
PreviewOptions
options
Options for configuring the created preview URL
|
Returns
Task<IFilePreview>
FilePreview object. Either getUrl, postUrl, or both might be returned depending on the current state of embed support for the specified options.
|
Gets the share links on the file item
Declaration
IGraphPermissionCollection GetShareLinks()
Returns
Gets the share links on the file item
Declaration
Task<IGraphPermissionCollection> GetShareLinksAsync()
Returns
Returns a list of thumbnails for this file
Declaration
List<IThumbnail> GetThumbnails(ThumbnailOptions options = null)
Parameters
Returns
PnP.Core.Model.SharePoint.List<IThumbnail>
The requested thumbnails
|
Returns a list of thumbnails for this file
Declaration
Task<List<IThumbnail>> GetThumbnailsAsync(ThumbnailOptions options = null)
Parameters
Returns
Task<PnP.Core.Model.SharePoint.List<IThumbnail>>
The requested thumbnails
|
Returns a list of thumbnails for this file
Declaration
IEnumerableBatchResult<IThumbnail> GetThumbnailsBatch(ThumbnailOptions options = null)
Parameters
Returns
Returns a list of thumbnails for this file
Declaration
IEnumerableBatchResult<IThumbnail> GetThumbnailsBatch(Batch batch, ThumbnailOptions options = null)
Parameters
Batch
batch
The batch instance to use.
|
ThumbnailOptions
options
Optionally specify which thumbnails you need
|
Returns
Returns a list of thumbnails for this file
Declaration
Task<IEnumerableBatchResult<IThumbnail>> GetThumbnailsBatchAsync(ThumbnailOptions options = null)
Parameters
Returns
Returns a list of thumbnails for this file
Declaration
Task<IEnumerableBatchResult<IThumbnail>> GetThumbnailsBatchAsync(Batch batch, ThumbnailOptions options = null)
Parameters
Batch
batch
The batch instance to use.
|
ThumbnailOptions
options
Optionally specify which thumbnails you need
|
Returns
Move a file to the destination URL.
Declaration
void MoveTo(string destinationUrl, MoveOperations moveOperations = default(MoveOperations), MoveCopyOptions options = null)
Parameters
System.String
destinationUrl
The destination URL including file name.
|
MoveOperations
moveOperations
combinable flags to indicate the type of move operations.
|
MoveCopyOptions
options
Options of the move operation.
|
Move a file to the destination URL.
Declaration
Task MoveToAsync(string destinationUrl, MoveOperations moveOperations = default(MoveOperations), MoveCopyOptions options = null)
Parameters
System.String
destinationUrl
The destination URL including file name.
|
MoveOperations
moveOperations
combinable flags to indicate the type of move operations.
|
MoveCopyOptions
options
Options of the move operation.
|
Returns
Move a file to the destination URL.
Declaration
void MoveToBatch(Batch batch, string destinationUrl, MoveOperations moveOperations = default(MoveOperations), MoveCopyOptions options = null)
Parameters
Batch
batch
The batch instance to use.
|
System.String
destinationUrl
The destination URL including file name.
|
MoveOperations
moveOperations
combinable flags to indicate the type of move operations.
|
MoveCopyOptions
options
Options of the move operation.
|
Move a file to the destination URL.
Declaration
void MoveToBatch(string destinationUrl, MoveOperations moveOperations = default(MoveOperations), MoveCopyOptions options = null)
Parameters
System.String
destinationUrl
The destination URL including file name.
|
MoveOperations
moveOperations
combinable flags to indicate the type of move operations.
|
MoveCopyOptions
options
Options of the move operation.
|
Move a file to the destination URL.
Declaration
Task MoveToBatchAsync(Batch batch, string destinationUrl, MoveOperations moveOperations = default(MoveOperations), MoveCopyOptions options = null)
Parameters
Batch
batch
The batch instance to use.
|
System.String
destinationUrl
The destination URL including file name.
|
MoveOperations
moveOperations
combinable flags to indicate the type of move operations.
|
MoveCopyOptions
options
Options of the move operation.
|
Returns
Move a file to the destination URL.
Declaration
Task MoveToBatchAsync(string destinationUrl, MoveOperations moveOperations = default(MoveOperations), MoveCopyOptions options = null)
Parameters
System.String
destinationUrl
The destination URL including file name.
|
MoveOperations
moveOperations
combinable flags to indicate the type of move operations.
|
MoveCopyOptions
options
Options of the move operation.
|
Returns
Publish a major version of the current file.
The comments to add on file publishing.
Declaration
void Publish(string comment = null)
Parameters
Publish a major version of the current file.
The comments to add on file publishing.
Declaration
Task PublishAsync(string comment = null)
Parameters
Returns
Publish a major version of the current file.
The batch instance to use.
The comments to add on file publishing.
Declaration
void PublishBatch(Batch batch, string comment = null)
Parameters
Batch
batch
|
System.String
comment
|
Publish a major version of the current file.
The comments to add on file publishing.
Declaration
void PublishBatch(string comment = null)
Parameters
Publish a major version of the current file.
The batch instance to use.
The comments to add on file publishing.
Declaration
Task PublishBatchAsync(Batch batch, string comment = null)
Parameters
Batch
batch
|
System.String
comment
|
Returns
Publish a major version of the current file.
The comments to add on file publishing.
Declaration
Task PublishBatchAsync(string comment = null)
Parameters
Returns
Send the file to recycle bin.
Declaration
Returns
Guid
The Id of the created recycle bin item
|
Send the file to recycle bin.
Declaration
Task<Guid> RecycleAsync()
Returns
Task<Guid>
The Id of the created recycle bin item
|
Send the file to recycle bin.
Declaration
IBatchSingleResult<BatchResultValue<Guid>> RecycleBatch()
Returns
Send the file to recycle bin
Declaration
IBatchSingleResult<BatchResultValue<Guid>> RecycleBatch(Batch batch)
Parameters
Batch
batch
The batch instance to use.
|
Returns
Send the file to recycle bin.
Declaration
Task<IBatchSingleResult<BatchResultValue<Guid>>> RecycleBatchAsync()
Returns
Send the file to recycle bin.
Declaration
Task<IBatchSingleResult<BatchResultValue<Guid>>> RecycleBatchAsync(Batch batch)
Parameters
Batch
batch
The batch instance to use.
|
Returns
Declaration
Parameters
System.String
name
New file name
|
Declaration
Task RenameAsync(string name)
Parameters
System.String
name
New file name
|
Returns
Release the checked out file without saving the changes.
Declaration
Release the checked out file without saving the changes.
Declaration
Returns
Release the checked out file without saving the changes.
Declaration
Release the checked out file without saving the changes.
The batch instance to use.
Declaration
void UndoCheckoutBatch(Batch batch)
Parameters
Release the checked out file without saving the changes.
Declaration
Task UndoCheckoutBatchAsync()
Returns
Release the checked out file without saving the changes.
The batch instance to use.
Declaration
Task UndoCheckoutBatchAsync(Batch batch)
Parameters
Returns
Unpublish the latest major version of the current file.
The comments to add on file unpublishing.
Declaration
void Unpublish(string comment = null)
Parameters
Unpublish the latest major version of the current file.
The comments to add on file unpublishing.
Declaration
Task UnpublishAsync(string comment = null)
Parameters
Returns
Unpublish the latest major version of the current file.
The batch instance to use.
The comments to add on file unpublishing.
Declaration
void UnpublishBatch(Batch batch, string comment = null)
Parameters
Batch
batch
|
System.String
comment
|
Unpublish the latest major version of the current file.
The comments to add on file unpublishing.
Declaration
void UnpublishBatch(string comments = null)
Parameters
Unpublish the latest major version of the current file.
The batch instance to use.
The comments to add on file unpublishing.
Declaration
Task UnpublishBatchAsync(Batch batch, string comment = null)
Parameters
Batch
batch
|
System.String
comment
|
Returns
Unpublish the latest major version of the current file.
The comments to add on file unpublishing.
Declaration
Task UnpublishBatchAsync(string comment = null)
Parameters
Returns
Extension Methods