Microsoft Graph Mail

Use the Microsoft Graph integration to let your applications get authorized access to a user's Outlook mail data in a personal or organization account.

Configure MicrosoftGraphMail on Demisto

  1. Navigate to Settings > Integrations > Servers & Services.
  2. Search for MicrosoftGraphMail.
  3. Click Add instance to create and configure a new integration instance.
ParameterDescriptionRequired
urlThe server URL.True
auth_idThe ID (received from the admin consent - see the Detailed Instructions (?) section).True
tenant_idThe token (received from the admin consent - see the Detailed Instructions (?) section).True
enc_keyThe Key (received from the admin consent - see the Detailed Instructions (?) section).True
isFetchThe fetched incidents.False
mailbox_to_fetchThe email address from which to fetch incidents (e.g. "example<span>>@demisto.com").False
folder_to_fetchThe name of the folder from which to fetch incidents (supports Folder ID and sub-folders e.g. Inbox/Phishing).False
first_fetchThe first fetched timestamp ((number) (time unit), e.g., 12 hours, 7 days).False
fetch_limitThe maximum number of emails to pull per fetch.False
insecureWhether to trust any certificate (not secure).False
proxyWhether to use system proxy settings.False
self_deployedWhether to use a self deployed Azure Application.False
incidentTypeThe incident type.False
  1. Click Test to validate the URLs, token, and connection.

Commands

You can execute these commands from the Demisto CLI, as part of an automation, or in a playbook. After you successfully execute a command, a DBot message appears in the War Room with the command details.

Get properties of returned emails


Gets the properties of returned emails.

Required Permissions

The following permissions are required for this command:

  • Mail.ReadWrite (Application)
  • User.Read
Base Command

msgraph-mail-list-emails

Input
Argument NameDescriptionRequired
user_idThe user ID from which to pull emails (can be principal ID (email address)).Required
folder_idThe comma-separated list of folder IDs, in the format: (mail_box,child_mail_box,child_mail_box).Optional
odataThe OData query.Optional
searchThe term for which to search. This argument cannot contain reserved characters such as "!, $, #, @, etc". Click here for further information.Optional
pages_to_pullThe number of pages of emails to return. The maximum is 10 emails per page.Optional
Context Output
PathTypeDescription
MSGraphMail.IDStringThe ID of the email.
MSGraphMail.CreatedDateThe time the email was created.
MSGraphMail.LastModifiedTimeDateThe time the email was last modified.
MSGraphMail.ReceivedTimeDateThe time the email was received.
MSGraphMail.SendTimeDateThe time the email was sent.
MSGraphMail.CategoriesStringCategories of the email.
MSGraphMail.HasAttachmentsBooleanWhether the email has attachments.
MSGraphMail.SubjectStringThe subject of the email.
MSGraphMail.IsDraftBooleanWhether the email is a draft.
MSGraphMail.BodyStringThe content (body) of the email.
MSGraphMail.Sender.NameStringThe name of the sender.
MSGraphMail.Sender.AddressStringThe email address of the sender.
MSGraphMail.From.NameStringThe name of the user in the 'from' field of the email.
MSGraphMail.From.AddressStringThe email address of the user in the 'from' field of the email
MSGraphMail.CCRecipients.NameStringThe names of the CC recipients.
MSGraphMail.CCRecipients.AddressStringThe email address of the user in the 'cc' field of the email.
MSGraphMail.BCCRecipients.NameStringThe names of the users in the 'bcc' field of the email.
MSGraphMail.BCCRecipients.AddressStringThe email address of the user in the 'bcc' field of the email.
MSGraphMail.ReplyTo.NameStringThe name in the 'replyTo' field of the email.
MSGraphMail.ReplyTo.AddressStringThe email address in the 'replyTo' field of the email.
MSGraphMail.UserIDStringThe ID of the user.
Command Example

!msgraph-mail-list-emails user_id=dev@demistodev.onmicrosoft.com search="Demo" folder_id=inbox

Context Example
{
"MSGraphMail": [
{
"BCCRecipients": null,
"CCRecipients": null,
"Categories": [],
"Created": "2020-03-29T09:56:37Z",
"Flag": {
"flagStatus": "notFlagged"
},
"From": {
"Address": "dev@demistodev.onmicrosoft.com",
"Name": "demisto dev"
},
"HasAttachments": true,
"Headers": null,
"ID": """",
"Importance": "low",
"IsDraft": false,
"LastModifiedTime": "2020-03-29T09:56:37Z",
"ReceivedTime": "2020-03-29T09:56:37Z",
"ReplyTo": null,
"SendTime": "2020-03-29T09:56:37Z",
"Sender": {
"Address": "dev@demistodev.onmicrosoft.com",
"Name": "demisto dev"
},
"Subject": "Demo test send mail",
"UserID": "dev@demistodev.onmicrosoft.com"
},
]
}
Human Readable Output
### Total of 7 of mails received
SubjectFromSendTime
Demo test send mailName: demisto dev, Address: dev<span>>@demistodev.onmicrosoft.com2020-03-29T09:56:37Z
RE: Demo testName: demisto dev, Address: dev<span>>@demistodev.onmicrosoft.com2020-03-29T09:56:18Z
Demo test send mailName: demisto dev, Address: dev<span>>@demistodev.onmicrosoft.com2020-03-29T09:52:59Z
RE: Demo testName: demisto dev, Address: dev<span>>@demistodev.onmicrosoft.com2020-03-29T09:52:41Z
RE: Demo testName: demisto dev, Address: dev<span>>@demistodev.onmicrosoft.com2020-03-29T09:51:06Z
Demo test send mailName: demisto dev, Address: dev<span>>@demistodev.onmicrosoft.com2020-03-29T09:06:54Z
Demo testName: demisto dev, Address: dev<span>>@demistodev.onmicrosoft.com2020-03-26T09:21:14Z

Get the properties of a single email


Returns the properties of an email.

Required Permissions

The following permissions are required for this command:

  • User.Read
Base Command

msgraph-mail-get-email

Input
Argument NameDescriptionRequired
user_idThe user ID or principal ID (usually an email address in the format someuser<span>>@example.com).Required
message_idThe message ID.Required
folder_idThe folder ID.Optional
odataThe OData.Optional
get_bodyWhether to return the message body. Can be "true" or "false".Optional
Context Output
PathTypeDescription
MSGraphMail.IDStringThe ID of the email.
MSGraphMail.CreatedDateThe time the email was created.
MSGraphMail.LastModifiedTimeDateThe time the email was last modified.
MSGraphMail.ReceivedTimeDateThe time the email was received.
MSGraphMail.SendTimeDateThe time the email was sent.
MSGraphMail.CategoriesStringThe categories of the email.
MSGraphMail.HasAttachmentsBooleanWhether the email has attachments.
MSGraphMail.SubjectStringThe subject of the email.
MSGraphMail.IsDraftBooleanWhether the email is a draft.
MSGraphMail.BodyStringThe content (body) of the email.
MSGraphMail.Sender.NameStringThe name of the sender.
MSGraphMail.Sender.AddressStringThe email address of the sender.
MSGraphMail.From.NameStringThe name of the user in the 'from' field of the email.
MSGraphMail.From.AddressStringThe email address of the user in the 'from' field of the email.
MSGraphMail.CCRecipients.NameStringThe names of the users in the 'cc' field of the email.
MSGraphMail.CCRecipients.AddressStringThe email address of the user in the 'cc' field of the email.
MSGraphMail.BCCRecipients.NameStringThe names of the users in the 'bcc' field of the email.
MSGraphMail.BCCRecipients.AddressStringThe email address of the user in the 'bcc' field of the email.
MSGraphMail.ReplyTo.NameStringThe name in the 'replyTo' field of the email.
MSGraphMail.ReplyTo.AddressStringThe email address in the 'replyTo' field of the email.
MSGraphMail.UserIDStringThe ID of the user.
Command Example

!msgraph-mail-get-email message_id="message_id" user_id=dev@demistodev.onmicrosoft.com

Context Example
{
"MSGraphMail": {
"BCCRecipients": null,
"CCRecipients": null,
"Categories": [],
"Created": "2020-03-26T09:21:15Z",
"Flag": {
"flagStatus": "notFlagged"
},
"From": {
"Address": "dev@demistodev.onmicrosoft.com",
"Name": "demisto dev"
},
"HasAttachments": false,
"Headers": null,
"ID": """",
"Importance": "low",
"IsDraft": false,
"LastModifiedTime": "2020-03-29T09:56:18Z",
"ReceivedTime": "2020-03-26T09:21:15Z",
"ReplyTo": null,
"SendTime": "2020-03-26T09:21:14Z",
"Sender": {
"Address": "dev@demistodev.onmicrosoft.com",
"Name": "demisto dev"
},
"Subject": "Demo test",
"UserID": "dev@demistodev.onmicrosoft.com"
}
}
Human Readable Output
Results for message ID ""
IDSubjectSendTimeSenderFromHasAttachmentsBody
""Demo test2020-03-26T09:21:14ZName: demisto dev, Address: dev<span>>@demistodev.onmicrosoft.comName: demisto dev, Address: dev<span>>@demistodev.onmicrosoft.comfalse
Required Permissions

The following permissions are required for this command:

  • Mail.ReadWrite (Application)

Delete an email


Deletes an email.

Base Command

msgraph-mail-delete-email

Input
Argument NameDescriptionRequired
user_idThe user ID or principal ID (usually an email address in the format someuser<span>>@example.com).Required
message_idThe message ID.Required
folder_idThe comma-separated list of folder IDs. For example, "mailFolders,childFolders,childFolders".Optional
Context Output

There is no context output for this command.

Command Example

!msgraph-mail-delete-email user_id=dev@demistodev.onmicrosoft.com message_id="message_id"

Context Example
{}
Human Readable Output
Message has been deleted successfully
Message IDUser ID
""dev<span>>@demistodev.onmicrosoft.com

List attachments of an email


Lists all of the attachments of a given email.

Required Permissions

The following permissions are required for this command:

  • User.Read
Base Command

msgraph-mail-list-attachments

Input
Argument NameDescriptionRequired
user_idThe user ID or principal ID (usually an email address in the format someuser<span>>@example.com).Required
message_idThe message ID.Required
folder_idThe comma-separated list of folder IDs, in the format: (mail_box,child_mail_box,child_mail_box).Optional
Context Output
PathTypeDescription
MSGraphMailAttachment.IDStringThe email ID.
MSGraphMailAttachment.Attachment.IDStringThe ID of the attachment.
MSGraphMailAttachment.Attachment.NameStringThe name of the attachment.
MSGraphMailAttachment.Attachment.TypeStringThe attachment type.
MSGraphMailAttachment.UserIDStringThe ID of the user.
Command Example

!msgraph-mail-list-attachments message_id="message_id" user_id=dev@demistodev.onmicrosoft.com

Context Example
{
"MSGraphMailAttachment": {
"Attachment": [
{
"ID": """",
"Name": "test_attachment",
"Type": "application/octet-stream"
}
],
"ID": """",
"UserID": "dev@demistodev.onmicrosoft.com"
}
}
Human Readable Output
Total of 1 attachments found in message "" from user dev<span>>@demistodev.onmicrosoft.com
File names
test_attachment

Get an attachment from an email


Gets an attachment from the email.

Required Permissions

The following permissions are required for this command:

  • User.Read
Base Command

msgraph-mail-get-attachment

Input
Argument NameDescriptionRequired
user_idThe user ID or principal ID (usually an email address in the format someuser<span>>@example.com).Required
message_idThe message ID.Required
folder_idThe comma-separated list of folder IDs, in the format: (mail_box,child_mail_box,child_mail_box).Optional
attachment_idThe ID of the attachment.Required
Context Output
PathTypeDescription
File.SizeNumberThe size of the file.
File.SHA1StringThe SHA1 hash of the file.
File.SHA256StringThe SHA256 hash of the file.
File.NameStringThe name of the file.
File.SSDeepStringThe SSDeep hash of the file.
File.EntryIDStringThe entry ID of the file.
File.InfoStringFile information.
File.TypeStringThe file type.
File.MD5StringThe MD5 hash of the file.
File.ExtensionStringThe file extension.
Command Example

!msgraph-mail-get-attachment attachment_id="" message_id="message_id" user_id=dev@demistodev.onmicrosoft.com

Context Example
{
"File": {
"EntryID": "8017@f6e9c46f-e2e9-446f-8cd9-909bd5f72dbf",
"Info": "image/jpeg",
"MD5": "009a889d2f93dceeb9bf0df0870e8f58",
"Name": "test_attachment",
"SHA1": "3cb49da95c7c1acb80496329636cc14b07fc82fb",
"SHA256": "9e930d4a9fc01e91729f3d6acfa2d793cbf6db5a4b48ae2cf9d8c0aac57cc998",
"SHA512": """",
"SSDeep": """",
"Size": 978210,
"Type": "JPEG image data, Exif standard: [TIFF image data, big-endian, direntries=12, height=1599, bps=0, PhotometricIntepretation=RGB, orientation=upper-left, width=1200], progressive, precision 8, 1200x1599, frames 3"
}
}
Human Readable Output

There is no Human Readable Output.

Get the mail folder list under the root folder


Returns the mail folder list directly under the root folder.

Required Permissions

The following permissions are required for this command:

  • Mail.ReadWrite (Application)
  • User.Read
Base Command

msgraph-mail-list-folders

Input
Argument NameDescriptionRequired
user_idThe user ID or principal ID (usually an email address in the format someuser<span>>@example.com).Required
limitThe maximum number of mail folder lists to return. The default is 20.Optional
Context Output
PathTypeDescription
MSGraphMail.Folders.ChildFolderCountNumberThe number of child folders.
MSGraphMail.Folders.DisplayNameStringThe folder display name.
MSGraphMail.Folders.IDStringThe target folder ID.
MSGraphMail.Folders.ParentFolderIDStringThe parent folder ID.
MSGraphMail.Folders.TotalItemCountNumberThe total number of email messages in the folder.
MSGraphMail.Folders.UnreadItemCountNumberThe number of unread emails in the folder.
Command Example

!msgraph-mail-list-folders user_id=dev@demistodev.onmicrosoft.com limit=2

Context Example
{
"MSGraphMail": {
"Folders": [
{
"ChildFolderCount": 0,
"DisplayName": "Archive",
"ID": """",
"ParentFolderID": """",
"TotalItemCount": 0,
"UnreadItemCount": 0
},
{
"ChildFolderCount": 1,
"DisplayName": "Conversation History",
"ID": """",
"ParentFolderID": """",
"TotalItemCount": 0,
"UnreadItemCount": 0
}
]
}
}
Human Readable Output
Mail Folder collection under root folder for user dev<span>>@demistodev.onmicrosoft.com
ChildFolderCountDisplayNameIDParentFolderIDTotalItemCountUnreadItemCount
0Archive""""00
1Conversation History""""00

Get the folder list for a folder


Returns the folder list under the specified folder.

Required Permissions

The following permissions are required for this command:

  • Mail.ReadWrite (Application)
  • User.Read
Base Command

msgraph-mail-list-child-folders

Input
Argument NameDescriptionRequired
user_idThe user ID or principal ID (usually an email address in the format someuser<Span>@example.com).Required
parent_folder_idThe ID of the parent folder.Required
limitThe maximum number of mail folder lists to return. The default is 20.Optional
Context Output
PathTypeDescription
MSGraphMail.Folders.ChildFolderCountNumberThe number of child folders.
MSGraphMail.Folders.DisplayNameStringThe folder display name.
MSGraphMail.Folders.IDStringThe folder ID.
MSGraphMail.Folders.ParentFolderIDStringThe parent folder ID.
MSGraphMail.Folders.TotalItemCountNumberThe total number of email messages in the folder.
MSGraphMail.Folders.UnreadItemCountNumberThe number of unread email messages in the folder.
Command Example

!msgraph-mail-list-child-folders user_id=dev@demistodev.onmicrosoft.com parent_folder_id=inbox

Context Example
{
"MSGraphMail": {
"Folders": [
{
"ChildFolderCount": 0,
"DisplayName": "child_folder",
"ID": ",
"ParentFolderID": """",
"TotalItemCount": 0,
"UnreadItemCount": 0
},
{
"ChildFolderCount": 0,
"DisplayName": "new_test",
"ID": """",
"ParentFolderID": """",
"TotalItemCount": 0,
"UnreadItemCount": 0
}
]
}
}
Human Readable Output
Mail Folder collection under inbox folder for user dev<span>>@demistodev.onmicrosoft.com
ChildFolderCountDisplayNameIDParentFolderIDTotalItemCountUnreadItemCount
0child_folder""""00
0new_test""""00

Create a new child folder


Creates a new folder under the specified folder (parent).

Required Permissions

The following permissions are required for this command:

  • Mail.ReadWrite (Application)
Base Command

msgraph-mail-create-folder

Input
Argument NameDescriptionRequired
user_idThe user ID or principal ID (usually an email address in the format someuser<span>>@example.com).Required
new_folder_nameThe display name of the new folder.Required
parent_folder_idThe ID of the parent folder under which to create a new folder.Optional
Context Output
PathTypeDescription
MSGraphMail.Folders.ChildFolderCountNumberThe number of child folders.
MSGraphMail.Folders.DisplayNameStringThe folder display name.
MSGraphMail.Folders.IDStringThe folder ID.
MSGraphMail.Folders.ParentFolderIDStringThe parent folder ID.
MSGraphMail.Folders.TotalItemCountNumberThe total number of email messages in the folder.
MSGraphMail.Folders.UnreadItemCountNumberThe number of unread email messages in the folder.
Command Example

!msgraph-mail-create-folder user_id=dev@demistodev.onmicrosoft.com new_folder_name="Testing"

Context Example
{
"MSGraphMail": {
"Folders": {
"ChildFolderCount": 0,
"DisplayName": "Testing",
"ID": """",
"ParentFolderID": """",
"TotalItemCount": 0,
"UnreadItemCount": 0
}
}
}
Human Readable Output
Mail folder was created with display name: Testing
ChildFolderCountDisplayNameIDParentFolderIDTotalItemCountUnreadItemCount
0Testing""""00

Update a folder's properties


Updates the properties of the specified folder.

Required Permissions

The following permissions are required for this command:

  • Mail.ReadWrite (Application)
Base Command

msgraph-mail-update-folder

Input
Argument NameDescriptionRequired
user_idThe user ID or principal ID (usually an email address in the format someuser<span>>@example.com).Required
folder_idThe ID of the folder to update.Required
new_display_nameThe mail folder display name.Required
Context Output
PathTypeDescription
MSGraphMail.Folders.ChildFolderCountStringThe number of child folders.
MSGraphMail.Folders.DisplayNameStringThe folder display name.
MSGraphMail.Folders.IDStringThe folder ID.
MSGraphMail.Folders.ParentFolderIDStringThe parent folder ID.
MSGraphMail.Folders.TotalItemCountNumberThe total number of email messages in the folder.
MSGraphMail.Folders.UnreadItemCountNumberThe unread emails count inside the folder.
Command Example

!msgraph-mail-update-folder user_id=dev@demistodev.onmicrosoft.com folder_id="folder_id" new_display_name="new_test"

Context Example
{
"MSGraphMail": {
"Folders": {
"ChildFolderCount": 0,
"DisplayName": "new_test",
"ID": """",
"ParentFolderID": """",
"TotalItemCount": 0,
"UnreadItemCount": 0
}
}
}
Human Readable Output
Mail folder "" was updated with display name: new_test
ChildFolderCountDisplayNameIDParentFolderIDTotalItemCountUnreadItemCount
0new_test""""00

Delete a folder


Deletes the specified mail folder.

Required Permissions

The following permissions are required for this command:

  • Mail.ReadWrite (Application)
Base Command

msgraph-mail-delete-folder

Input
Argument NameDescriptionRequired
user_idThe user ID or principal ID (usually an email address in the format someuser<Span>@example.com).Required
folder_idThe ID of the folder to delete.Required
Context Output

There is no context output for this command.

Command Example

!msgraph-mail-delete-folder user_id=dev@demistodev.onmicrosoft.com folder_id="folder_id"

Context Example
{}
Human Readable Output

The folder "" was deleted successfully

Move a message to a different folder


Moves a message to a different folder.

Required Permissions

The following permissions are required for this command:

  • Mail.ReadWrite (Application)
Base Command

msgraph-mail-move-email

Input
Argument NameDescriptionRequired
message_idThe message ID.Required
destination_folder_idThe ID of the destination folder.Required
user_idThe user ID or principal ID (usually an email address in the format someuser<span>>@example.com).Required
Context Output
PathTypeDescription
MSGraphMail.MovedEmails.DestinationFolderIDStringThe folder where the email message was moved to.
MSGraphMail.MovedEmails.IDStringThe new ID of the moved email message.
MSGraphMail.MovedEmails.UserIDStringThe user ID.
Context Example
{
"MSGraphMail": {
"MovedEmails": {
"DestinationFolderID": "inbox",
"ID": """",
"UserID": "dev@demistodev.onmicrosoft.com"
}
}
}
Human Readable Output
The email was moved successfully. Updated email data:
DestinationFolderIDIDUserID
inbox""dev<span>>@demistodev.onmicrosoft.com

Get an email message by ID and upload the content


Retrieves an email message by message ID and uploads the content as an EML file.

Required Permissions

The following permissions are required for this command:

  • User.Read
Base Command

msgraph-mail-get-email-as-eml

Input
Argument NameDescriptionRequired
user_idThe user ID or principal ID (usually an email address in the format someuser<span>>@example.com).Required
message_idThe message ID.Required
Context Output
PathTypeDescription
File.SizeStringThe size of the file.
File.SHA1StringThe SHA1 hash of the file.
File.SHA256StringThe SHA256 hash of the file.
File.SHA512StringThe SHA512 hash of the file.
File.NameStringThe name of the file.
File.SSDeepStringThe SSDeep hash of the file.
File.EntryIDStringThe EntryID of the file.
File.InfoStringInformation about the file.
File.TypeStringThe file type.
File.MD5StringThe MD5 hash of the file.
File.ExtensionStringThe extension of the file.
Command Example

!msgraph-mail-get-email-as-eml message_id="message_id" user_id=dev@demistodev.onmicrosoft.com

Context Example
{
"File": {
"EntryID": "8025@f6e9c46f-e2e9-446f-8cd9-909bd5f72dbf",
"Extension": "eml",
"Info": "message/rfc822",
"MD5": "5f32dc60c6f4dc7b01b4aa85a12459d9",
"Name": """",
"SHA1": "0320147ba32722549e810d2ecd5300b95a101bf6",
"SHA256": "6476ede07246902ad34118df90ca8b590a006ffbd3dd142046a4cf81d2dde30d",
"SHA512": "efa9cd6f787a24a31a9479366d2b6ac73a42e3bd7594933615a2cf659790dcbe9c3120740eb96fa8405e888a077d55745c3797999582d50f237ca2d4964a8547",
"SSDeep": """",
"Size": 2119,
"Type": "RFC 822 mail text, ASCII text, with very long lines, with CRLF line terminators"
}
}
Human Readable Output

There is No Human Readable Output.

Create a draft message in a user's mailbox


Creates a draft message in the specified user's mailbox.

Required Permissions

The following permissions are required for this command:

  • Mail.ReadWrite (Application)
Base Command

msgraph-mail-create-draft

Input
Argument NameDescriptionRequired
toThe comma-separated list of email addresses for the 'to' field.Optional
ccThe comma-separated list of email addresses for the 'cc' field.Optional
bccThe comma-separated list of email addresses for the 'bcc' field.Optional
subjectThe subject for the draft.Required
bodyThe contents (body) of the draft.Optional
bodyTypeThe body type of the email. Can be, "text", or "HTML".Optional
flagThe flag value that indicates the status of the draft. Can be, "notFlagged", "complete", or "flagged".Optional
importanceThe importance of the draft. Can be, "Low", "Normal", or "High".Optional
headersThe comma-separated list of additional headers in the format, "headerName:headerValue". For example, "headerName1:headerValue1,headerName2:headerValue2".Optional
attachIDsThe comma-separated list of War Room entry IDs that contain files, which are used to attach files to the draft. For example, "attachIDs=15@8,19@8".Optional
attachNamesThe comma-separated list of names of attachments to be displayed in the draft. Must be the same number of elements as attachIDs.Optional
attachCIDsThe comma-separated list of CIDs to embed attachments within the actual email.Optional
fromThe email address from which the draft is created.Required
Context Output
PathTypeDescription
MicrosoftGraph.Draft.CcStringThe CC recipients of the draft email.
MicrosoftGraph.Draft.IsReadStringThe "Is read" status of the draft email.
MicrosoftGraph.Draft.BccStringThe BCC recipients of the draft email.
MicrosoftGraph.Draft.BodyStringThe body of the draft email.
MicrosoftGraph.Draft.MessageIDStringThe message ID of the draft email.
MicrosoftGraph.Draft.SentTimeDateThe created time of the draft email.
MicrosoftGraph.Draft.HeadersStringThe headers of the draft email.
MicrosoftGraph.Draft.FromStringThe user that sent the draft email.
MicrosoftGraph.Draft.SubjectStringThe subject of the draft email.
MicrosoftGraph.Draft.ReceivedTimeStringThe received time of the draft email.
MicrosoftGraph.Draft.ImportanceStringThe importance status of the draft email.
MicrosoftGraph.Draft.CreatedTimeStringThe created time of the draft email.
MicrosoftGraph.Draft.SenderStringThe sender of the draft email.
MicrosoftGraph.Draft.ModifiedTimeDateThe modified time of the draft email.
MicrosoftGraph.Draft.IsDraftBooleanWhether it is a draft email.
MicrosoftGraph.Draft.IDStringThe ID of the draft email.
MicrosoftGraph.Draft.ToStringThe 'to' recipients of the draft email.
MicrosoftGraph.Draft.BodyTypeUnknownThe body type of the draft email.
MicrosoftGraph.Draft.ConversationIDStringThe conversation ID of the draft email.
Command Example

!msgraph-mail-create-draft from=dev@demistodev.onmicrosoft.com subject="This is a draft" body="This is a body" to=dev@demistodev.onmicrosoft.com

Context Example
{
"MicrosoftGraph": {
"Draft": {
"Bcc": [],
"Body": "This is a body",
"BodyType": "text",
"Cc": [],
"ConversationID": """",
"CreatedTime": "2020-03-29T09:57:38Z",
"From": "",
"Headers": [],
"ID": """",
"Importance": "low",
"IsDraft": true,
"IsRead": true,
"MessageID": "<AM6PR07MB44530DA96C2DF255705F30FD83CA0@AM6PR07MB4453.eurprd07.prod.outlook.com>",
"ModifiedTime": "2020-03-29T09:57:38Z",
"ReceivedTime": "2020-03-29T09:57:38Z",
"Sender": "",
"SentTime": "2020-03-29T09:57:38Z",
"Subject": "This is a draft",
"To": [
"dev@demistodev.onmicrosoft.com"
]
}
}
}
Human Readable Output
Created draft with id: ""
IDFromSenderToSubjectBodyBodyTypeCcBccHeadersImportanceMessageIDConversationIDCreatedTimeSentTimeReceivedTimeModifiedTimeIsDraftIsRead
""dev<span>>@demistodev.onmicrosoft.comThis is a draftThis is a bodytextlowAM6PR07MB44530DA96C2DF255705F30FD83CA0@AM6PR07MB4453.eurprd07.prod.outlook.<span\>com>""2020-03-29T09:57:38Z2020-03-29T09:57:38Z2020-03-29T09:57:38Z2020-03-29T09:57:38Ztruetrue

Send an email


Sends an email using Microsoft Graph.

Required Permissions

The following permissions are required for this command:

  • Mail.Send (Application)
Base Command

send-mail

Input
Argument NameDescriptionRequired
toThe comma-separated list of email addresses for the 'to' field.Optional
ccThe comma-separated list of email addresses for the 'cc' field.Optional
bccThe comma-separated list of email addresses for the 'bcc' field.Optional
subjectThe subject of the email.Required
bodyThe contents (body) of the email.Optional
bodyTypeThe body type of the email. Can be, "text" or "HTML".Optional
flagThe flag value that indicates the status for the email. Can be, "notFlagged", "complete", or "flagged".Optional
importanceThe importance of the email. Can be, "Low", "Normal", or "High".Optional
headersThe comma-separated list of additional headers in the format: "headerName:headerValue". For example, "headerName1:headerValue1,headerName2:headerValue2".Optional
attachIDsThe comma-separated list of War Room entry IDs that contain files, which are used to attach files for the email to send. For example, attachIDs=15@8,19@8.Optional
attachNamesThe comma-separated list of names of attachments to display in the email to send. It must have the same number of elements as attachIDs.Optional
attachCIDsThe comma-separated list of CIDs to embed attachments within the actual email.Optional
fromThe email address from which to send the email.Optional
Context Output
PathTypeDescription
MicrosoftGraph.Email.internetMessageHeadersStringThe email headers.
MicrosoftGraph.Email.bodyStringThe body of the email.
MicrosoftGraph.Email.bodyPreviewStringThe body preview of the email.
MicrosoftGraph.Email.subjectStringThe subject of the email.
MicrosoftGraph.Email.flagStringThe flag status of the email.
MicrosoftGraph.Email.importanceStringThe importance status of the email.
MicrosoftGraph.Email.toRecipientsStringThe 'to' recipients of the email.
MicrosoftGraph.Email.ccRecipientsStringThe CC recipients of the email.
MicrosoftGraph.Email.bccRecipientsStringThe BCC recipients of the email.
Command Example

!send-mail subject="Demo test send mail" from=dev@demistodev.onmicrosoft.com attachIDs="attach_id" to=dev@demistodev.onmicrosoft.com attachNames="test_attachment"

Context Example
{
"MicrosoftGraph": {
"Email": {
"body": {
"content": "",
"contentType": "text"
},
"flag": {
"flagStatus": "notFlagged"
},
"importance": "Low",
"subject": "Demo test send mail",
"toRecipients": [
"dev@demistodev.onmicrosoft.com"
]
}
}
}
Human Readable Output
Email was sent successfully.
bodyflagimportancesubjecttoRecipients
content: contentType: textflagStatus: notFlaggedLowDemo test send maildev<span>>@demistodev.onmicrosoft.com

Reply to a message


Replies to the recipients of a message.

Required Permissions

The following permissions are required for this command:

  • Mail.Send (Application)
Base Command

msgraph-mail-reply-to

Input
Argument NameDescriptionRequired
IDThe ID of the message.Required
bodyThe comment of the replied message.Required
toThe comma-separated list of email addresses for the 'to' field.Required
fromThe email address from which to reply.Required
Context Output

There is no context output for this command.

Command Example

!msgraph-mail-reply-to ID="mail_id" body="reply_body" from=dev@demistodev.onmicrosoft.com to=dev@demistodev.onmicrosoft.com

Context Example
{}
Human Readable Output
Replied to: dev<span>>@demistodev.onmicrosoft.com with comment: reply_body

Send a draft email


Sends a draft email using Microsoft Graph.

Required Permissions

The following permissions are required for this command:

  • Mail.Send (Application)
Base Command

msgraph-mail-send-draft

Input
Argument NameDescriptionRequired
draft_idThe ID of the draft email.Required
fromThe email address from which to send the draft.Required
Context Output

There is no context output for this command.

Command Example

!msgraph-mail-send-draft draft_id="draft_id" from=dev@demistodev.onmicrosoft.com

Context Example
{}
Human Readable Output
Draft with: "" id was sent successfully.