Class FileOperations
Contains all operations that can be made against a versioned file
Inheritance
Inherited Members
Namespace: EPiServer.Web.Hosting.Versioning.Store
Assembly: EPiServer.dll
Version: 8.11.0Syntax
public class FileOperations
Remarks
This class is a wrapper for object store access relating to versioned file system.
Methods
CheckInFile(FileItem, String, String)
Check in a new version of the file.
Declaration
public void CheckInFile(FileItem file, string userName, string comments)
Parameters
Type | Name | Description |
---|---|---|
FileItem | file | The file to check in. |
System.String | userName | Name of the user checking in the file. |
System.String | comments | A commend decribing the new version of the file. |
CheckOutFile(FileItem, String)
Check out the file for exclusive write access.
Declaration
public void CheckOutFile(FileItem file, string userName)
Parameters
Type | Name | Description |
---|---|---|
FileItem | file | The file to check out. |
System.String | userName | Name of the user. |
Remarks
Checking out a file gives the user exclusive write access to the file, preventing others from checking out the same file until it has been checked in again. Attempting to check out a file that is already checked out will give an exception of type FileOperationException.
CreateFile(Object, String, String)
Creates the file metadata.
Declaration
public FileItem CreateFile(object dirId, string name, string user)
Parameters
Type | Name | Description |
---|---|---|
System.Object | dirId | The object store id of the directory where the file is created. |
System.String | name | The name of the file. |
System.String | user | Name of the user creating the file. |
Returns
Type | Description |
---|---|
FileItem | A FileItem describing the file. |
Remarks
Only creates metadata describing the file. The physical file is not refereed to in this method.
CreateFile(Object, String, String, Guid)
Creates the file metadata.
Declaration
public FileItem CreateFile(object dirId, string name, string user, Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Object | dirId | The object store id of the directory where the file is created. |
System.String | name | The name of the file. |
System.String | user | Name of the user creating the file. |
System.Guid | id | The id of the file. |
Returns
Type | Description |
---|---|
FileItem |
Remarks
Only creates metadata describing the file. The physical file is not referenced in this method.
CreateFileInfo(String, String, Guid)
Creates the file info.
Declaration
public FileItem CreateFileInfo(string name, string user, Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
System.String | user | The user. |
System.Guid | id | The id. |
Returns
Type | Description |
---|---|
FileItem |
DeleteElderRevisions(Object, Int32)
Declaration
public void DeleteElderRevisions(object fileId, int keepRevisions)
Parameters
Type | Name | Description |
---|---|---|
System.Object | fileId | |
System.Int32 | keepRevisions |
DeleteFile(Object, Object)
Declaration
public void DeleteFile(object dirId, object fileId)
Parameters
Type | Name | Description |
---|---|---|
System.Object | dirId | |
System.Object | fileId |
DeleteItemIdFromIndex(String, Object)
Declaration
[Obsolete("The versioning file system is now using EPiServer.Search and it's index is managed by the VersioningFileSystemSearchHandler.", true)]
public static void DeleteItemIdFromIndex(string filePath, object fileId)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | |
System.Object | fileId |
DeleteRevision(Object, Object)
Declaration
public void DeleteRevision(object fileId, object revId)
Parameters
Type | Name | Description |
---|---|---|
System.Object | fileId | |
System.Object | revId |
GetFile(Object)
Gets a FileItem describing the file.
Declaration
public FileItem GetFile(object fileId)
Parameters
Type | Name | Description |
---|---|---|
System.Object | fileId | The file id. |
Returns
Type | Description |
---|---|
FileItem | A FileItem with metadata for the file. |
GetFilePath(FileItem, FileRevision)
Declaration
public string GetFilePath(FileItem file, FileRevision rev)
Parameters
Type | Name | Description |
---|---|---|
FileItem | file | |
FileRevision | rev |
Returns
Type | Description |
---|---|
System.String |
GetFiles(Object)
Declaration
public FileItem[] GetFiles(object dirId)
Parameters
Type | Name | Description |
---|---|---|
System.Object | dirId |
Returns
Type | Description |
---|---|
FileItem[] |
GetPath(String, FileItem, FileRevision, Boolean)
Declaration
public static string GetPath(string basePath, FileItem file, FileRevision rev, bool forWriting)
Parameters
Type | Name | Description |
---|---|---|
System.String | basePath | |
FileItem | file | |
FileRevision | rev | |
System.Boolean | forWriting |
Returns
Type | Description |
---|---|
System.String |
GetReadStream(FileItem, FileRevision, FileMode, FileAccess, FileShare)
Declaration
public Stream GetReadStream(FileItem file, FileRevision rev, FileMode mode, FileAccess access, FileShare share)
Parameters
Type | Name | Description |
---|---|---|
FileItem | file | |
FileRevision | rev | |
System.IO.FileMode | mode | |
System.IO.FileAccess | access | |
System.IO.FileShare | share |
Returns
Type | Description |
---|---|
System.IO.Stream |
GetRevisions(Object)
Declaration
public FileRevision[] GetRevisions(object fileId)
Parameters
Type | Name | Description |
---|---|---|
System.Object | fileId |
Returns
Type | Description |
---|---|
FileRevision[] |
GetWriteStream(FileItem, Boolean, String, FileMode, FileAccess, FileShare)
Declaration
public Stream GetWriteStream(FileItem file, bool autoCheckIn, string userName, FileMode mode, FileAccess access, FileShare share)
Parameters
Type | Name | Description |
---|---|---|
FileItem | file | |
System.Boolean | autoCheckIn | |
System.String | userName | |
System.IO.FileMode | mode | |
System.IO.FileAccess | access | |
System.IO.FileShare | share |
Returns
Type | Description |
---|---|
System.IO.Stream |
MoveFile(Object, Object, Object)
Moves the file.
Declaration
public void MoveFile(object fileId, object currentParentId, object newParentId)
Parameters
Type | Name | Description |
---|---|---|
System.Object | fileId | The file id. |
System.Object | currentParentId | Object store id of the current parent. |
System.Object | newParentId | Object store id of the new parent. |
RenameFile(FileItem, String)
Declaration
public void RenameFile(FileItem file, string newName)
Parameters
Type | Name | Description |
---|---|---|
FileItem | file | |
System.String | newName |
SaveFileSummary(FileItem)
Declaration
public void SaveFileSummary(FileItem file)
Parameters
Type | Name | Description |
---|---|---|
FileItem | file |
UndoCheckOutFile(FileItem)
Undo a file check out.
Declaration
public void UndoCheckOutFile(FileItem file)
Parameters
Type | Name | Description |
---|---|---|
FileItem | file | The file to undo check out for. |
Remarks
Reverts the file to the state it had before a check out operation as performed.
UpdateCheckedOutFile(FileItem, Int64)
Declaration
public void UpdateCheckedOutFile(FileItem file, long length)
Parameters
Type | Name | Description |
---|---|---|
FileItem | file | |
System.Int64 | length |