GemBox.Email
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    GraphClient Class

    Namespace:
    GemBox.Email.Graph
    Assembly:
    GemBox.Email.dll

    Represents a mail client that can be used for interaction with Microsoft Graph API.

    • C#
    • VB.NET
    public class GraphClient
    Public Class GraphClient
    Inheritance:
    System.Object
    GraphClient

    Constructors

    GraphClient()

    Initializes a new instance of GraphClient.

    • C#
    • VB.NET
    public GraphClient()
    Public Sub New
    Remarks

    This constructor initializes a GraphClient using the default Graph API endpoint.

    GraphClient(String)

    Initializes a new instance of GraphClient.

    Base URL for Graph API requests.
    • C#
    • VB.NET
    public GraphClient(string baseUrl)
    Public Sub New(baseUrl As String)
    Parameters
    baseUrl
    System.String

    Properties

    LogOutput

    Gets or sets the log output writer.

    • C#
    • VB.NET
    public TextWriter LogOutput { get; set; }
    Public Property LogOutput As TextWriter
    Property Value
    System.IO.TextWriter

    The log output writer.

    Remarks

    Setting this property to a non-null value, enables communication logging. All commands and responses between the client and server will be written to the provided System.IO.TextWriter. Logging is disabled by setting this property to null.

    Methods

    Authenticate(String)

    Authenticates the client with the specified access token.

    • C#
    • VB.NET
    public void Authenticate(string token)
    Public Sub Authenticate(token As String)
    Parameters
    token
    System.String

    Access token for authentication in Graph API.

    Exceptions
    System.ArgumentException

    Specified token is null.

    CopyMessage(String, String)

    Copies the specified message to another folder.

    • C#
    • VB.NET
    public GraphMessageInfo CopyMessage(string messageId, string destinationFolder)
    Public Function CopyMessage(messageId As String, destinationFolder As String) As GraphMessageInfo
    Parameters
    messageId
    System.String

    The message id.

    destinationFolder
    System.String

    The destination folder name.

    Returns
    GraphMessageInfo

    The copied message.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Message id is null or empty, or destination folder is null or empty or the destination folder wasn't found.

    CopyMessageByFolderId(String, String)

    Copies the specified message to another folder.

    • C#
    • VB.NET
    public GraphMessageInfo CopyMessageByFolderId(string messageId, string destinationFolderId)
    Public Function CopyMessageByFolderId(messageId As String, destinationFolderId As String) As GraphMessageInfo
    Parameters
    messageId
    System.String

    The message id.

    destinationFolderId
    System.String

    The destination folder id.

    Returns
    GraphMessageInfo

    The copied message.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Message id is null or empty, or destination folder is null or empty or the destination folder wasn't found.

    CreateFolder(String)

    Creates folders based on full name.

    For the input "Inbox/Parent/Child":
    If there is already a "Parent" folder under the Inbox folder, a folder named "Child" will be created under that.
    If there is no folder named "Parent" under the Inbox folder, it will be created, and then another folder named "Child" will be created under it.

    • C#
    • VB.NET
    public GraphFolderInfo CreateFolder(string name)
    Public Function CreateFolder(name As String) As GraphFolderInfo
    Parameters
    name
    System.String

    The full folder name.

    Returns
    GraphFolderInfo
    Remarks

    The folder will be created as visible (not hidden)

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder name is null or empty.

    CreateFolder(String, DefaultFolders)

    Creates a new subfolder with the specified name inside a default folder.

    Path syntax is also supported on this overload.

    • C#
    • VB.NET
    public GraphFolderInfo CreateFolder(string name, DefaultFolders parent)
    Public Function CreateFolder(name As String, parent As DefaultFolders) As GraphFolderInfo
    Parameters
    name
    System.String

    The full folder name.

    parent
    DefaultFolders

    The parent default folder.

    Returns
    GraphFolderInfo
    Remarks

    The folder will be created as visible (not hidden)

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder name is null or empty.

    CreateFolder(String, DefaultFolders, Boolean)

    Creates a new subfolder with the specified name inside a default folder.

    Path syntax is also supported on this overload

    • C#
    • VB.NET
    public GraphFolderInfo CreateFolder(string name, DefaultFolders parent, bool hidden)
    Public Function CreateFolder(name As String, parent As DefaultFolders, hidden As Boolean) As GraphFolderInfo
    Parameters
    name
    System.String

    The full folder name.

    parent
    DefaultFolders

    The parent default folder.

    hidden
    System.Boolean

    True if folder should be hidden, otherwise false.

    Returns
    GraphFolderInfo
    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder name is null or empty.

    CreateFolder(String, Boolean)

    Creates folders based on full name.

    For the input "Inbox/Parent/Child":
    If there is already a "Parent" folder under the Inbox folder, a folder named "Child" will be created under that.
    If there is no folder named "Parent" under the Inbox folder, it will be created, and then another folder named "Child" will be created under it.

    • C#
    • VB.NET
    public GraphFolderInfo CreateFolder(string name, bool hidden)
    Public Function CreateFolder(name As String, hidden As Boolean) As GraphFolderInfo
    Parameters
    name
    System.String

    The full folder name.

    hidden
    System.Boolean

    True if folder should be hidden, otherwise false.

    Returns
    GraphFolderInfo
    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder name is null or empty.

    CreateFolder(String, String)

    Creates a new subfolder with the specified name inside a specific folder.

    Path syntax is also supported on this overload.

    • C#
    • VB.NET
    public GraphFolderInfo CreateFolder(string name, string parentId)
    Public Function CreateFolder(name As String, parentId As String) As GraphFolderInfo
    Parameters
    name
    System.String

    The folder name.

    parentId
    System.String

    The Id of the parent folder.

    Returns
    GraphFolderInfo
    Remarks

    The folder will be created as visible (not hidden)

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder name is null or empty.

    CreateFolder(String, String, Boolean)

    Creates a new subfolder with the specified name inside a specific folder.

    Path syntax is also supported on this overload

    • C#
    • VB.NET
    public GraphFolderInfo CreateFolder(string name, string parentId, bool hidden)
    Public Function CreateFolder(name As String, parentId As String, hidden As Boolean) As GraphFolderInfo
    Parameters
    name
    System.String

    The folder name.

    parentId
    System.String

    The Id of the parent folder.

    hidden
    System.Boolean

    True if folder should be hidden, otherwise false.

    Returns
    GraphFolderInfo
    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder name is null or empty.

    DeleteFolder(String)

    Deletes the specified folder.

    • C#
    • VB.NET
    public void DeleteFolder(string name)
    Public Sub DeleteFolder(name As String)
    Parameters
    name
    System.String

    The full folder name.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder name is null or empty or folder was not found.

    DeleteFolderById(String)

    Deletes the specified folder.

    • C#
    • VB.NET
    public void DeleteFolderById(string id)
    Public Sub DeleteFolderById(id As String)
    Parameters
    id
    System.String

    The folder's id.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder id is null or empty.

    DeleteMessage(String)

    Deletes the specified message.

    • C#
    • VB.NET
    public void DeleteMessage(string messageId)
    Public Sub DeleteMessage(messageId As String)
    Parameters
    messageId
    System.String

    The message id.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Message id is null or empty.

    GetFolderInfo(String)

    Gets information of a specified folder.

    • C#
    • VB.NET
    public GraphFolderInfo GetFolderInfo(string name)
    Public Function GetFolderInfo(name As String) As GraphFolderInfo
    Parameters
    name
    System.String

    The full folder name.

    Returns
    GraphFolderInfo

    The information of the specified folder.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder name is null or empty.

    GetFolderInfoById(String)

    Gets the information of a specified folder.

    • C#
    • VB.NET
    public GraphFolderInfo GetFolderInfoById(string id)
    Public Function GetFolderInfoById(id As String) As GraphFolderInfo
    Parameters
    id
    System.String

    The folder's id.

    Returns
    GraphFolderInfo

    The information of the specified folder.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder id is null or empty.

    GetHeaders(String)

    Gets the headers for the specified message.

    • C#
    • VB.NET
    public HeaderCollection GetHeaders(string messageId)
    Public Function GetHeaders(messageId As String) As HeaderCollection
    Parameters
    messageId
    System.String

    The message id.

    Returns
    HeaderCollection

    A collection of message headers.

    Exceptions
    System.ArgumentException

    Message id is null or empty.

    GetMessage(String)

    Finds a message with the given id.

    • C#
    • VB.NET
    public MailMessage GetMessage(string messageId)
    Public Function GetMessage(messageId As String) As MailMessage
    Parameters
    messageId
    System.String

    The message id.

    Returns
    MailMessage

    The found message.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Message id is null or empty.

    FreeLimitReachedException

    Free license limitation exceeded.

    ImpersonateUser(String)

    Defines a user to impersonate, allowing the client to perform operations on another user's mailbox.

    • C#
    • VB.NET
    public void ImpersonateUser(string emailOrUserId)
    Public Sub ImpersonateUser(emailOrUserId As String)
    Parameters
    emailOrUserId
    System.String

    The email or id of the user to impersonate.

    Remarks

    Successfully using the impersonation requires the client to be authenticated using a token created with this permission.

    ListFolders()

    Lists all folders (and their subfolders) on the server.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphFolderInfo> ListFolders()
    Public Function ListFolders As ReadOnlyCollection(Of GraphFolderInfo)
    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphFolderInfo>

    A read-only collection of all folders (and their subfolders) on the server.

    Remarks

    Hidden folders will not be included in the result list.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    ListFolders(DefaultFolders)

    Lists subfolders (and their subfolders) of a default folder on the server.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphFolderInfo> ListFolders(DefaultFolders parent)
    Public Function ListFolders(parent As DefaultFolders) As ReadOnlyCollection(Of GraphFolderInfo)
    Parameters
    parent
    DefaultFolders

    The parent default folder.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphFolderInfo>

    A read-only collection of subfolders (and their subfolders) of a default folder on the server.

    Remarks

    Hidden folders will not be included in the result list.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    ListFolders(DefaultFolders, Boolean)

    Lists subfolders of a default folder on the server.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphFolderInfo> ListFolders(DefaultFolders parent, bool directChildrenOnly)
    Public Function ListFolders(parent As DefaultFolders, directChildrenOnly As Boolean) As ReadOnlyCollection(Of GraphFolderInfo)
    Parameters
    parent
    DefaultFolders

    The parent default folder.

    directChildrenOnly
    System.Boolean

    Whether or not to include only the parent's direct children (true) or to also include every child's subfolders recursively (false).

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphFolderInfo>

    A read-only collection of subfolders of a default folder on the server.

    Remarks

    Hidden folders will not be included in the result list.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    ListFolders(DefaultFolders, Boolean, Boolean)

    Lists subfolders of a default folder on the server.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphFolderInfo> ListFolders(DefaultFolders parent, bool directChildrenOnly, bool includeHidden)
    Public Function ListFolders(parent As DefaultFolders, directChildrenOnly As Boolean, includeHidden As Boolean) As ReadOnlyCollection(Of GraphFolderInfo)
    Parameters
    parent
    DefaultFolders

    The parent default folder.

    directChildrenOnly
    System.Boolean

    Whether or not to include only the parent's direct children (true) or to also include every child's subfolders recursively (false).

    includeHidden
    System.Boolean

    Whether or not to include hidden folders.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphFolderInfo>

    A read-only collection of subfolders of a default folder on the server.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    ListFolders(Boolean)

    Lists all folders (and their subfolders) on the server.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphFolderInfo> ListFolders(bool includeHidden)
    Public Function ListFolders(includeHidden As Boolean) As ReadOnlyCollection(Of GraphFolderInfo)
    Parameters
    includeHidden
    System.Boolean

    Whether or not to include hidden folders.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphFolderInfo>

    A read-only collection of all folders (and their subfolders) on the server.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    ListFolders(String)

    Lists subfolders (and their subfolders) of a specific folder on the server.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphFolderInfo> ListFolders(string parentName)
    Public Function ListFolders(parentName As String) As ReadOnlyCollection(Of GraphFolderInfo)
    Parameters
    parentName
    System.String

    The full name of the parent folder.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphFolderInfo>

    A read-only collection of subfolders (and their subfolders) of a specific folder on the server.

    Remarks

    Hidden folders will not be included in the result list.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Parent folder name is null or empty or the parent folder wasn't found.

    ListFolders(String, Boolean)

    Lists subfolders of a specific folder on the server.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphFolderInfo> ListFolders(string parentName, bool directChildrenOnly)
    Public Function ListFolders(parentName As String, directChildrenOnly As Boolean) As ReadOnlyCollection(Of GraphFolderInfo)
    Parameters
    parentName
    System.String

    The full name of the parent folder.

    directChildrenOnly
    System.Boolean

    Whether or not to include only the parent's direct children (true) or to also include every child's subfolders recursively (false).

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphFolderInfo>

    A read-only collection of subfolders of a specific folder on the server.

    Remarks

    Hidden folders will not be included in the result list.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Parent folder name is null or empty or the parent folder wasn't found.

    ListFolders(String, Boolean, Boolean)

    Lists subfolders of a specific folder on the server.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphFolderInfo> ListFolders(string parentName, bool directChildrenOnly, bool includeHidden)
    Public Function ListFolders(parentName As String, directChildrenOnly As Boolean, includeHidden As Boolean) As ReadOnlyCollection(Of GraphFolderInfo)
    Parameters
    parentName
    System.String

    The full name of the parent folder.

    directChildrenOnly
    System.Boolean

    Whether or not to include only the parent's direct children (true) or to also include every child's subfolders recursively (false).

    includeHidden
    System.Boolean

    Whether or not to include hidden folders.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphFolderInfo>

    A read-only collection of all folders on the server.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Parent folder name is null or empty or the parent folder wasn't found.

    ListFoldersById(String, Boolean, Boolean)

    Lists subfolders of a specific folder on the server.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphFolderInfo> ListFoldersById(string parentId, bool directChildrenOnly, bool includeHidden)
    Public Function ListFoldersById(parentId As String, directChildrenOnly As Boolean, includeHidden As Boolean) As ReadOnlyCollection(Of GraphFolderInfo)
    Parameters
    parentId
    System.String

    The parent folder id.

    directChildrenOnly
    System.Boolean

    Whether or not to include only the parent's direct children (true) or to also include every child's subfolders recursively (false).

    includeHidden
    System.Boolean

    Whether or not to include hidden folders.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphFolderInfo>

    A read-only collection of all folders on the server.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    ListMessages()

    Lists all messages in all folders.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphMessageInfo> ListMessages()
    Public Function ListMessages As ReadOnlyCollection(Of GraphMessageInfo)
    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphMessageInfo>

    A read-only collection of all messages in all folders. Returns an empty collection if no messages were found.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    ListMessages(DefaultFolders)

    Lists all messages in the selected default folder.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphMessageInfo> ListMessages(DefaultFolders folder)
    Public Function ListMessages(folder As DefaultFolders) As ReadOnlyCollection(Of GraphMessageInfo)
    Parameters
    folder
    DefaultFolders

    The default folder

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphMessageInfo>

    A read-only collection of all messages in the selected folder. Returns an empty collection if the folder is empty.

    Exceptions
    System.InvalidOperationException

    No folder is selected or Client must be authenticated before usage or Client could not be connected or Server error.

    ListMessages(DefaultFolders, Int32, Int32)

    Lists all messages in the selected default folder in the specified range.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphMessageInfo> ListMessages(DefaultFolders folder, int offset, int count)
    Public Function ListMessages(folder As DefaultFolders, offset As Integer, count As Integer) As ReadOnlyCollection(Of GraphMessageInfo)
    Parameters
    folder
    DefaultFolders

    The default folder

    offset
    System.Int32

    Number of messages that should be skipped.

    count
    System.Int32

    Number of messages that should be returned.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphMessageInfo>

    A read-only collection of all messages in the selected folder. Returns an empty collection if the folder is empty.

    Exceptions
    System.InvalidOperationException

    No folder is selected or Client must be authenticated before usage or Client could not be connected or Server error.

    ListMessages(String)

    Lists all messages in the selected folder.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphMessageInfo> ListMessages(string folderName)
    Public Function ListMessages(folderName As String) As ReadOnlyCollection(Of GraphMessageInfo)
    Parameters
    folderName
    System.String

    The full folder name.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphMessageInfo>

    A read-only collection of all messages in the selected folder. Returns an empty collection if the folder is empty.

    Exceptions
    System.InvalidOperationException

    No folder is selected or Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder name is null or empty.

    ListMessages(String, Int32, Int32)

    Lists all messages in the selected folder in the specified range.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphMessageInfo> ListMessages(string folderName, int offset, int count)
    Public Function ListMessages(folderName As String, offset As Integer, count As Integer) As ReadOnlyCollection(Of GraphMessageInfo)
    Parameters
    folderName
    System.String

    The full folder name.

    offset
    System.Int32

    Number of messages that should be skipped.

    count
    System.Int32

    Number of messages that should be returned.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphMessageInfo>

    A read-only collection of all messages in the selected folder in the specified range. Returns an empty collection if the folder is empty.

    Exceptions
    System.InvalidOperationException

    No folder is selected or Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder name is null or empty or folder was not found.

    ListMessagesByFolderId(String)

    Lists all messages in the selected folder.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphMessageInfo> ListMessagesByFolderId(string folderId)
    Public Function ListMessagesByFolderId(folderId As String) As ReadOnlyCollection(Of GraphMessageInfo)
    Parameters
    folderId
    System.String

    The folder id.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphMessageInfo>

    A read-only collection of all messages in the selected folder. Returns an empty collection if the folder is empty.

    Exceptions
    System.InvalidOperationException

    No folder is selected or Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder id is null or empty or folder was not found.

    ListMessagesByFolderId(String, Int32, Int32)

    Lists all messages in the selected folder in the specified range.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphMessageInfo> ListMessagesByFolderId(string folderId, int offset, int count)
    Public Function ListMessagesByFolderId(folderId As String, offset As Integer, count As Integer) As ReadOnlyCollection(Of GraphMessageInfo)
    Parameters
    folderId
    System.String

    The folder id.

    offset
    System.Int32

    Number of messages that should be skipped.

    count
    System.Int32

    Number of messages that should be returned.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphMessageInfo>

    A read-only collection of all messages in the selected folder. Returns an empty collection if the folder is empty.

    Exceptions
    System.InvalidOperationException

    No folder is selected or Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder id is null or empty or folder was not found.

    MarkAllMessagesAsRead(String)

    Marks all messages in a given folder as read.

    • C#
    • VB.NET
    public void MarkAllMessagesAsRead(string folderName)
    Public Sub MarkAllMessagesAsRead(folderName As String)
    Parameters
    folderName
    System.String

    The full folder name.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder name is null or empty or folder couldn't be found.

    MarkAllMessagesAsReadByFolderId(String)

    Marks all messages in a given folder as read.

    • C#
    • VB.NET
    public void MarkAllMessagesAsReadByFolderId(string folderId)
    Public Sub MarkAllMessagesAsReadByFolderId(folderId As String)
    Parameters
    folderId
    System.String

    The folder's id.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder id is null or empty

    MarkMessageAsRead(String)

    Marks message with a given id as read.

    • C#
    • VB.NET
    public GraphMessageInfo MarkMessageAsRead(string messageId)
    Public Function MarkMessageAsRead(messageId As String) As GraphMessageInfo
    Parameters
    messageId
    System.String

    The message id.

    Returns
    GraphMessageInfo

    The message marked as read.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Message id is null or empty.

    MarkMessageAsUnread(String)

    Marks message with a given id as unread.

    • C#
    • VB.NET
    public GraphMessageInfo MarkMessageAsUnread(string messageId)
    Public Function MarkMessageAsUnread(messageId As String) As GraphMessageInfo
    Parameters
    messageId
    System.String

    The message id.

    Returns
    GraphMessageInfo

    The message marked as unread.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Message id is null or empty.

    MoveMessage(String, String)

    Moves the specified message to another folder.

    • C#
    • VB.NET
    public GraphMessageInfo MoveMessage(string messageId, string destinationFolder)
    Public Function MoveMessage(messageId As String, destinationFolder As String) As GraphMessageInfo
    Parameters
    messageId
    System.String

    The message id.

    destinationFolder
    System.String

    The destination folder name.

    Returns
    GraphMessageInfo

    The moved message.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Message id is null or empty, or destination folder is null or empty or the destination folder wasn't found.

    MoveMessageByFolderId(String, String)

    Moves the specified message to another folder.

    • C#
    • VB.NET
    public GraphMessageInfo MoveMessageByFolderId(string messageId, string destinationFolderId)
    Public Function MoveMessageByFolderId(messageId As String, destinationFolderId As String) As GraphMessageInfo
    Parameters
    messageId
    System.String

    The message id.

    destinationFolderId
    System.String

    The destination folder id.

    Returns
    GraphMessageInfo

    The moved message.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Message id is null or empty, or destination folder is null or empty or the destination folder wasn't found.

    RenameFolder(String, String)

    Renames the folder.

    • C#
    • VB.NET
    public GraphFolderInfo RenameFolder(string oldName, string newName)
    Public Function RenameFolder(oldName As String, newName As String) As GraphFolderInfo
    Parameters
    oldName
    System.String

    Current folder full name.

    newName
    System.String

    New folder name.

    Returns
    GraphFolderInfo

    The renamed folder.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Old folder name is null or empty or the folder wasn't found, or the new folder name is null or empty.

    RenameFolderById(String, String)

    Renames the folder.

    • C#
    • VB.NET
    public GraphFolderInfo RenameFolderById(string id, string newName)
    Public Function RenameFolderById(id As String, newName As String) As GraphFolderInfo
    Parameters
    id
    System.String

    The folder's id.

    newName
    System.String

    New folder name.

    Returns
    GraphFolderInfo

    The renamed folder.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder id is null or empty, or the new folder name is null or empty.

    SearchMessages(DefaultFolders, String)

    Searches for messages that match the specified OData query in the selected default folder.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphMessageInfo> SearchMessages(DefaultFolders folder, string query)
    Public Function SearchMessages(folder As DefaultFolders, query As String) As ReadOnlyCollection(Of GraphMessageInfo)
    Parameters
    folder
    DefaultFolders

    The default folder.

    query
    System.String

    The query string in $filter OData query parameter format.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphMessageInfo>

    A read-only collection of all messages in the selected folder that match the specified query.

    Exceptions
    System.InvalidOperationException

    No folder is selected or Client must be authenticated before usage or Client could not be connected or Server error.

    See Also
    $filter query parameter in Microsoft Graph.

    SearchMessages(String)

    Searches for messages that match the specified OData query in all folders.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphMessageInfo> SearchMessages(string query)
    Public Function SearchMessages(query As String) As ReadOnlyCollection(Of GraphMessageInfo)
    Parameters
    query
    System.String

    The query string in $filter OData query parameter format.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphMessageInfo>

    A read-only collection of all messages in the selected folder that match the specified query.

    Exceptions
    System.InvalidOperationException

    No folder is selected or Client must be authenticated before usage or Client could not be connected or Server error.

    See Also
    $filter query parameter in Microsoft Graph.

    SearchMessages(String, Int32, Int32, String)

    Searches for messages that match the specified OData query in the selected folder.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphMessageInfo> SearchMessages(string folderName, int offset, int count, string query)
    Public Function SearchMessages(folderName As String, offset As Integer, count As Integer, query As String) As ReadOnlyCollection(Of GraphMessageInfo)
    Parameters
    folderName
    System.String

    The full folder name.

    offset
    System.Int32

    Number of messages that should be skipped.

    count
    System.Int32

    Number of messages that should be returned.

    query
    System.String

    The query string in $filter OData query parameter format.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphMessageInfo>

    A read-only collection of all messages in the selected folder that match the specified query.

    Exceptions
    System.InvalidOperationException

    No folder is selected or Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder name is null or empty or folder was not found.

    See Also
    $filter query parameter in Microsoft Graph.

    SearchMessages(String, String)

    Searches for messages that match the specified OData query in the selected folder.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphMessageInfo> SearchMessages(string folderName, string query)
    Public Function SearchMessages(folderName As String, query As String) As ReadOnlyCollection(Of GraphMessageInfo)
    Parameters
    folderName
    System.String

    The full folder name.

    query
    System.String

    The query string in $filter OData query parameter format.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphMessageInfo>

    A read-only collection of all messages in the selected folder that match the specified query.

    Exceptions
    System.InvalidOperationException

    No folder is selected or Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder name is null or empty or folder was not found.

    See Also
    $filter query parameter in Microsoft Graph.

    SearchMessagesByFolderId(String, Int32, Int32, String)

    Searches for messages that match the specified OData query in the selected folder.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphMessageInfo> SearchMessagesByFolderId(string folderId, int offset, int count, string query)
    Public Function SearchMessagesByFolderId(folderId As String, offset As Integer, count As Integer, query As String) As ReadOnlyCollection(Of GraphMessageInfo)
    Parameters
    folderId
    System.String

    The folder id.

    offset
    System.Int32

    Number of messages that should be skipped.

    count
    System.Int32

    Number of messages that should be returned.

    query
    System.String

    The query string in $filter OData query parameter format.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphMessageInfo>

    A read-only collection of all messages in the selected folder that match the specified query.

    Exceptions
    System.InvalidOperationException

    No folder is selected or Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder id is null or empty or folder was not found.

    See Also
    $filter query parameter in Microsoft Graph.

    SearchMessagesByFolderId(String, String)

    Searches for messages that match the specified OData query in the selected folder.

    • C#
    • VB.NET
    public ReadOnlyCollection<GraphMessageInfo> SearchMessagesByFolderId(string folderId, string query)
    Public Function SearchMessagesByFolderId(folderId As String, query As String) As ReadOnlyCollection(Of GraphMessageInfo)
    Parameters
    folderId
    System.String

    The folder id.

    query
    System.String

    The query string in $filter OData query parameter format.

    Returns
    System.Collections.ObjectModel.ReadOnlyCollection<GraphMessageInfo>

    A read-only collection of all messages in the selected folder that match the specified query.

    Exceptions
    System.InvalidOperationException

    No folder is selected or Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Folder id is null or empty or folder was not found.

    See Also
    $filter query parameter in Microsoft Graph.

    SendMessage(MailMessage)

    Sends the message.

    • C#
    • VB.NET
    public void SendMessage(MailMessage message)
    Public Sub SendMessage(message As MailMessage)
    Parameters
    message
    MailMessage

    The message.

    Remarks

    The message will also be saved to the SentItems folder.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    FreeLimitReachedException

    Free license limitation exceeded.

    SendMessage(MailMessage, Boolean)

    Sends the message.

    • C#
    • VB.NET
    public void SendMessage(MailMessage message, bool saveOnSentItems)
    Public Sub SendMessage(message As MailMessage, saveOnSentItems As Boolean)
    Parameters
    message
    MailMessage

    The message.

    saveOnSentItems
    System.Boolean

    True if the message should be saved to the SentItems folder, otherwise false.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    FreeLimitReachedException

    Free license limitation exceeded.

    UploadMessage(MailMessage, String)

    Uploads the specified message to the given folder.

    • C#
    • VB.NET
    public GraphMessageInfo UploadMessage(MailMessage message, string destinationFolder)
    Public Function UploadMessage(message As MailMessage, destinationFolder As String) As GraphMessageInfo
    Parameters
    message
    MailMessage

    The message.

    destinationFolder
    System.String

    The destination folder full name.

    Returns
    GraphMessageInfo

    The uploaded message.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Message is null, or destination folder is null or empty or the destination folder wasn't found.

    UploadMessageByFolderId(MailMessage, String)

    Uploads the specified message to the given folder.

    • C#
    • VB.NET
    public GraphMessageInfo UploadMessageByFolderId(MailMessage message, string destinationFolderId)
    Public Function UploadMessageByFolderId(message As MailMessage, destinationFolderId As String) As GraphMessageInfo
    Parameters
    message
    MailMessage

    The message.

    destinationFolderId
    System.String

    The destination folder id.

    Returns
    GraphMessageInfo

    The uploaded message.

    Exceptions
    System.InvalidOperationException

    Client must be authenticated before usage or Client could not be connected or Server error.

    System.ArgumentException

    Message is null, or destination folder is null or empty or the destination folder wasn't found.

    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.