5

I have an requirement like, need to show the email count or unread email count of the logged in user in sharepoint O365. For each user there is one mail box configured. Based on that logged in user i have to fetch the number of emails. Is there any possible ways to do that? Refer the below image to understand. I am trying to do in sharepoint auto hosted app.

enter image description here

1

We tried doing a similar thing earlier this year. We wanted to develop a SharePoint App Part that showed a Live Tile with the current unread mail count. I opened a topic on MSDN Forums to discuss this:

http://social.msdn.microsoft.com/Forums/sharepoint/en-US/6736f1d2-1560-4c88-9377-e13e508f1809/how-do-i-connect-to-ews-exchange-web-services-via-javascript-for-sharepoint-2013-app?forum=appsforsharepoint

We even had some help from our local Micrsosoft subsidiary. Ultimately we gave up. We wanted it to work in a SharePoint-hosted app, which as you may know is all JavaScript. The only way we could make it work is by putting the actual login credentials in the JavaScript code, which of course isn't very safe, since the code can easily be extracted (it all runs client-side).

I had hoped that the fact that one is logged into Office 365 / SharePoint Online would provide some context to do Single Sign-On for the Exchange EWS API. But that approach wasn't possible at the time. There were only two authentication options: use the users credentials to login or use a service account with impersonation. For both methods we had to put the credentials of the accounts in the Javascript: now way!

You say you want to go auto-hosted. I think that might work. I think the best way in that scenario would be to use the service account approach. Your code should verify the user and use the service account to impersonate and get the info from Exchange. All code runs server-side, so less of a security risk. However, getting your Exchange admins to create such an account might be problematic. Being able to impersonate any user in Exchange is a very powerfull thing. Most admins I know will not like such a thing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.