Class MegaApiClient
Inheritance
Implements
Inherited Members
Namespace: CG.Web.MegaApiClient
Assembly: MegaApiClient.dll
Syntax
public class MegaApiClient : IMegaApiClientConstructors
| Improve this Doc View SourceMegaApiClient()
Instantiate a new MegaApiClient object with default Options and default IWebClient
Declaration
public MegaApiClient()MegaApiClient(IWebClient)
Instantiate a new MegaApiClient object with default Options and custom IWebClient
Declaration
public MegaApiClient(IWebClient webClient)Parameters
| Type | Name | Description | 
|---|---|---|
| IWebClient | webClient | 
MegaApiClient(Options)
Instantiate a new MegaApiClient object with custom Options and default IWebClient
Declaration
public MegaApiClient(Options options)Parameters
| Type | Name | Description | 
|---|---|---|
| Options | options | 
MegaApiClient(Options, IWebClient)
Instantiate a new MegaApiClient object with custom Options and custom IWebClient
Declaration
public MegaApiClient(Options options, IWebClient webClient)Parameters
| Type | Name | Description | 
|---|---|---|
| Options | options | |
| IWebClient | webClient | 
Properties
| Improve this Doc View SourceIsLoggedIn
Declaration
public bool IsLoggedIn { get; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
Methods
| Improve this Doc View SourceCreateFolder(String, INode)
Create a folder on the filesytem
Declaration
public INode CreateFolder(string name, INode parent)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | name | Folder name | 
| INode | parent | Parent node to attach created folder | 
Returns
| Type | Description | 
|---|---|
| INode | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
| System.ArgumentNullException | name or parent is null | 
| System.ArgumentException | parent is not valid (all types are allowed expect File) | 
CreateFolderAsync(String, INode)
Declaration
public Task<INode> CreateFolderAsync(string name, INode parent)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | name | |
| INode | parent | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<INode> | 
Delete(INode, Boolean)
Delete a node from the filesytem
Declaration
public void Delete(INode node, bool moveToTrash = true)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | node | Node to delete | 
| System.Boolean | moveToTrash | Moved to trash if true, Permanently deleted if false | 
Remarks
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
| System.ArgumentNullException | node is null | 
| System.ArgumentException | node is not a directory or a file | 
DeleteAsync(INode, Boolean)
Declaration
public Task DeleteAsync(INode node, bool moveToTrash = true)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | node | |
| System.Boolean | moveToTrash | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task | 
Download(INode, Nullable<CancellationToken>)
Retrieve a Stream to download and decrypt the specified node
Declaration
public Stream Download(INode node, CancellationToken? cancellationToken = null)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | node | Node to download (only File can be downloaded) | 
| System.Nullable<System.Threading.CancellationToken> | cancellationToken | CancellationToken used to cancel the action | 
Returns
| Type | Description | 
|---|---|
| System.IO.Stream | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
| System.ArgumentNullException | node or outputFile is null | 
| System.ArgumentException | node is not valid (only File can be downloaded) | 
| DownloadException | Checksum is invalid. Downloaded data are corrupted | 
Download(Uri, Nullable<CancellationToken>)
Retrieve a Stream to download and decrypt the specified Uri
Declaration
public Stream Download(Uri uri, CancellationToken? cancellationToken = null)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Uri | uri | Uri to download | 
| System.Nullable<System.Threading.CancellationToken> | cancellationToken | CancellationToken used to cancel the action | 
Returns
| Type | Description | 
|---|---|
| System.IO.Stream | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
| System.ArgumentNullException | uri is null | 
| System.ArgumentException | Uri is not valid (id and key are required) | 
| DownloadException | Checksum is invalid. Downloaded data are corrupted | 
DownloadAsync(INode, IProgress<Double>, Nullable<CancellationToken>)
Declaration
public Task<Stream> DownloadAsync(INode node, IProgress<double> progress = null, CancellationToken? cancellationToken = null)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | node | |
| System.IProgress<System.Double> | progress | |
| System.Nullable<System.Threading.CancellationToken> | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<System.IO.Stream> | 
DownloadAsync(Uri, IProgress<Double>, Nullable<CancellationToken>)
Declaration
public Task<Stream> DownloadAsync(Uri uri, IProgress<double> progress = null, CancellationToken? cancellationToken = null)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Uri | uri | |
| System.IProgress<System.Double> | progress | |
| System.Nullable<System.Threading.CancellationToken> | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<System.IO.Stream> | 
DownloadFile(INode, String, Nullable<CancellationToken>)
Download a specified node and save it to the specified file
Declaration
public void DownloadFile(INode node, string outputFile, CancellationToken? cancellationToken = null)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | node | Node to download (only File can be downloaded) | 
| System.String | outputFile | File to save the node to | 
| System.Nullable<System.Threading.CancellationToken> | cancellationToken | CancellationToken used to cancel the action | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
| System.ArgumentNullException | node or outputFile is null | 
| System.ArgumentException | node is not valid (only File can be downloaded) | 
| DownloadException | Checksum is invalid. Downloaded data are corrupted | 
DownloadFile(Uri, String, Nullable<CancellationToken>)
Download a specified Uri from Mega and save it to the specified file
Declaration
public void DownloadFile(Uri uri, string outputFile, CancellationToken? cancellationToken = null)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Uri | uri | Uri to download | 
| System.String | outputFile | File to save the Uri to | 
| System.Nullable<System.Threading.CancellationToken> | cancellationToken | CancellationToken used to cancel the action | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
| System.ArgumentNullException | uri or outputFile is null | 
| System.ArgumentException | Uri is not valid (id and key are required) | 
| DownloadException | Checksum is invalid. Downloaded data are corrupted | 
DownloadFileAsync(INode, String, IProgress<Double>, Nullable<CancellationToken>)
Declaration
public Task DownloadFileAsync(INode node, string outputFile, IProgress<double> progress = null, CancellationToken? cancellationToken = null)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | node | |
| System.String | outputFile | |
| System.IProgress<System.Double> | progress | |
| System.Nullable<System.Threading.CancellationToken> | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task | 
DownloadFileAsync(Uri, String, IProgress<Double>, Nullable<CancellationToken>)
Declaration
public Task DownloadFileAsync(Uri uri, string outputFile, IProgress<double> progress = null, CancellationToken? cancellationToken = null)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Uri | uri | |
| System.String | outputFile | |
| System.IProgress<System.Double> | progress | |
| System.Nullable<System.Threading.CancellationToken> | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task | 
DownloadFileAttribute(INode, FileAttributeType, Nullable<CancellationToken>)
Download thumbnail from file attributes (or return null if thumbnail is not available)
Declaration
public Stream DownloadFileAttribute(INode node, FileAttributeType fileAttributeType, CancellationToken? cancellationToken = null)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | node | Node to download the thumbnail from (only File can be downloaded) | 
| FileAttributeType | fileAttributeType | File attribute type to retrieve | 
| System.Nullable<System.Threading.CancellationToken> | cancellationToken | CancellationToken used to cancel the action | 
Returns
| Type | Description | 
|---|---|
| System.IO.Stream | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
| System.ArgumentNullException | node or outputFile is null | 
| System.ArgumentException | node is not valid (only File can be downloaded) | 
| System.InvalidOperationException | file attribute data is invalid | 
DownloadFileAttributeAsync(INode, FileAttributeType, Nullable<CancellationToken>)
Declaration
public Task<Stream> DownloadFileAttributeAsync(INode node, FileAttributeType fileAttributeType, CancellationToken? cancellationToken = null)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | node | |
| FileAttributeType | fileAttributeType | |
| System.Nullable<System.Threading.CancellationToken> | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<System.IO.Stream> | 
GenerateAuthInfos(String, String, String)
Generate authentication informations and store them in a serializable object to allow persistence
Declaration
public MegaApiClient.AuthInfos GenerateAuthInfos(string email, string password, string mfaKey = null)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | ||
| System.String | password | password | 
| System.String | mfaKey | 
Returns
| Type | Description | 
|---|---|
| MegaApiClient.AuthInfos | MegaApiClient.AuthInfos object containing encrypted data | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | email or password is null | 
GenerateAuthInfosAsync(String, String)
Declaration
public Task<MegaApiClient.AuthInfos> GenerateAuthInfosAsync(string email, string password)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | ||
| System.String | password | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<MegaApiClient.AuthInfos> | 
GenerateAuthInfosAsync(String, String, String)
Declaration
public Task<MegaApiClient.AuthInfos> GenerateAuthInfosAsync(string email, string password, string mfaKey)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | ||
| System.String | password | |
| System.String | mfaKey | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<MegaApiClient.AuthInfos> | 
GetAccountInformation()
Retrieve account (quota) information
Declaration
public IAccountInformation GetAccountInformation()Returns
| Type | Description | 
|---|---|
| IAccountInformation | An object containing account information | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
GetAccountInformationAsync()
Declaration
public Task<IAccountInformation> GetAccountInformationAsync()Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<IAccountInformation> | 
GetDownloadLink(INode)
Retrieve an url to download specified node
Declaration
public Uri GetDownloadLink(INode node)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | node | Node to retrieve the download link (only File or Directory can be downloaded) | 
Returns
| Type | Description | 
|---|---|
| System.Uri | Download link to retrieve the node with associated key | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
| System.ArgumentNullException | node is null | 
| System.ArgumentException | node is not valid (only File or Directory can be downloaded) | 
GetDownloadLinkAsync(INode)
Declaration
public Task<Uri> GetDownloadLinkAsync(INode node)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | node | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<System.Uri> | 
GetNodeFromLink(Uri)
Retrieve public properties of a file from a specified Uri
Declaration
public INode GetNodeFromLink(Uri uri)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Uri | uri | Uri to retrive properties | 
Returns
| Type | Description | 
|---|---|
| INode | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
| System.ArgumentNullException | uri is null | 
| System.ArgumentException | Uri is not valid (id and key are required) | 
GetNodeFromLinkAsync(Uri)
Declaration
public Task<INode> GetNodeFromLinkAsync(Uri uri)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Uri | uri | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<INode> | 
GetNodes()
Retrieve all filesystem nodes
Declaration
public IEnumerable<INode> GetNodes()Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerable<INode> | Flat representation of all the filesystem nodes | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
GetNodes(INode)
Retrieve children nodes of a parent node
Declaration
public IEnumerable<INode> GetNodes(INode parent)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | parent | 
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerable<INode> | Flat representation of children nodes | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
| System.ArgumentNullException | Parent node is null | 
GetNodesAsync()
Declaration
public Task<IEnumerable<INode>> GetNodesAsync()Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<INode>> | 
GetNodesAsync(INode)
Declaration
public Task<IEnumerable<INode>> GetNodesAsync(INode parent)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | parent | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<INode>> | 
GetNodesFromLink(Uri)
Retrieve list of nodes from a specified Uri
Declaration
public IEnumerable<INode> GetNodesFromLink(Uri uri)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Uri | uri | Uri | 
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerable<INode> | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
| System.ArgumentNullException | uri is null | 
| System.ArgumentException | Uri is not valid (id and key are required) | 
GetNodesFromLinkAsync(Uri)
Declaration
public Task<IEnumerable<INode>> GetNodesFromLinkAsync(Uri uri)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Uri | uri | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<INode>> | 
GetRecoveryKey()
Retrieve recovery key
Declaration
public string GetRecoveryKey()Returns
| Type | Description | 
|---|---|
| System.String | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
GetRecoveryKeyAsync()
Declaration
public Task<string> GetRecoveryKeyAsync()Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<System.String> | 
GetSessionsHistory()
Retrieve session history
Declaration
public IEnumerable<ISession> GetSessionsHistory()Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerable<ISession> | A collection of sessions | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
GetSessionsHistoryAsync()
Declaration
public Task<IEnumerable<ISession>> GetSessionsHistoryAsync()Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<ISession>> | 
Login()
Login anonymously to Mega.co.nz service
Declaration
public void Login()Exceptions
| Type | Condition | 
|---|---|
| ApiException | Throws if service is not available | 
Login(MegaApiClient.AuthInfos)
Login to Mega.co.nz service using hashed credentials
Declaration
public MegaApiClient.LogonSessionToken Login(MegaApiClient.AuthInfos authInfos)Parameters
| Type | Name | Description | 
|---|---|---|
| MegaApiClient.AuthInfos | authInfos | Authentication informations generated by GenerateAuthInfos(String, String, String) method | 
Returns
| Type | Description | 
|---|---|
| MegaApiClient.LogonSessionToken | 
Exceptions
| Type | Condition | 
|---|---|
| ApiException | Service is not available or authInfos is invalid | 
| System.ArgumentNullException | authInfos is null | 
| System.NotSupportedException | Already logged in | 
Login(MegaApiClient.LogonSessionToken)
Declaration
public void Login(MegaApiClient.LogonSessionToken logonSessionToken)Parameters
| Type | Name | Description | 
|---|---|---|
| MegaApiClient.LogonSessionToken | logonSessionToken | 
Login(String, String)
Login to Mega.co.nz service using email/password credentials
Declaration
public MegaApiClient.LogonSessionToken Login(string email, string password)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | ||
| System.String | password | password | 
Returns
| Type | Description | 
|---|---|
| MegaApiClient.LogonSessionToken | 
Exceptions
| Type | Condition | 
|---|---|
| ApiException | Service is not available or credentials are invalid | 
| System.ArgumentNullException | email or password is null | 
| System.NotSupportedException | Already logged in | 
Login(String, String, String)
Login to Mega.co.nz service using email/password credentials
Declaration
public MegaApiClient.LogonSessionToken Login(string email, string password, string mfaKey)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | ||
| System.String | password | password | 
| System.String | mfaKey | 
Returns
| Type | Description | 
|---|---|
| MegaApiClient.LogonSessionToken | 
Exceptions
| Type | Condition | 
|---|---|
| ApiException | Service is not available or credentials are invalid | 
| System.ArgumentNullException | email or password is null | 
| System.NotSupportedException | Already logged in | 
LoginAnonymous()
Login anonymously to Mega.co.nz service
Declaration
public void LoginAnonymous()Exceptions
| Type | Condition | 
|---|---|
| ApiException | Throws if service is not available | 
LoginAnonymousAsync()
Declaration
public Task LoginAnonymousAsync()Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task | 
LoginAsync()
Declaration
public Task LoginAsync()Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task | 
LoginAsync(MegaApiClient.AuthInfos)
Declaration
public Task<MegaApiClient.LogonSessionToken> LoginAsync(MegaApiClient.AuthInfos authInfos)Parameters
| Type | Name | Description | 
|---|---|---|
| MegaApiClient.AuthInfos | authInfos | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<MegaApiClient.LogonSessionToken> | 
LoginAsync(MegaApiClient.LogonSessionToken)
Declaration
public Task LoginAsync(MegaApiClient.LogonSessionToken logonSessionToken)Parameters
| Type | Name | Description | 
|---|---|---|
| MegaApiClient.LogonSessionToken | logonSessionToken | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task | 
LoginAsync(String, String, String)
Declaration
public Task<MegaApiClient.LogonSessionToken> LoginAsync(string email, string password, string mfaKey = null)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | ||
| System.String | password | |
| System.String | mfaKey | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<MegaApiClient.LogonSessionToken> | 
Logout()
Logout from Mega.co.nz service
Declaration
public void Logout()Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
LogoutAsync()
Declaration
public Task LogoutAsync()Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task | 
Move(INode, INode)
Change node parent
Declaration
public INode Move(INode node, INode destinationParentNode)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | node | Node to move | 
| INode | destinationParentNode | New parent | 
Returns
| Type | Description | 
|---|---|
| INode | Moved node | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
| System.ArgumentNullException | node or destinationParentNode is null | 
| System.ArgumentException | |
| System.ArgumentException | parent is not valid (all types except File are supported) | 
MoveAsync(INode, INode)
Declaration
public Task<INode> MoveAsync(INode sourceNode, INode destinationParentNode)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | sourceNode | |
| INode | destinationParentNode | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<INode> | 
Rename(INode, String)
Declaration
public INode Rename(INode node, string newName)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | node | |
| System.String | newName | 
Returns
| Type | Description | 
|---|---|
| INode | 
RenameAsync(INode, String)
Declaration
public Task<INode> RenameAsync(INode sourceNode, string newName)Parameters
| Type | Name | Description | 
|---|---|---|
| INode | sourceNode | |
| System.String | newName | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<INode> | 
Upload(Stream, String, INode, Nullable<DateTime>, Nullable<CancellationToken>)
Upload a stream on Mega.co.nz and attach created node to selected parent
Declaration
public INode Upload(Stream stream, string name, INode parent, DateTime? modificationDate = null, CancellationToken? cancellationToken = null)Parameters
| Type | Name | Description | 
|---|---|---|
| System.IO.Stream | stream | Data to upload | 
| System.String | name | Created node name | 
| INode | parent | Node to attach the uploaded file (all types except File are supported) | 
| System.Nullable<System.DateTime> | modificationDate | Custom modification date stored in the Node attributes | 
| System.Nullable<System.Threading.CancellationToken> | cancellationToken | CancellationToken used to cancel the action | 
Returns
| Type | Description | 
|---|---|
| INode | Created node | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
| System.ArgumentNullException | stream or name or parent is null | 
| System.ArgumentException | parent is not valid (all types except File are supported) | 
UploadAsync(Stream, String, INode, IProgress<Double>, Nullable<DateTime>, Nullable<CancellationToken>)
Declaration
public Task<INode> UploadAsync(Stream stream, string name, INode parent, IProgress<double> progress = null, DateTime? modificationDate = null, CancellationToken? cancellationToken = null)Parameters
| Type | Name | Description | 
|---|---|---|
| System.IO.Stream | stream | |
| System.String | name | |
| INode | parent | |
| System.IProgress<System.Double> | progress | |
| System.Nullable<System.DateTime> | modificationDate | |
| System.Nullable<System.Threading.CancellationToken> | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<INode> | 
UploadFile(String, INode, Nullable<CancellationToken>)
Upload a file on Mega.co.nz and attach created node to selected parent
Declaration
public INode UploadFile(string filename, INode parent, CancellationToken? cancellationToken = null)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | filename | File to upload | 
| INode | parent | Node to attach the uploaded file (all types except File are supported) | 
| System.Nullable<System.Threading.CancellationToken> | cancellationToken | CancellationToken used to cancel the action | 
Returns
| Type | Description | 
|---|---|
| INode | Created node | 
Exceptions
| Type | Condition | 
|---|---|
| System.NotSupportedException | Not logged in | 
| ApiException | Mega.co.nz service reports an error | 
| System.ArgumentNullException | filename or parent is null | 
| System.IO.FileNotFoundException | filename is not found | 
| System.ArgumentException | parent is not valid (all types except File are supported) | 
UploadFileAsync(String, INode, IProgress<Double>, Nullable<CancellationToken>)
Declaration
public Task<INode> UploadFileAsync(string filename, INode parent, IProgress<double> progress = null, CancellationToken? cancellationToken = null)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | filename | |
| INode | parent | |
| System.IProgress<System.Double> | progress | |
| System.Nullable<System.Threading.CancellationToken> | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<INode> | 
Events
| Improve this Doc View SourceApiRequestFailed
Declaration
public event EventHandler<ApiRequestFailedEventArgs> ApiRequestFailedEvent Type
| Type | Description | 
|---|---|
| System.EventHandler<ApiRequestFailedEventArgs> |