Class FileAccessOperations
Class FileAccessOperations helps to perform file operation in underlying machine's physical file system along with set of access rules and roles.
Inheritance
Inherited Members
Namespace: Syncfusion.JavaScript
Assembly: Syncfusion.EJ.dll
Syntax
public class FileAccessOperations
Constructors
FileAccessOperations(FileAccessInfo)
Initializes a new instance of the FileAccessOperations class.
Declaration
public FileAccessOperations(FileAccessInfo rule)
Parameters
Type | Name | Description |
---|---|---|
FileAccessInfo | rule | The rule. |
Methods
CombineRelativePath(String, String)
Combines the relative path.
Declaration
public virtual string CombineRelativePath(string path, string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The relative path. |
System.String | name | The name. |
Returns
Type | Description |
---|---|
System.String | System.String. |
CreateFolder(String, String)
Creates a new folder in given path with specified name.
Declaration
public virtual object CreateFolder(string path, string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Parent folder path. |
System.String | name | Name of the new folder. |
Returns
Type | Description |
---|---|
System.Object | System.Object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | ' + path + ' is not accessible. Access is denied. |
Download(String, String[])
Downloads the specified files.
Declaration
public virtual void Download(string path, string[] names)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Parent directory path of selected files, which is going to be download. |
System.String[] | names | Name of files that is need to be downloaded. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | ' + path + names[i] + ' is not accessible. Access is denied. |
GetDetails(String, String[])
Gets the details about specified file or directory.
Declaration
public virtual object GetDetails(string path, string[] names)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Parent directory path of selected file. |
System.String[] | names | File or folder name. |
Returns
Type | Description |
---|---|
System.Object | System.Object. |
GetFilePermission(String, String, Boolean)
Gets the file permission details for specified file/ folder.
Declaration
public virtual FileAccessRules GetFilePermission(string location, string name, bool isFile)
Parameters
Type | Name | Description |
---|---|---|
System.String | location | The path. |
System.String | name | The name. |
System.Boolean | isFile | if set to |
Returns
Type | Description |
---|---|
FileAccessRules | FileAccessRules. |
GetFolderDetails(String)
Gets the folder details for given path.
Declaration
public virtual string[] GetFolderDetails(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The folder path. |
Returns
Type | Description |
---|---|
System.String[] | System.String[]. |
GetImage(String)
Declaration
public virtual void GetImage(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path |
GetImage(String, Boolean, ImageSize, IEnumerable<Object>)
Declaration
public virtual void GetImage(string path, bool canCompress = false, ImageSize size = null, IEnumerable<object> selectedItems = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | |
System.Boolean | canCompress | |
ImageSize | size | |
System.Collections.Generic.IEnumerable<System.Object> | selectedItems |
GetPath(String)
Gets the physical path.
Declaration
public virtual string GetPath(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The relative path. |
Returns
Type | Description |
---|---|
System.String | System.String. |
GetPathPermission(String)
Gets the path permission for given path.
Declaration
public virtual FileAccessRules GetPathPermission(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The folder/ file path. |
Returns
Type | Description |
---|---|
FileAccessRules | FileAccessRules. |
HasPermission(Permission)
Determines whether the specified rule has permission.
Declaration
public virtual bool HasPermission(Permission rule)
Parameters
Type | Name | Description |
---|---|---|
Permission | rule | The rule. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsFile(String)
Determines whether the specified item is file.
Declaration
public virtual bool IsFile(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The path of the item. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Paste(String, String, String[], String, IEnumerable<CommonFileDetails>)
Copy or moves the specified files/ directories from one location to another location.
Declaration
public virtual object Paste(string sourceDir, string backupDir, string[] names, string option, IEnumerable<CommonFileDetails> commonFiles)
Parameters
Type | Name | Description |
---|---|---|
System.String | sourceDir | Source directory path. |
System.String | backupDir | Target directory path. |
System.String[] | names | Name of file/ folders, which are going to be pasted in destination folder. |
System.String | option | Operation type “move” or “copy”. |
System.Collections.Generic.IEnumerable<CommonFileDetails> | commonFiles | Existing files list, which contains same name, type and parent path as given in new file. |
Returns
Type | Description |
---|---|
System.Object | System.Object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | ' + sourceDir + names[i] + ' is not accessible. Access is denied. or ' + backupDir + ' is not accessible. Access is denied. |
Read(String, String)
Reads all immediate files and sub-folders from the specified path and it returns the matched type of files, which are specified in “filter” parameter.
Declaration
public virtual object Read(string path, string filter)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path of the selected folder. |
System.String | filter | File types to filter. |
Returns
Type | Description |
---|---|
System.Object | System.Object. |
Remove(String[], String)
Removes the specified items from given path.
Declaration
public virtual object Remove(string[] names, string path)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | names | Removable item names. |
System.String | path | Parent folder path of removable items. |
Returns
Type | Description |
---|---|
System.Object | System.Object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | ' + path + names[i] + ' is not accessible. Access is denied. |
Rename(String, String, String, IEnumerable<CommonFileDetails>)
Renames the specified file/folder, which is available in given path.
Declaration
public virtual object Rename(string path, string oldName, string newName, IEnumerable<CommonFileDetails> commonFiles)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Parent folder path of renaming item. |
System.String | oldName | Existing name. |
System.String | newName | New name. |
System.Collections.Generic.IEnumerable<CommonFileDetails> | commonFiles | Specifies existing files list, which contains same name, type and parent path as given in new file |
Returns
Type | Description |
---|---|
System.Object | System.Object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | ' + path + oldName + ' is not accessible. Access is denied. |
Search(String, String, String, Boolean)
Searches the matched files and sub-folders in the given folder path using search string.
Declaration
public virtual object Search(string path, string filter, string searchString, bool caseSensitive)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Directory path. |
System.String | filter | File types to filter. |
System.String | searchString | The search string. |
System.Boolean | caseSensitive | If set to |
Returns
Type | Description |
---|---|
System.Object | System.Object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | ' + path + ' is not accessible. Access is denied. |
SetPermission(String, IEnumerable<FileExplorerDirectoryContent>)
Sets the permission for files.
Declaration
public virtual FileExplorerDirectoryContent[] SetPermission(string path, IEnumerable<FileExplorerDirectoryContent> files)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The parent path of the file. |
System.Collections.Generic.IEnumerable<FileExplorerDirectoryContent> | files | The files. |
Returns
Type | Description |
---|---|
FileExplorerDirectoryContent[] | FileExplorerDirectoryContent[]. |
UpdateFileRules(FileAccessRules, AccessRule)
Updates the file rules.
Declaration
public virtual FileAccessRules UpdateFileRules(FileAccessRules filePermission, AccessRule fileRule)
Parameters
Type | Name | Description |
---|---|---|
FileAccessRules | filePermission | The file access permission. |
AccessRule | fileRule | The file rule. |
Returns
Type | Description |
---|---|
FileAccessRules | FileAccessRules. |
UpdateFolderRules(FileAccessRules, AccessRule)
Updates the folder rules.
Declaration
public virtual FileAccessRules UpdateFolderRules(FileAccessRules filePermission, AccessRule folderRule)
Parameters
Type | Name | Description |
---|---|---|
FileAccessRules | filePermission | The file access permission. |
AccessRule | folderRule | The folder rule. |
Returns
Type | Description |
---|---|
FileAccessRules | FileAccessRules. |
Upload(IEnumerable<HttpPostedFileBase>, String)
Uploads the specified files to given path.
Declaration
public virtual void Upload(IEnumerable<HttpPostedFileBase> files, string path)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Web.HttpPostedFileBase> | files | Uploading file details. |
System.String | path | Path of destination directory, where the files need to be uploaded. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | ' + path + ' is not accessible. Access is denied. |