Skip to main content
Skip table of contents

Operation: CreateDraftMail

The CreateDraftMail operation creates an email draft.

Input

The adapter expects the following XML structure as input:

Example

XML
<?xml version="1.0" encoding="UTF-8"?>
<CreateDraft>
	<Subject></Subject>
	<Message type="text|html"></Message>
	<ToRecipients>
		<Recipient></Recipient>
		<Recipient></Recipient>
	</ToRecipients>
	<!-- ###Optional### -->
	<CcRecipients>
		<Recipient></Recipient>
		<Recipient></Recipient>
	</CcRecipients>	
	<!-- ###Optional### -->
	<BccRecipients>
		<Recipient></Recipient>
		<Recipient></Recipient>
	</BccRecipients>
	<!-- ###Optional -->
	<Importance>high|normal|low</Importance>
	<!-- ###Optional### -->
	<Attachments>
		<Attachment>
			<FileName></FileName>
			<FileData></FileData>
		</Attachment>
	</Attachments>	
</CreateDraft>

The following elements can be included in the input:

Element

Description

CreateDraft

Enclosing element for the CreateDraftMail operation

Subject

Subject of the email

Possible values:

Any string

Message

The type of the message is defined via the type attribute.

Possible values:

  • text

  • html

Note:

The input for html should be in xhtml format. Before the email is sent, html is converted to xhtml.

Examples:

  • text:

XML
<Message type="text">Hello, this is a test!</Message>
  • html:

XML
<Message type="html">
	<html>
		<body>
			<h1>Welcome to our Newsletter</h1>
			<p>Hello,</p>
			<p>Thank you for your interest in our
				newsletter.
			</p>
			<ul>
				<li>First item</li>
				<li>Second item</li>
				<li>Third item</li>
			</ul>
			<p>We hope you find the information helpful.</p>
			<p>
				Best regards,
				<br />
				Your Newsletter Team
			</p>
		</body>
	</html>

ToRecipients

Recipient of the email.

Contains one or more Recipient elements.

Recipient

Email address of the recipient

Possible value:

Email address

Example:

test.user@softproject.de

CcRecipients

(optional)

Recipient of the email in copy (Cc). The CcRecipients element must contain at least one Recipient element.

BccRecipients

(optional)

Recipient of the email in blind copy (Bcc). The BccRecipients element must contain at least one Recipient element.

Importance

(optional)

Importance level of the email

Possible values:

  • high: High level of importance

  • normal: Normal level of importance

  • low: Lowest level of importance

Attachments

(optional)

The Attachments element can contain one or more attachments.

Attachment

(optional)

The Attachment element contains the FileName and FileData elements.

FileName

(optional)

File name of the attachment

FileData

(optional)

Content of the attachment in base64 format


Output

The email draft is saved in the Drafts folder.

The adapter generates the following XML document as output:

Example

XML
<?xml version="1.0" encoding="UTF-8"?>
<CreateDraft>
   <Object>
      <Value name="@odata.context" type="String">https://graph.microsoft.com/v1.0/$metadata#users('test.user%40softproject.de')/messages/$entity</Value>
      <Value name="@odata.etag" type="String">W/"CQAAABYAAACRrcaFxKxcR7F2mRmZk4TVAAC6T6wA"</Value>
      <Value name="id" type="String">AAMkAGI0NDU3YTMxLTVkOTktNGQ2Zi04OGViLTgzNWM1YWFlNjAwNwBGAAAAAABqZX6HQaolT792ILCaL-z8BwCRrcaFxKxcR7F2mRmZk4TVAAAAAAEPAACRrcaFxKxcR7F2mRmZk4TVAAC6rA52AAA=</Value>
      <Value name="createdDateTime" type="String">2023-06-29T14:22:32Z</Value>
      <Value name="lastModifiedDateTime" type="String">2023-06-29T14:22:32Z</Value>
      <Value name="changeKey" type="String">CQAAABYAAACRrcaFxKxcR7F2mRmZk4TVAAC6T6wA</Value>
      <Array name="categories"/>
      <Value name="receivedDateTime" type="String">2023-06-29T14:22:32Z</Value>
      <Value name="sentDateTime" type="String">2023-06-29T14:22:32Z</Value>
      <Value name="hasAttachments" type="Boolean">false</Value>
      <Value name="internetMessageId" type="String"><GV1P193MB231298AC39075A87CA87D95CEF25A@GV1P193MB2312.EURP193.PROD.OUTLOOK.COM></Value>
      <Value name="subject" type="String">Unit-Test - Creating a draft mail</Value>
      <Value name="bodyPreview" type="String">Hello, this is a Unit-Test! Test for creating and sending a draft mail</Value>
      <Value name="importance" type="String">normal</Value>
      <Value name="parentFolderId" type="String">AAMkAGI0NDU3YTMxLTVkOTktNGQ2Zi04OGViLTgzNWM1YWFlNjAwNwAuAAAAAABqZX6HQaolT792ILCaL-z8AQCRrcaFxKxcR7F2mRmZk4TVAAAAAAEPAAA=</Value>
      <Value name="conversationId" type="String">AAQkAGI0NDU3YTMxLTVkOTktNGQ2Zi04OGViLTgzNWM1YWFlNjAwNwAQAMvXRjjTgmVNv6d_qGfIB0M=</Value>
      <Value name="conversationIndex" type="String">AQHZqpUky9dGONOCZU2/p36oZ8gHQw==</Value>
      <Value name="isDeliveryReceiptRequested" type="Boolean">false</Value>
      <Value name="isReadReceiptRequested" type="Boolean">false</Value>
      <Value name="isRead" type="Boolean">true</Value>
      <Value name="isDraft" type="Boolean">true</Value>
      <Value name="webLink" type="String">https://outlook.office365.com/owa/?ItemID=AAMkAGI0NDU3YTMxLTVkOTktNGQ2Zi04OGViLTgzNWM1YWFlNjAwNwBGAAAAAABqZX6HQaolT792ILCaL%2Fz8BwCRrcaFxKxcR7F2mRmZk4TVAAAAAAEPAACRrcaFxKxcR7F2mRmZk4TVAAC6rA52AAA%3D&exvsurl=1&viewmodel=ReadMessageItem</Value>
      <Value name="inferenceClassification" type="String">focused</Value>
      <Object name="body">
         <Value name="contentType" type="String">text</Value>
         <Value name="content" type="String">Hello, this is a Unit-Test! Test for creating and sending a draft mail</Value>
      </Object>
      <Array name="toRecipients">
         <Object>
            <Object name="emailAddress">
               <Value name="name" type="String">Test User</Value>
               <Value name="address" type="String">test.user@softproject.de</Value>
            </Object>
         </Object>
      </Array>
      <Array name="ccRecipients"/>
      <Array name="bccRecipients"/>
      <Array name="replyTo"/>
      <Object name="flag">
         <Value name="flagStatus" type="String">notFlagged</Value>
      </Object>
   </Object>
</CreateDraft>

Note:

Included in the output is metadata provided by MS Graph. You can find more information about this metadata in the official MS Graph documentation: https://learn.microsoft.com/en-us/graph/

The following elements and attributes can be included in the output:

Element

Description

CreateDraft

Enclosing element for the output of the CreateDraftMail operation

Object

Enclosing element for the Value elements with details about the created email draft.

Value + name attributes

The Value element can contain different values in the name attribute.

Possible name attributes:

  • @odata.context: User Account in Microsoft Outlook

  • @odata.etag

  • id: ID of the email draft

  • createdDateTime: Date and time of creation of the email draft

  • lastModifiedDateTime: Date and time oft he last change of the email draft

  • changeKey: Change key

  • receivedDateTime: Date and time when the draft email was received

  • sentDateTime: Date and time when the email draft was sent

  • hasAttachments: The email draft has attachments.

  • internetMessageId: Internet Message ID

  • subject: Subject of the email draft

  • bodyPreview: Preview of the email draft’s text body

  • importance: Importance of the draft email with the possible values high, normal, low

  • parentFolderId: ID of the parent email folder

  • conversationId: Conversation ID

  • conversationIndex: Conversation Index

  • isDeliveryReceiptRequested: Delivery confirmation requested

  • isReadReceiptRequested: Read confirmation requested

  • isRead: Email draft marked as read

  • isDraft: Email draft marked as draft

  • webLink: Weblink for calling up the email in the browser

  • inferenceClassification

The type attribute specifies the type of the given data:

  • String: Any string

  • Number: Any integer

  • Boolean: Boolean value with the options true or false

Object + name attribute + value body

Specifies the body of the email.

Further Value elements with the following attributes define the content:

  • contentType: Type of the content
    Possible values:

    • html

    • text

  • content: Text body of the email

Array

Array with specification of recipients, recipients in copy, and recipients in blind copy with email address and name.

  • toRecipients: Recipient of the email draft

  • ccRecipients: Recipient of the draft email in copy

  • bccRecipients: Recipient of the email draft in blind copy

  • replyTo: not in use (If the original message specifies a recipient in the replyTo property, the reply will be sent to the recipients in replyTo and not to the recipient in the from property).

Object + name attribute + value emailAddress

Indicates name and email address of the recipients (toRecipients, ccRecipients, bccRecipients, replyTo).

Object + name attribute + value flag

Indicates flagged or non-flagged elements.

In the Object element Value elements can be enclosed with the following attributes:

  • name with the values flagStatus (…)

Possible values for flagStatus are:

  • notFlagged

  • Flagged


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.