Office 365: How to get the user’s default time zone 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 user’s default time zone 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 user's default time zone.</strong></p>            
  6.             <table id="details">  
  7.                 <tr>  
  8.                     <th>Default Time Zone:</th>  
  9.                     <td id="timeZone"></td>  
  10.                 </tr>                               
  11.             </table>  
  12.         </div>  
  13.     </div>      
  14. </body>   

Home.js

  1. /// <reference path="../App.js" />  
  2. /*global app*/  
  3.   
  4. (function () {  
  5.     'use strict';  
  6.   
  7.     // The Office initialize function must be run each time a new page is loaded  
  8.     Office.initialize = function (reason) {  
  9.         $(document).ready(function () {  
  10.             app.initialize();  
  11.   
  12.             displayItemDetails();  
  13.         });  
  14.     };  
  15.   
  16.     // Displays the "Subject" and "From" fields, based on the current mail item  
  17.     function displayItemDetails() {  
  18.         var userProfile = Office.context.mailbox.userProfile;         
  19.         $('#timeZone').text(userProfile.timeZone);  
  20.     }  
  21. })();  

Output:

Reference:

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

Ebook Download
View all
Learn
View all