Class FolderManager
Exposes methods to manage folders.
Implements
Inherited Members
Namespace: DotNetNuke.Services.FileSystem
Assembly: DotNetNuke.dll
Syntax
public class FolderManager : ComponentBase<IFolderManager, FolderManager>, IFolderManager
Properties
| Improve this Doc View SourceMyFolderName
Gets the localization key for MyFolderName.
Declaration
public virtual string MyFolderName { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Methods
| Improve this Doc View SourceAddAllUserReadPermission(IFolderInfo, PermissionInfo)
Adds read permissions for all users to the specified folder.
Declaration
public virtual void AddAllUserReadPermission(IFolderInfo folder, PermissionInfo permission)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder to add the permission to. |
| PermissionInfo | permission | Used as base class for FolderPermissionInfo when there is no read permission already defined. |
AddFolder(FolderMappingInfo, String, String)
Creates a new folder using the provided folder path and mapping.
Declaration
public virtual IFolderInfo AddFolder(FolderMappingInfo folderMapping, string folderPath, string mappedPath)
Parameters
| Type | Name | Description |
|---|---|---|
| FolderMappingInfo | folderMapping | The folder mapping to use. |
| System.String | folderPath | The path of the new folder. |
| System.String | mappedPath | The mapped path of the new folder. |
Returns
| Type | Description |
|---|---|
| IFolderInfo | The added folder. |
Exceptions
| Type | Condition |
|---|---|
| FolderProviderException | Thrown when the underlying system throw an exception. |
AddFolder(FolderMappingInfo, String)
Creates a new folder using the provided folder path.
Declaration
public virtual IFolderInfo AddFolder(FolderMappingInfo folderMapping, string folderPath)
Parameters
| Type | Name | Description |
|---|---|---|
| FolderMappingInfo | folderMapping | The folder mapping to use. |
| System.String | folderPath | The path of the new folder. |
Returns
| Type | Description |
|---|---|
| IFolderInfo | The added folder. |
Exceptions
| Type | Condition |
|---|---|
| FolderProviderException | Thrown when the underlying system throw an exception. |
AddFolder(Int32, String)
Creates a new folder in the given portal using the provided folder path. The same mapping than the parent folder will be used to create this folder. So this method have to be used only to create subfolders.
Declaration
public virtual IFolderInfo AddFolder(int portalId, string folderPath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | portalId | The portal identifier. |
| System.String | folderPath | The path of the new folder. |
Returns
| Type | Description |
|---|---|
| IFolderInfo | The added folder. |
CopyParentFolderPermissions(IFolderInfo)
Sets folder permissions to the given folder by copying parent folder permissions.
Declaration
public virtual void CopyParentFolderPermissions(IFolderInfo folder)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder to copy permissions to. |
DeleteFolder(IFolderInfo, ICollection<IFolderInfo>)
Deletes the specified folder and all its content.
Declaration
public void DeleteFolder(IFolderInfo folder, ICollection<IFolderInfo> notDeletedSubfolders)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder to delete. |
| ICollection<IFolderInfo> | notDeletedSubfolders | A collection with all not deleted subfolders after processiong the action. |
DeleteFolder(IFolderInfo)
Deletes the specified folder.
Declaration
public virtual void DeleteFolder(IFolderInfo folder)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder to delete. |
Exceptions
| Type | Condition |
|---|---|
| FolderProviderException | Thrown when the underlying system throw an exception. |
DeleteFolder(Int32)
Deletes the specified folder.
Declaration
public virtual void DeleteFolder(int folderId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | folderId | The folder identifier. |
FolderExists(Int32, String)
Checks the existence of the specified folder in the specified portal.
Declaration
public virtual bool FolderExists(int portalId, string folderPath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | portalId | The portal where to check the existence of the folder. |
| System.String | folderPath | The path of folder to check the existence of. |
Returns
| Type | Description |
|---|---|
| System.Boolean | A bool value indicating whether the folder exists or not in the specified portal. |
GetFiles(IFolderInfo, Boolean, Boolean)
Gets the files contained in the specified folder.
Declaration
public virtual IEnumerable<IFileInfo> GetFiles(IFolderInfo folder, bool recursive, bool retrieveUnpublishedFiles)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder from which to retrieve the files. |
| System.Boolean | recursive | Whether or not to include all the subfolders. |
| System.Boolean | retrieveUnpublishedFiles | Indicates if the file is retrieved from All files or from Published files. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IFileInfo> | The list of files contained in the specified folder. |
GetFiles(IFolderInfo, Boolean)
Gets the files contained in the specified folder.
Declaration
public virtual IEnumerable<IFileInfo> GetFiles(IFolderInfo folder, bool recursive)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder from which to retrieve the files. |
| System.Boolean | recursive | Whether or not to include all the subfolders. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IFileInfo> | The list of files contained in the specified folder. |
GetFiles(IFolderInfo)
Gets the files contained in the specified folder.
Declaration
public virtual IEnumerable<IFileInfo> GetFiles(IFolderInfo folder)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder from which to retrieve the files. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IFileInfo> | The list of files contained in the specified folder. |
GetFileSystemFolders(UserInfo, String)
Gets the list of Standard folders the specified user has the provided permissions.
Declaration
public virtual IEnumerable<IFolderInfo> GetFileSystemFolders(UserInfo user, string permissions)
Parameters
| Type | Name | Description |
|---|---|---|
| UserInfo | user | The user info. |
| System.String | permissions | The permissions the folders have to met. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IFolderInfo> | The list of Standard folders the specified user has the provided permissions. |
Remarks
This method is used to support legacy behaviours and situations where we know the file/folder is in the file system.
GetFolder(Guid)
Gets a folder entity by providing its unique id.
Declaration
public virtual IFolderInfo GetFolder(Guid uniqueId)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | uniqueId | The unique id of the folder. |
Returns
| Type | Description |
|---|---|
| IFolderInfo | The folder entity or null if the folder cannot be located. |
GetFolder(Int32, String)
Gets a folder entity by providing a portal identifier and folder path.
Declaration
public virtual IFolderInfo GetFolder(int portalId, string folderPath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | portalId | The portal where the folder exists. |
| System.String | folderPath | The path of the folder. |
Returns
| Type | Description |
|---|---|
| IFolderInfo | The folder entity or null if the folder cannot be located. |
GetFolder(Int32)
Gets a folder entity by providing a folder identifier.
Declaration
public virtual IFolderInfo GetFolder(int folderId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | folderId | The identifier of the folder. |
Returns
| Type | Description |
|---|---|
| IFolderInfo | The folder entity or null if the folder cannot be located. |
GetFolders(UserInfo, String)
Gets the list of folders the specified user has the provided permissions.
Declaration
public virtual IEnumerable<IFolderInfo> GetFolders(UserInfo user, string permissions)
Parameters
| Type | Name | Description |
|---|---|---|
| UserInfo | user | The user info. |
| System.String | permissions | The permissions the folders have to met. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IFolderInfo> | The list of folders the specified user has the provided permissions. |
GetFolders(UserInfo)
Gets the list of folders the specified user has read permissions.
Declaration
public virtual IEnumerable<IFolderInfo> GetFolders(UserInfo user)
Parameters
| Type | Name | Description |
|---|---|---|
| UserInfo | user | The user info. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IFolderInfo> | The list of folders the specified user has read permissions. |
GetFolders(IFolderInfo)
Gets the list of subfolders for the specified folder.
Declaration
public virtual IEnumerable<IFolderInfo> GetFolders(IFolderInfo parentFolder)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | parentFolder | The folder to get the list of subfolders. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IFolderInfo> | The list of subfolders for the specified folder. |
GetFolders(Int32, Boolean)
Gets the sorted list of folders of the provided portal.
Declaration
public virtual IEnumerable<IFolderInfo> GetFolders(int portalId, bool useCache)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | portalId | The portal identifier. |
| System.Boolean | useCache | True = Read from Cache, False = Read from DB. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IFolderInfo> | The sorted list of folders of the provided portal. |
GetFolders(Int32, String, Int32)
Gets the sorted list of folders that match the provided permissions in the specified portal.
Declaration
public virtual IEnumerable<IFolderInfo> GetFolders(int portalId, string permissions, int userId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | portalId | The portal identifier. |
| System.String | permissions | The permissions to match. |
| System.Int32 | userId | The user identifier to be used to check permissions. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IFolderInfo> | The list of folders that match the provided permissions in the specified portal. |
GetFolders(Int32)
Gets the sorted list of folders of the provided portal.
Declaration
public virtual IEnumerable<IFolderInfo> GetFolders(int portalId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | portalId | The portal identifier. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IFolderInfo> | The sorted list of folders of the provided portal. |
GetUserFolder(UserInfo)
Gets the folder that belongs to a specific user.
Declaration
public virtual IFolderInfo GetUserFolder(UserInfo userInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| UserInfo | userInfo | The user to get the folder for. |
Returns
| Type | Description |
|---|---|
| IFolderInfo | The information about the the user folder, IFolderInfo. |
MoveFolder(IFolderInfo, IFolderInfo)
Moves a folder to a new location.
Declaration
public virtual IFolderInfo MoveFolder(IFolderInfo folder, IFolderInfo destinationFolder)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder to move. |
| IFolderInfo | destinationFolder | Where to move the new folder. |
Returns
| Type | Description |
|---|---|
| IFolderInfo | The information about the moved folder, IFolderInfo. |
MoveFolder(IFolderInfo, String)
Moves the specified folder and its contents to a new location.
Declaration
public virtual IFolderInfo MoveFolder(IFolderInfo folder, string newFolderPath)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder to move. |
| System.String | newFolderPath | The new folder path. |
Returns
| Type | Description |
|---|---|
| IFolderInfo | The moved folder. |
RenameFolder(IFolderInfo, String)
Renames the specified folder by setting the new provided folder name.
Declaration
public virtual void RenameFolder(IFolderInfo folder, string newFolderName)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder to rename. |
| System.String | newFolderName | The new name to apply to the folder. |
Exceptions
| Type | Condition |
|---|---|
| FolderProviderException | Thrown when the underlying system throw an exception. |
SearchFiles(IFolderInfo, String, Boolean)
Search the files contained in the specified folder, for a matching pattern.
Declaration
public virtual IEnumerable<IFileInfo> SearchFiles(IFolderInfo folder, string pattern, bool recursive)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder from which to retrieve the files. |
| System.String | pattern | The patter to search for. |
| System.Boolean | recursive | Shoud the search be recursive. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IFileInfo> | The list of files contained in the specified folder. |
SetFolderPermission(IFolderInfo, Int32, Int32, Int32)
Sets specific folder permissions for the given role/user to the given folder.
Declaration
public virtual void SetFolderPermission(IFolderInfo folder, int permissionId, int roleId, int userId)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder to set permission to. |
| System.Int32 | permissionId | The id of the permission to assign. |
| System.Int32 | roleId | The role to assign the permission to. |
| System.Int32 | userId | The user to assign the permission to. |
SetFolderPermission(IFolderInfo, Int32, Int32)
Sets specific folder permissions for the given role to the given folder.
Declaration
public virtual void SetFolderPermission(IFolderInfo folder, int permissionId, int roleId)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder to set permission to. |
| System.Int32 | permissionId | The id of the permission to assign. |
| System.Int32 | roleId | The role to assign the permission to. |
SetFolderPermissions(IFolderInfo, Int32)
Sets folder permissions for administrator role to the given folder.
Declaration
public virtual void SetFolderPermissions(IFolderInfo folder, int administratorRoleId)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder to set permission to. |
| System.Int32 | administratorRoleId | The administrator role id to assign the permission to. |
Synchronize(Int32, String, Boolean, Boolean)
Syncrhonizes the specified folder, its files and, optionally, its subfolders.
Declaration
public virtual int Synchronize(int portalId, string relativePath, bool isRecursive, bool syncFiles)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | portalId | The portal identifier. |
| System.String | relativePath | The relative path of the folder. |
| System.Boolean | isRecursive | Indicates if the synchronization has to be recursive. |
| System.Boolean | syncFiles | Indicates if files need to be synchronized. |
Returns
| Type | Description |
|---|---|
| System.Int32 | The number of folder collisions. |
Exceptions
| Type | Condition |
|---|---|
| NoNetworkAvailableException | Thrown when there are folder mappings requiring network connection but there is no network available. |
Synchronize(Int32, String)
Syncrhonizes the specified folder, its files and its subfolders.
Declaration
public virtual int Synchronize(int portalId, string relativePath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | portalId | The portal identifier. |
| System.String | relativePath | The relative path of the folder. |
Returns
| Type | Description |
|---|---|
| System.Int32 | The number of folder collisions. |
Synchronize(Int32)
Synchronizes the entire folder tree for the specified portal.
Declaration
public virtual int Synchronize(int portalId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | portalId | The portal identifier. |
Returns
| Type | Description |
|---|---|
| System.Int32 | The number of folder collisions. |
UnlinkFolder(IFolderInfo)
Removes the database reference to a folder on disk.
Declaration
public virtual void UnlinkFolder(IFolderInfo folder)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder to unlink. |
UpdateFolder(IFolderInfo)
Updates metadata of the specified folder.
Declaration
public virtual IFolderInfo UpdateFolder(IFolderInfo folder)
Parameters
| Type | Name | Description |
|---|---|---|
| IFolderInfo | folder | The folder to update. |
Returns
| Type | Description |
|---|---|
| IFolderInfo | The information about the updated folder, IFolderInfo. |