IGraphClient

All Implemented Interfaces: com.aspose.ms.System.IDisposable

public interface IGraphClient extends System.IDisposable

Represents the interface for Exchange REST client.

Methods

MethodDescription
copyFolder(String newParentId, String itemId)Copy a mailfolder and its contents to another mailfolder.
copyMessage(String newParentId, String itemId)Copy a Message to another mailfolder.
copyNotebook(String itemId, String groupId, String renameAs)Copies a notebook to the Notebooks folder in the destination Documents library.
createAttachment(String parentId, MapiAttachment attachment)Creates new attachment for specified item
createCategory(String displayName, int preset)Creates an OutlookCategory object in the user’s master list of categories.
createFolder(String folderName)Create new folder.
createFolder(String parentFolderId, String folderName)Create new folder.
createMessage(String folderId, MapiMessage message)Creates message in specified folder
createNotebook(Notebook notebook)Create a new OneNote notebook.
createOrUpdateOverride(ClassificationOverride classificationOverride)Create an override for a sender identified by an SMTP address.
createOrUpdateOverride(MailAddress sender, int classifyAs)Create an override for a sender identified by an SMTP address.
createRule(InboxRule rule)Create a message rule by specifying a set of conditions and actions.
delete(String id)Delete object.
deleteAttachment(String id)Removes attachment
fetchAttachment(String id)Gets attachment for specified id
fetchCategory(String itemId)Get the properties and relationships of the specified outlookCategory object.
fetchMessage(String id)Gets message in specified id
fetchNotebook(String itemId)Retrieve the properties and relationships of a notebook object.
fetchRule(String itemId)Get the properties and relationships of a message rule object.
getEndpoint()Gets or sets Endpoint URL.
getFolder(String id)Gets folder by an id.
getMultipleServicesTokenProvider()Gets or sets an object allows to retrieve OAuth access token.
getOneNoteOperationStatus(String operationId)Get the status of a long-running OneNote operation.
getResource()Gets or sets resource type.
getResourceId()Gets or sets resource id.
getTenantId()Gets or sets tenant identifier
getTimeout()Gets or sets the number of milliseconds to wait before the operation times out.
getTokenProvider()Gets or sets an object allows to retrieve OAuth access token.
listAttachments(String id)List Attachments from the parent message.
listCategories()Get all the categories that have been defined for the user.
listCategoriesInternal()
listFolders()List folders from the parent folder for folders that are displayed in normal mail clients, such as the inbox.
listFolders(String id)List folders from the parent folder for folders that are displayed in normal mail clients, such as the inbox.
listMessages(String id)List GraphMessageInfo from the parent folder.
listMessages(String id, PageInfo page, MailQuery query)List GraphMessageInfo from the parent folder.
listNotebooks()Retrieve a list of notebook objects.
listOverrides()Get the overrides that a user has set up to always classify messages from certain senders in specific ways.
listOverridesInternal()
listRules()Get all the messageRule objects defined for the user’s Inbox.
listRulesInternal()
moveFolder(String newParentId, String itemId)Move a mailfolder and its contents to another mailfolder.
moveMessage(String newParentId, String itemId)Move a message to another mailfolder.
send(MapiMessage message)Sends email message
send(MapiMessage message, boolean saveToSentItems)Sends email message
send(String itemId)Send a message in the draft folder.
sendAsMime(MapiMessage message)Sends email message using MIME format
setEndpoint(String value)Gets or sets Endpoint URL.
setMultipleServicesTokenProvider(IMultipleServicesTokenProvider value)Gets or sets an object allows to retrieve OAuth access token.
setRead(String itemId)Mark message as read.
setResource(int value)Gets or sets resource type.
setResourceId(String value)Gets or sets resource id.
setTenantId(String value)Gets or sets tenant identifier
setTimeout(int value)Gets or sets the number of milliseconds to wait before the operation times out.
setTokenProvider(ITokenProvider value)Gets or sets an object allows to retrieve OAuth access token.
updateCategory(OutlookCategory category)Updates pre-set color constant for specified category
updateFolder(GraphFolderInfo folderInfo)Updates folder.
updateMessage(MapiMessage message)Updates message
updateMessage(MapiMessage message, UpdateSettings updateSettings)Updates message
updateOverride(ClassificationOverride classificationOverride)Change the classifyAs field of an override as specified.
updateRule(InboxRule rule)Change writable properties on a messageRule object and save the changes.

copyFolder(String newParentId, String itemId)

public abstract GraphFolderInfo copyFolder(String newParentId, String itemId)

Copy a mailfolder and its contents to another mailfolder.

Parameters:

ParameterTypeDescription
newParentIdjava.lang.StringNew parent folder id
itemIdjava.lang.StringItem id to be copied

Returns: GraphFolderInfo - Copied folder

copyMessage(String newParentId, String itemId)

public abstract MapiMessage copyMessage(String newParentId, String itemId)

Copy a Message to another mailfolder.

Parameters:

ParameterTypeDescription
newParentIdjava.lang.StringNew parent folder id
itemIdjava.lang.StringItem id to be copied

Returns: MapiMessage - Copied message

copyNotebook(String itemId, String groupId, String renameAs)

public abstract String copyNotebook(String itemId, String groupId, String renameAs)

Copies a notebook to the Notebooks folder in the destination Documents library. The folder is created if it doesn’t exist. For Copy operations, you follow an asynchronous calling pattern: First call the Copy action, and then poll the operation endpoint for the result. Permissions One of the following permissions is required to call this API. Delegated(work or school account) Notes.Create, Notes.ReadWrite, Notes.ReadWrite.All Delegated(personal Microsoft account) Notes.Create, Notes.ReadWrite Application Notes.ReadWrite.All

Parameters:

ParameterTypeDescription
itemIdjava.lang.StringItem id to be copied
groupIdjava.lang.StringThe id of the group to copy to. Use only when copying to an Office 365 group.
renameAsjava.lang.StringThe name of the copy. Defaults to the name of the existing item.

Returns: java.lang.String - If successful, this method returns an Operation-Location string. You may use this value to get the status of the operation.

createAttachment(String parentId, MapiAttachment attachment)

public abstract MapiAttachment createAttachment(String parentId, MapiAttachment attachment)

Creates new attachment for specified item

Parameters:

ParameterTypeDescription
parentIdjava.lang.StringItem id
attachmentMapiAttachmentAttachment to create

Returns: MapiAttachment - Returns created attachment

createCategory(String displayName, int preset)

public abstract OutlookCategory createCategory(String displayName, int preset)

Creates an OutlookCategory object in the user’s master list of categories.

Parameters:

ParameterTypeDescription
displayNamejava.lang.StringA unique name that identifies a category in the user’s mailbox.
presetintpre-set color constant that characterizes a category, and that is mapped to one of 25 predefined colors

Returns: OutlookCategory - Category by which a user can group Outlook items such as messages and events

createFolder(String folderName)

public abstract GraphFolderInfo createFolder(String folderName)

Create new folder.

Parameters:

ParameterTypeDescription
folderNamejava.lang.StringFolder name

Returns: GraphFolderInfo - Returns created folder

createFolder(String parentFolderId, String folderName)

public abstract GraphFolderInfo createFolder(String parentFolderId, String folderName)

Create new folder.

Parameters:

ParameterTypeDescription
parentFolderIdjava.lang.StringParent folder id
folderNamejava.lang.StringFolder name

Returns: GraphFolderInfo - Returns folder for specified id

createMessage(String folderId, MapiMessage message)

public abstract MapiMessage createMessage(String folderId, MapiMessage message)

Creates message in specified folder

Parameters:

ParameterTypeDescription
folderIdjava.lang.StringParent folder id
messageMapiMessageMapi message to be created

Returns: MapiMessage - Created message

createNotebook(Notebook notebook)

public abstract Notebook createNotebook(Notebook notebook)

Create a new OneNote notebook. Permissions One of the following permissions is required to call this API. Delegated (work or school account) Notes.Create, Notes.ReadWrite, Notes.ReadWrite.All Delegated (personal Microsoft account) Notes.Create, Notes.ReadWrite Application Notes.ReadWrite.All

Parameters:

ParameterTypeDescription
notebookNotebookNotebook to be created

Returns: Notebook - Created notebook

createOrUpdateOverride(ClassificationOverride classificationOverride)

public abstract ClassificationOverride createOrUpdateOverride(ClassificationOverride classificationOverride)

Create an override for a sender identified by an SMTP address. Future messages from that SMTP address will be consistently classified as specified in the override. Note: - If an override already exists with the same SMTP address, then the classifyAs and name fields of that override are updated with the provided values. - The maximum number of overrides supported for a mailbox is 1000, based on unique sender SMTP addresses. Permissions: Delegated(work or school account) Mail.ReadWrite Delegated(personal Microsoft account) Mail.ReadWrite Application Mail.ReadWrite

Parameters:

ParameterTypeDescription
classificationOverrideClassificationOverride

Returns: ClassificationOverride -

createOrUpdateOverride(MailAddress sender, int classifyAs)

public abstract ClassificationOverride createOrUpdateOverride(MailAddress sender, int classifyAs)

Create an override for a sender identified by an SMTP address. Future messages from that SMTP address will be consistently classified as specified in the override. Note: - If an override already exists with the same SMTP address, then the classifyAs and name fields of that override are updated with the provided values. - The maximum number of overrides supported for a mailbox is 1000, based on unique sender SMTP addresses. Permissions: Delegated(work or school account) Mail.ReadWrite Delegated(personal Microsoft account) Mail.ReadWrite Application Mail.ReadWrite

Parameters:

ParameterTypeDescription
senderMailAddressEmail address information of the sender for whom the override is created.
classifyAsintValue which specifies how incoming messages from a specific sender should always be classified as.

Returns: ClassificationOverride -

createRule(InboxRule rule)

public abstract InboxRule createRule(InboxRule rule)

Create a message rule by specifying a set of conditions and actions. Outlook carries out those actions if an incoming message in the user’s Inbox meets the specified conditions. Permissions: One of the following permissions is required to call this API.To learn more, including how to choose permissions, see Permissions. Delegated (work or school account) MailboxSettings.ReadWrite Delegated (personal Microsoft account) MailboxSettings.ReadWrite Application MailboxSettings.ReadWrite

Parameters:

ParameterTypeDescription
ruleInboxRuleRule to be created in inbox

Returns: InboxRule - Created rule

delete(String id)

public abstract void delete(String id)

Delete object.

Parameters:

ParameterTypeDescription
idjava.lang.StringObject id to delete

deleteAttachment(String id)

public abstract void deleteAttachment(String id)

Removes attachment

Parameters:

ParameterTypeDescription
idjava.lang.StringAttachment id to delete

fetchAttachment(String id)

public abstract MapiAttachment fetchAttachment(String id)

Gets attachment for specified id

Parameters:

ParameterTypeDescription
idjava.lang.StringAttachment id

Returns: MapiAttachment - Returns attachment

fetchCategory(String itemId)

public abstract OutlookCategory fetchCategory(String itemId)

Get the properties and relationships of the specified outlookCategory object.

Parameters:

ParameterTypeDescription
itemIdjava.lang.StringItem id to be fetched

Returns: OutlookCategory - Category specified by id

fetchMessage(String id)

public abstract MapiMessage fetchMessage(String id)

Gets message in specified id

Parameters:

ParameterTypeDescription
idjava.lang.StringMessage id to fetch

Returns: MapiMessage - Mapi message

fetchNotebook(String itemId)

public abstract Notebook fetchNotebook(String itemId)

Retrieve the properties and relationships of a notebook object. Permissions One of the following permissions is required to call this API. Delegated (work or school account) Notes.Create, Notes.Read, Notes.ReadWrite, Notes.Read.All, Notes.ReadWrite.All Delegated (personal Microsoft account) Notes.Create, Notes.Read, Notes.ReadWrite Application Notes.Read.All, Notes.ReadWrite.All

Parameters:

ParameterTypeDescription
itemIdjava.lang.StringItem id

Returns: Notebook - Notebook object

fetchRule(String itemId)

public abstract InboxRule fetchRule(String itemId)

Get the properties and relationships of a message rule object. Permissions One of the following permissions is required to call this API.To learn more, including how to choose permissions, see Permissions. Delegated (work or school account) MailboxSettings.Read Delegated (personal Microsoft account) MailboxSettings.Read Application MailboxSettings.Read

Parameters:

ParameterTypeDescription
itemIdjava.lang.StringItem id

Returns: InboxRule - Inbox rule

getEndpoint()

public abstract String getEndpoint()

Gets or sets Endpoint URL.

Returns: java.lang.String

getFolder(String id)

public abstract GraphFolderInfo getFolder(String id)

Gets folder by an id.

Parameters:

ParameterTypeDescription
idjava.lang.StringFolder id

Returns: GraphFolderInfo - Returns folder for specified id

getMultipleServicesTokenProvider()

public abstract IMultipleServicesTokenProvider getMultipleServicesTokenProvider()

Gets or sets an object allows to retrieve OAuth access token.

Returns: IMultipleServicesTokenProvider

getOneNoteOperationStatus(String operationId)

public abstract OnenoteOperation getOneNoteOperationStatus(String operationId)

Get the status of a long-running OneNote operation. This applies to operations that return the Operation-Location header in the response, such as CopyNotebook, CopyToNotebook, CopyToSectionGroup, and CopyToSection. You can poll the Operation-Location endpoint until the status property returns completed or failed. If the status is completed, the resourceLocation property contains the resource endpoint URI. If the status is failed, the error and @api.diagnostics properties provide error information.

Parameters:

ParameterTypeDescription
operationIdjava.lang.StringOperation id

Returns: OnenoteOperation -

getResource()

public abstract int getResource()

Gets or sets resource type.

Returns: int

getResourceId()

public abstract String getResourceId()

Gets or sets resource id. For instance for users it may be user principal name (UPN) or user id

Returns: java.lang.String

getTenantId()

public abstract String getTenantId()

Gets or sets tenant identifier

Returns: java.lang.String

getTimeout()

public abstract int getTimeout()

Gets or sets the number of milliseconds to wait before the operation times out. The default value is 100,000 milliseconds (100 seconds).

Returns: int

getTokenProvider()

public abstract ITokenProvider getTokenProvider()

Gets or sets an object allows to retrieve OAuth access token.

Returns: ITokenProvider

listAttachments(String id)

public abstract MapiAttachmentCollection listAttachments(String id)

List Attachments from the parent message.

Parameters:

ParameterTypeDescription
idjava.lang.StringParent message id

Returns: MapiAttachmentCollection - Returns list of attachments of a message

listCategories()

public abstract List<OutlookCategory> listCategories()

Get all the categories that have been defined for the user.

Returns: java.util.List<com.aspose.email.OutlookCategory> - Returns list of categories for the user

listCategoriesInternal()

public abstract System.Collections.Generic.List<OutlookCategory> listCategoriesInternal()

Returns: com.aspose.ms.System.Collections.Generic.List<com.aspose.email.OutlookCategory>

listFolders()

public abstract GraphFolderInfoCollection listFolders()

List folders from the parent folder for folders that are displayed in normal mail clients, such as the inbox.

Returns: GraphFolderInfoCollection - Returns list of subfolders of the root folder

listFolders(String id)

public abstract GraphFolderInfoCollection listFolders(String id)

List folders from the parent folder for folders that are displayed in normal mail clients, such as the inbox.

Parameters:

ParameterTypeDescription
idjava.lang.StringParent folder id

Returns: GraphFolderInfoCollection - Returns list of subfolders of the root folder

listMessages(String id)

public abstract GraphMessageInfoCollection listMessages(String id)

List GraphMessageInfo from the parent folder. The GraphKnownFolders identifies well-known folders that can be used as folder id.

Parameters:

ParameterTypeDescription
idjava.lang.StringParent folder id

Returns: GraphMessageInfoCollection - Returns list of GraphMessageInfo of the folder

listMessages(String id, PageInfo page, MailQuery query)

public abstract GraphMessagePageInfo listMessages(String id, PageInfo page, MailQuery query)

List GraphMessageInfo from the parent folder. The GraphKnownFolders identifies well-known folders that can be used as folder id.

Parameters:

ParameterTypeDescription
idjava.lang.StringParent folder id
pagePageInfoA page info
queryMailQueryMailQuery that represents search query.

Returns: GraphMessagePageInfo - Returns list of GraphMessageInfo of the folder

listNotebooks()

public abstract NotebookCollection listNotebooks()

Retrieve a list of notebook objects. Permissions One of the following permissions is required to call this API. Delegated (work or school account) Notes.Create, Notes.Read, Notes.ReadWrite, Notes.Read.All, Notes.ReadWrite.All Delegated (personal Microsoft account) Notes.Create, Notes.Read, Notes.ReadWrite Application Notes.Read.All, Notes.ReadWrite.All

Returns: NotebookCollection - List of notebooks

listOverrides()

public abstract List<ClassificationOverride> listOverrides()

Get the overrides that a user has set up to always classify messages from certain senders in specific ways. Each override corresponds to an SMTP address of a sender.Initially, a user does not have any overrides. Permissions: One of the following permissions is required to call this API.To learn more, including how to choose permissions, see Permissions. Delegated (work or school account) Mail.Read Delegated (personal Microsoft account) Mail.Read Application Mail.Read

Returns: java.util.List<com.aspose.email.ClassificationOverride> -

listOverridesInternal()

public abstract System.Collections.Generic.List<ClassificationOverride> listOverridesInternal()

Returns: com.aspose.ms.System.Collections.Generic.List<com.aspose.email.ClassificationOverride>

listRules()

public abstract List<InboxRule> listRules()

Get all the messageRule objects defined for the user’s Inbox. Permissions One of the following permissions is required to call this API.To learn more, including how to choose permissions, see Permissions. Delegated (work or school account) MailboxSettings.Read Delegated (personal Microsoft account) MailboxSettings.Read Application MailboxSettings.Read

Returns: java.util.List<com.aspose.email.InboxRule> - List of inbox rules

listRulesInternal()

public abstract System.Collections.Generic.List<InboxRule> listRulesInternal()

Returns: com.aspose.ms.System.Collections.Generic.List<com.aspose.email.InboxRule>

moveFolder(String newParentId, String itemId)

public abstract GraphFolderInfo moveFolder(String newParentId, String itemId)

Move a mailfolder and its contents to another mailfolder.

Parameters:

ParameterTypeDescription
newParentIdjava.lang.StringNew parent folder id
itemIdjava.lang.StringItem id to be moved

Returns: GraphFolderInfo - Moved folder

moveMessage(String newParentId, String itemId)

public abstract MapiMessage moveMessage(String newParentId, String itemId)

Move a message to another mailfolder.

Parameters:

ParameterTypeDescription
newParentIdjava.lang.StringNew parent folder id
itemIdjava.lang.StringItem id to be moved

Returns: MapiMessage - Moved folder

send(MapiMessage message)

public abstract void send(MapiMessage message)

Sends email message

Parameters:

ParameterTypeDescription
messageMapiMessageMapi message to send

send(MapiMessage message, boolean saveToSentItems)

public abstract void send(MapiMessage message, boolean saveToSentItems)

Sends email message

Parameters:

ParameterTypeDescription
messageMapiMessageMapi message to send
saveToSentItemsbooleanIndicates whether to save the message in Sent Items.

send(String itemId)

public abstract void send(String itemId)

Send a message in the draft folder. The draft message can be a new message draft, reply draft, reply-all draft, or a forward draft. The message is then saved in the Sent Items folder.

Parameters:

ParameterTypeDescription
itemIdjava.lang.StringItem id of the draft message

sendAsMime(MapiMessage message)

public abstract void sendAsMime(MapiMessage message)

Sends email message using MIME format

Parameters:

ParameterTypeDescription
messageMapiMessageMapi message to send

setEndpoint(String value)

public abstract void setEndpoint(String value)

Gets or sets Endpoint URL.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setMultipleServicesTokenProvider(IMultipleServicesTokenProvider value)

public abstract void setMultipleServicesTokenProvider(IMultipleServicesTokenProvider value)

Gets or sets an object allows to retrieve OAuth access token.

Parameters:

ParameterTypeDescription
valueIMultipleServicesTokenProvider

setRead(String itemId)

public abstract void setRead(String itemId)

Mark message as read.

Parameters:

ParameterTypeDescription
itemIdjava.lang.StringItem id to mark read

setResource(int value)

public abstract void setResource(int value)

Gets or sets resource type.

Parameters:

ParameterTypeDescription
valueint

setResourceId(String value)

public abstract void setResourceId(String value)

Gets or sets resource id. For instance for users it may be user principal name (UPN) or user id

Parameters:

ParameterTypeDescription
valuejava.lang.String

setTenantId(String value)

public abstract void setTenantId(String value)

Gets or sets tenant identifier

Parameters:

ParameterTypeDescription
valuejava.lang.String

setTimeout(int value)

public abstract void setTimeout(int value)

Gets or sets the number of milliseconds to wait before the operation times out. The default value is 100,000 milliseconds (100 seconds).

Parameters:

ParameterTypeDescription
valueint

setTokenProvider(ITokenProvider value)

public abstract void setTokenProvider(ITokenProvider value)

Gets or sets an object allows to retrieve OAuth access token.

Parameters:

ParameterTypeDescription
valueITokenProvider

updateCategory(OutlookCategory category)

public abstract OutlookCategory updateCategory(OutlookCategory category)

Updates pre-set color constant for specified category

Parameters:

ParameterTypeDescription
categoryOutlookCategoryCategory to update

Returns: OutlookCategory - Category by which a user can group Outlook items such as messages and events

updateFolder(GraphFolderInfo folderInfo)

public abstract GraphFolderInfo updateFolder(GraphFolderInfo folderInfo)

Updates folder.

Parameters:

ParameterTypeDescription
folderInfoGraphFolderInfoFolder to update

Returns: GraphFolderInfo - Returns updated folder

updateMessage(MapiMessage message)

public abstract MapiMessage updateMessage(MapiMessage message)

Updates message

Parameters:

ParameterTypeDescription
messageMapiMessageMapi message to be updated

Returns: MapiMessage - Updated message

updateMessage(MapiMessage message, UpdateSettings updateSettings)

public abstract MapiMessage updateMessage(MapiMessage message, UpdateSettings updateSettings)

Updates message

Parameters:

ParameterTypeDescription
messageMapiMessageMapi message to be updated
updateSettingsUpdateSettingsUpdate settings

Returns: MapiMessage - Updated message

updateOverride(ClassificationOverride classificationOverride)

public abstract ClassificationOverride updateOverride(ClassificationOverride classificationOverride)

Change the classifyAs field of an override as specified. You cannot use this method to change any other fields in an ClassificationOverride instance. If an override exists for a sender and the sender changes his/her display name, you can use CreateOrUpdateOverride to force an update to the name field in the existing override. If an override exists for a sender and the sender changes his/her SMTP address, deleting the existing override and creating a new one with the new SMTP address is the only way to “update” the override for this sender. Permissions: One of the following permissions is required to call this API.To learn more, including how to choose permissions, see Permissions. Delegated (work or school account) Mail.ReadWrite Delegated (personal Microsoft account) Mail.ReadWrite Application Mail.ReadWrite

Parameters:

ParameterTypeDescription
classificationOverrideClassificationOverrideClassification override to update

Returns: ClassificationOverride -

updateRule(InboxRule rule)

public abstract InboxRule updateRule(InboxRule rule)

Change writable properties on a messageRule object and save the changes. Permissions One of the following permissions is required to call this API.To learn more, including how to choose permissions, see Permissions. Delegated (work or school account) MailboxSettings.ReadWrite Delegated (personal Microsoft account) MailboxSettings.ReadWrite Application MailboxSettings.ReadWrite

Parameters:

ParameterTypeDescription
ruleInboxRuleRule to update

Returns: InboxRule - Updated rule