Class FileVersionController
Inheritance
Implements
Inherited Members
Namespace: DotNetNuke.Services.FileSystem
Assembly: DotNetNuke.dll
Syntax
public class FileVersionController : ComponentBase<IFileVersionController, FileVersionController>, IFileVersionController
Methods
| Improve this Doc View SourceAddFileVersion(IFileInfo, Int32, Boolean, Boolean, Stream)
Add a new version of the file.
Declaration
public string AddFileVersion(IFileInfo file, int userId, bool published, bool removeOldestVersions, Stream content = null)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file | The file to add a version to. |
System.Int32 | userId | The user who is performing the operation. |
System.Boolean | published | Indicates if the new version should be the published version. |
System.Boolean | removeOldestVersions | Remove the oldest versions if # > MaxVersions. |
Stream | content | Version content. |
Returns
Type | Description |
---|---|
System.String | The name of the file where the content should be stored. |
DeleteAllUnpublishedVersions(IFileInfo, Boolean)
Deletes all the unpublished versions of a file.
Declaration
public void DeleteAllUnpublishedVersions(IFileInfo file, bool resetPublishedVersionNumber)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file | The file with versions. |
System.Boolean | resetPublishedVersionNumber | If True reset to 1 the PublishedVersion Property of the FileInfo. |
DeleteFileVersion(IFileInfo, Int32)
Deletes a version of a file. If the version to delete is the published version, the previous version gets published.
Declaration
public int DeleteFileVersion(IFileInfo file, int version)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file | The file to delete the version from. |
System.Int32 | version | The number of the version to delete. |
Returns
Type | Description |
---|---|
System.Int32 | The new published version. |
GetFileVersion(IFileInfo, Int32)
Gets the physical file with a specific version of a file.
Declaration
public FileVersionInfo GetFileVersion(IFileInfo file, int version)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file | The file to get the version from. |
System.Int32 | version | The number of the version to retrieve. |
Returns
Type | Description |
---|---|
FileVersionInfo | The version of the file. |
GetFileVersions(IFileInfo)
Returns all the versions of a file.
Declaration
public IEnumerable<FileVersionInfo> GetFileVersions(IFileInfo file)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file | The file with versions. |
Returns
Type | Description |
---|---|
IEnumerable<FileVersionInfo> | Collection of file versions. |
GetFileVersionsInFolder(Int32)
Get all the non-published versions in a Folder.
Declaration
public IEnumerable<FileVersionInfo> GetFileVersionsInFolder(int folderId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | folderId | Folder Id. |
Returns
Type | Description |
---|---|
IEnumerable<FileVersionInfo> | Collection of file versions. |
GetVersionContent(IFileInfo, Int32)
Get the content of a specific version file.
Declaration
public Stream GetVersionContent(IFileInfo file, int version)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file | The file to get the version. |
System.Int32 | version | The version to obtain the content. |
Returns
Type | Description |
---|---|
Stream | The Stream with the file content. |
IsFileVersionEnabled(Int32)
This method returns true if FileVersion is enabled in the portal, false otherwise.
Declaration
public bool IsFileVersionEnabled(int portalId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | portalId | Portal Id. |
Returns
Type | Description |
---|---|
System.Boolean | true if FileVersion is enabled in the portal, false otherwise. |
IsFolderVersioned(IFolderInfo)
This method returns true if FileVersion is enabled in the Folder, false otherwise.
Declaration
public bool IsFolderVersioned(IFolderInfo folder)
Parameters
Type | Name | Description |
---|---|---|
IFolderInfo | folder | FolderInfo object. |
Returns
Type | Description |
---|---|
System.Boolean | true if FileVersion is enabled in the Folder, false otherwise. |
IsFolderVersioned(Int32)
This method returns true if FileVersion is enabled in the Folder, false otherwise.
Declaration
public bool IsFolderVersioned(int folderId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | folderId | Folder Id. |
Returns
Type | Description |
---|---|
System.Boolean | true if FileVersion is enabled in the Folder, false otherwise. |
MaxFileVersions(Int32)
This method returns the max number of versions for a portal.
Declaration
public int MaxFileVersions(int portalId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | portalId | Portal Id. |
Returns
Type | Description |
---|---|
System.Int32 | Max file versions. |
RollbackFileVersion(IFileInfo, Int32, Int32)
Rollbacks a file to the specified version.
Declaration
public void RollbackFileVersion(IFileInfo file, int version, int userId)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file | The file to perform the rollback. |
System.Int32 | version | The version to rollback to. |
System.Int32 | userId | The user who is performing the operation. |
SetPublishedVersion(IFileInfo, Int32)
Changes the published version of a file.
Declaration
public void SetPublishedVersion(IFileInfo file, int newPublishedVersion)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file | The file to change its published version. |
System.Int32 | newPublishedVersion |