GraphClient Class
Represents a mail client that can be used for interaction with Microsoft Graph API.
- Inheritance:
- System.ObjectGraphClient
Constructors
GraphClient()
Initializes a new instance of GraphClient.
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.Parameters
baseUrl
- System.String
Properties
LogOutput
Gets or sets the log output writer.
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.
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.
public void CopyMessage(string messageId, string destinationFolder)
Public Sub CopyMessage(messageId As String, destinationFolder As String)
Parameters
messageId
- System.String
The message id.
destinationFolder
- System.String
The destination folder name.
Exceptions
- System.InvalidOperationException
Client must be authenticated before usage or Client could not be connected or Server error.
- System.ArgumentException
Destination folder is null or empty.
CopyMessageByFolderId(String, String)
Copies the specified message to another folder.
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
Exceptions
- System.InvalidOperationException
Client must be authenticated before usage or Client could not be connected or Server error.
- System.ArgumentException
Destination folder is null or empty.
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.
public GraphFolderInfo CreateFolder(string name)
Public Function CreateFolder(name As String) As GraphFolderInfo
Parameters
name
- System.String
The full folder name.
Returns
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.
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
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
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
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.
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
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.
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
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
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
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.
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.
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 or folder was not found.
DeleteMessage(String)
Deletes the specified message.
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.
public GraphFolderInfo GetFolderInfo(string name)
Public Function GetFolderInfo(name As String) As GraphFolderInfo
Parameters
name
- System.String
The full folder name.
Returns
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.
public GraphFolderInfo GetFolderInfoById(string id)
Public Function GetFolderInfoById(id As String) As GraphFolderInfo
Parameters
id
- System.String
The folder's id.
Returns
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.
public HeaderCollection GetHeaders(string messageId)
Public Function GetHeaders(messageId As String) As HeaderCollection
Parameters
messageId
- System.String
The message id.
Returns
A collection of message headers.
Exceptions
- System.ArgumentException
Message id is null or empty.
GetMessage(String)
Finds a message with the given id.
public MailMessage GetMessage(string messageId)
Public Function GetMessage(messageId As String) As MailMessage
Parameters
messageId
- System.String
The message id.
Returns
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.
Free license limitation exceeded.
ImpersonateUser(String)
Defines a user to impersonate, allowing the client to perform operations on another user's mailbox.
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.
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.
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.
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.
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.
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.
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.
ListFolders(String, Boolean)
Lists subfolders of a specific folder on the server.
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.
ListFolders(String, Boolean, Boolean)
Lists subfolders of a specific folder on the server.
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.
ListFoldersById(String, Boolean, Boolean)
Lists subfolders of a specific folder on the server.
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.
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.
- System.ArgumentException
Folder is null or empty.
ListMessages(DefaultFolders)
Lists all messages in the selected default folder.
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.
- System.ArgumentException
Folder is null or empty.
ListMessages(DefaultFolders, Int32, Int32)
Lists all messages in the selected default folder in the specified range.
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.
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 is null or empty.
ListMessages(String, Int32, Int32)
Lists all messages in the selected folder in the specified range.
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.
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.
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.
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.
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 name is null or empty or folder couldn't be found.
MarkMessageAsRead(String)
Marks message with a given id as read.
public GraphMessageInfo MarkMessageAsRead(string messageId)
Public Function MarkMessageAsRead(messageId As String) As GraphMessageInfo
Parameters
messageId
- System.String
The message id.
Returns
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.
public GraphMessageInfo MarkMessageAsUnread(string messageId)
Public Function MarkMessageAsUnread(messageId As String) As GraphMessageInfo
Parameters
messageId
- System.String
The message id.
Returns
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.
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
Exceptions
- System.InvalidOperationException
Client must be authenticated before usage or Client could not be connected or Server error.
- System.ArgumentException
Destination folder is null or empty.
MoveMessageByFolderId(String, String)
Moves the specified message to another folder.
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
Exceptions
- System.InvalidOperationException
Client must be authenticated before usage or Client could not be connected or Server error.
- System.ArgumentException
Destination folder is null or empty.
RenameFolder(String, String)
Renames the folder.
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
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.
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
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 folder wasn't found, 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.
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.
- System.ArgumentException
Folder name is null or empty or folder was not found.
See Also
SearchMessages(String)
Searches for messages that match the specified OData query in all folders.
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
SearchMessages(String, Int32, Int32, String)
Searches for messages that match the specified OData query in the selected folder.
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
SearchMessages(String, String)
Searches for messages that match the specified OData query in the selected folder.
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
SearchMessagesByFolderId(String, Int32, Int32, String)
Searches for messages that match the specified OData query in the selected folder.
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
SearchMessagesByFolderId(String, String)
Searches for messages that match the specified OData query in the selected folder.
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
SendMessage(MailMessage)
Sends the message.
Parameters
message
- MailMessage
The message.
Exceptions
- System.InvalidOperationException
Client must be authenticated before usage or Client could not be connected or Server error.
Free license limitation exceeded.