title: sharePoint online count unread message from office365
body: <p>As part of a project whose aim is to notably improve the visual side of a SharePoint Online site, I'm a bit stuck. On the home page in the left banner, users want to see the number of unread messages they have in Office365. </p>
  
  <p>I created an area in the master page to put the result in. I thought the Rest API used to do this :</p>
  
  <pre><code>$.ajax ({
      type: "GET",
      url: " https://outlook.office365.com/ews/odata/Me/Folders/Inbox",
      dataType : "json",
      success : function (resp) {
          // count unread messages 
      },
      error : function (e) {
          alert (' Error121212 :' + JSON.stringify (e));
      }
   })
  </code></pre>
  
  <p>Unfortunately I get an error like cross domain. I tried with JSONP but it does not work either (uncaught syntax error unexpected token).</p>
  
  <p>Can you please tell me if this is a good practice? I feel that it anyways I must find a technic for authentication. (In the case of JSONP I have a popup that asks me authentication and then problem occurs on callback apparently)...</p>
  
  <p>I want to avoid developing a type requiring a typical deployment Wsp...</p>
  
  <p>Thank you in advance for your help.</p>