Office 365: How to get the recipients in a read form in Outlook Web App

Please refer my previous articles to create an app for Outlook Web App

Visual Studio 2013: http://www.c-sharpcorner.com/UploadFile/anavijai/office-365-how-to-create-an-app-for-outlook-2013-using-visu/

Napa Tool: http://www.c-sharpcorner.com/UploadFile/anavijai/office-365-how-to-create-an-app-for-outlook-web-app-using-n/

In this blog you will see how to get the recipients in a read form in Outlook Web App.

AppRead folder: Home.html

  1. <body>    
  2.     <!-- Page content -->    
  3.     <div id="content-main">    
  4.         <div class="padding">    
  5.             <p><strong>Gets the recipients of an email message in a read form.</strong></p>             
  6.             <table id="details">    
  7.                 <tr>    
  8.                     <th>To Address:</th>    
  9.                     <td id="toAddress"></td>    
  10.                 </tr>                                 
  11.             </table>    
  12.         </div>    
  13.     </div>        
  14. </body>     
  15. Home.js  
  16.   
  17. /// <reference path="../App.js" />    
  18. /*global app*/    
  19.     
  20. (function () {    
  21.     'use strict';    
  22.     
  23.     // The Office initialize function must be run each time a new page is loaded    
  24.     Office.initialize = function (reason) {    
  25.         $(document).ready(function () {    
  26.             app.initialize();    
  27.     
  28.             displayItemDetails();    
  29.         });    
  30.     };    
  31.     
  32.     // Displays the "Subject" and "From" fields, based on the current mail item    
  33.     function displayItemDetails() {    
  34.         var item = Office.cast.item.toItemRead(Office.context.mailbox.item);    
  35.         // Similaryly to get cc receipients:item.cc and for bcc : item.bcc          
  36.         var test=item.to;    
  37.         for (var i=0; i<test.length; i++)    
  38.         document.getElementById('toAddress').innerHTML += "<b>Display Name:</b> "+ test[i].displayName+ "; <b>Email:</b> "+ test[i].emailAddress+"<br/>";         
  39.     }    
  40. })();     
  41.  
Output



Reference:

https://msdn.microsoft.com/en-us/library/office/fp142279.aspx

Ebook Download
View all
Learn
View all