<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Outlook Graph API - Add attachment in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Outlook-Graph-API-Add-attachment/m-p/95989#M44376</link>
    <description>Hello @Seb T and &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/833"&gt;@ewilson&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;May I ask what should be the ​​​&lt;BR /&gt;
&lt;PRE class="language-javascript" tabindex="0"&gt;&lt;CODE&gt;				"contentType": "[Attachment Content Type]",
				"contentBytes": "[Attachment Contents]"​&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do I need some code to get the contentBytes of an attachment?&lt;BR /&gt;&lt;BR /&gt;Also, is this api can upload attachment of more than 4MB size?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jul 2022 14:09:10 GMT</pubDate>
    <dc:creator>RaviSingh</dc:creator>
    <dc:date>2022-07-08T14:09:10Z</dc:date>
    <item>
      <title>Outlook Graph API - Add attachment</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Outlook-Graph-API-Add-attachment/m-p/95986#M44373</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;Im trying to modify the Outlook Graph API's to include an action that sends an email with an attachment.&lt;BR /&gt;From what i can gather from MS own websites, you need to use the following request :&lt;BR /&gt;&lt;BR /&gt;"attachments":&lt;BR /&gt;{&lt;BR /&gt;"@odata.type": "#microsoft.graph.fileAttachment",&lt;BR /&gt;"name": "[Attachment Name]",&lt;BR /&gt;"contentBytes": "[ContentBytes]"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;So what i've attempted to do is add the above to the sendMail API request, getting the following:&lt;BR /&gt;&lt;BR /&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN&gt;"message"&lt;/SPAN&gt;&lt;SPAN&gt;: {&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN&gt;"subject"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"Test"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN&gt;"body"&lt;/SPAN&gt;&lt;SPAN&gt;: {&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN&gt;"contentType"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"Text"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN&gt;"content"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"Test"&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; },&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN&gt;"attachments"&lt;/SPAN&gt;&lt;SPAN&gt;: [&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&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
&lt;DIV&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; ]&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;However, I keep getting an error "InvalidRecipient", even though im using my own work email as recipient, which works when using the standard sendMail API.&lt;BR /&gt;For easier viewability, i've added an attachment of how it looks in graph explorer.&lt;BR /&gt;&lt;BR /&gt;Anyone with any experience doing this?&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;Br,&lt;BR /&gt;Seb</description>
      <pubDate>Wed, 12 Jan 2022 15:44:56 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Outlook-Graph-API-Add-attachment/m-p/95986#M44373</guid>
      <dc:creator>SebT</dc:creator>
      <dc:date>2022-01-12T15:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Outlook Graph API - Add attachment</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Outlook-Graph-API-Add-attachment/m-p/95987#M44374</link>
      <description>Hi &lt;A class="user-content-mention" data-sign="@" data-contactkey="d5549726-7e6c-45aa-b48d-73d3e667702c" data-tag-text="@Seb T" href="https://community.blueprism.com/network/profile?UserKey=d5549726-7e6c-45aa-b48d-73d3e667702c" data-itemmentionkey="cef5af88-00a7-469b-bd4d-16f736c0e361"&gt;@Seb T&lt;/A&gt;,&lt;BR /&gt;&lt;BR /&gt;Here's an example body template for a version of the Send Mail action that incudes the option for an attachment:&lt;BR /&gt;&lt;BR /&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;{
	"message": {
		"subject": "[Subject]",
		"body": {
			"contentType": "[Email Body Content Type]",
			"content": "[Email Body Content]"
		},
		"toRecipients": [
			{
				"emailAddress": {
					"address": "[Email Address]"
				}
			}
		],
		"ccRecipients": [
			{
				"emailAddress": {
					"address": "[Email Address]"
				}
			}
		],
		"attachments": [
			{
				"@odata.type": "#microsoft.graph.fileAttachment",
				"name": "[Attachment Name]",
				"contentType": "[Attachment Content Type]",
				"contentBytes": "[Attachment Contents]"
			}
		]
	},
	"saveToSentItems": "[Save to Sent Items Folder]"
}​&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;I believe Microsoft expect to see the recipient information before any attachment sections.&lt;BR /&gt;&lt;BR /&gt;And here's a screenshot of how I set up the input parameters:&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="34922.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/34989i1A662E2FFBFA542A/image-size/large?v=v2&amp;amp;px=999" role="button" title="34922.png" alt="34922.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Eric&lt;/P&gt;
​</description>
      <pubDate>Wed, 12 Jan 2022 16:58:46 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Outlook-Graph-API-Add-attachment/m-p/95987#M44374</guid>
      <dc:creator>ewilson</dc:creator>
      <dc:date>2022-01-12T16:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Outlook Graph API - Add attachment</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Outlook-Graph-API-Add-attachment/m-p/95988#M44375</link>
      <description>Works like a charm! Thanks alot Eric.&lt;BR /&gt;&lt;BR /&gt;Br,&lt;BR /&gt;Seb</description>
      <pubDate>Thu, 13 Jan 2022 08:04:06 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Outlook-Graph-API-Add-attachment/m-p/95988#M44375</guid>
      <dc:creator>SebT</dc:creator>
      <dc:date>2022-01-13T08:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: Outlook Graph API - Add attachment</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Outlook-Graph-API-Add-attachment/m-p/95989#M44376</link>
      <description>Hello @Seb T and &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/833"&gt;@ewilson&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;May I ask what should be the ​​​&lt;BR /&gt;
&lt;PRE class="language-javascript" tabindex="0"&gt;&lt;CODE&gt;				"contentType": "[Attachment Content Type]",
				"contentBytes": "[Attachment Contents]"​&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do I need some code to get the contentBytes of an attachment?&lt;BR /&gt;&lt;BR /&gt;Also, is this api can upload attachment of more than 4MB size?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 14:09:10 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Outlook-Graph-API-Add-attachment/m-p/95989#M44376</guid>
      <dc:creator>RaviSingh</dc:creator>
      <dc:date>2022-07-08T14:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Outlook Graph API - Add attachment</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Outlook-Graph-API-Add-attachment/m-p/95990#M44377</link>
      <description>Hello &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/1840"&gt;@RaviSingh&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Content-Type is the MIME type of the file you’re trying to attach to the email. As an example, if I wanted to attach a PDF to the email I would set the content type to “application/pdf”. You can find a list of common MIME types &lt;A href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;Content Bytes is the actual binary content of the file attachment. You can get the bytes by using the Calculation stage.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Eric​</description>
      <pubDate>Fri, 08 Jul 2022 21:07:14 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Outlook-Graph-API-Add-attachment/m-p/95990#M44377</guid>
      <dc:creator>ewilson</dc:creator>
      <dc:date>2022-07-08T21:07:14Z</dc:date>
    </item>
  </channel>
</rss>

