Currently working on a project with the goal of enhancing the visual appeal of a SharePoint Online site, I've hit a roadblock. Users are requesting to see the number of unread messages in their Office365 inbox on the home page's left banner.
To achieve this, I added a section in the master page where I intended to display the result using the Rest API:
$.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));
}
})
However, I encountered an error related to cross-domain issues. Even after attempting to use JSONP, I faced challenges (uncaught syntax error unexpected token).
I'm seeking advice on whether this approach is best practice, especially considering the need for authentication. When trying JSONP, an authentication popup disrupts the process, leading to callback errors...
I'm hoping to find a solution that doesn't involve developing a deployment requiring a Wsp...
Thank you in advance for any assistance provided.