title: outlook add-in image & files
body: <p>I try to find solution to my problems but didn't find any where,hope that someone here can save me.</p>
  
  <p>I write add-in in JavaScript on VS2015 that encrypte and decrypte body messages.</p>
  
  <p><strong>1. The first problem is with images that the receiver can't see .</strong>
  (Talk about images that copy into the body by "insert picture inline" button)</p>
  
  <p>In <strong>Compose mode</strong> we encrypte the message and then when we decrypte it's works good because the compose mode is a client side and he his recognize the local images .
  In <strong>read mode</strong> when user want to decrypte the message and to see the images he couldn't see because the encrypte prevent outlook to convert the local image to data on the server .</p>
  
  <p>In my code I take the body message like this ( compose mode )</p>
  
  <pre><code>item.body.getAsync(
                         item.body.getAsync(
                                      "html",
                                    { asyncContext: "This is passed to the callback" },
                                     function callback(resultbody) { 
  
                                      ......Here we send the body for ENCRYPT.
  
                  }))
  </code></pre>
  
  <p>then , the user send the encrypte message by clicking 'send' regular.</p>
  
  <p>In the read mode I just print it to my html to check if the decrypte is good :</p>
  
  <pre><code>(JSON.parse(xhr.responseText).Data.Content));
  </code></pre>
  
  <p>and then i get icon of picture  ,but not success to show the real pic .
  The src of the icon is going for place that not access for him ..</p>
  
  <pre><code>&lt;img src="https://attachment.outlook.office.net/owa/*****/service.svc/s/GetFileAttachment?id=AAMkADUwMDE0YWM1LTYwODctNG ......
  </code></pre>
  
  <p>How can i take this tag of image and do something that the receiver can see the image ? I don't want that user will be need to upload image to body from my my add-in instead of the original outlook. I try to convert the image to base-64 string, but with what I have in the  tag it not enough ,just with original picture and also it success to show in html but not in the body of message with SetAsync function..</p>
  
  <p><strong>2. The second problem is with attachments .</strong> 
  I upload files with dropzone plug-in (because outlook don't give access to take attachment and change him). So, after I upload files and encrypte him I make some new file with the response from server with File API of JS :</p>
  
  <pre><code>ar f = new File([""], "filename.txt", {type: "text/plain", lastModified: date}) . .. .
  </code></pre>
  
  <p>than I want to attach the file to mail, so the only method that do this is:</p>
  
  <pre><code>addFileAttachmentAsync(uri, attachmentName, optionsopt, callback opt)
  </code></pre>
  
  <p>then,I need to create a url for file for this method so I use this method:</p>
  
  <pre><code>var objectURL = URL.createObjectURL(f);
  </code></pre>
  
  <p>But now when I use the method addFileAttachmentAsync with objectURL it's write that there is a problem and its can't attach it , I think that the URL is incorrect . </p>
  
  <p><strong>Thanks all!!</strong></p>