How to return a user's unread mail count from an Exchange inbox?
-
22-08-2019 - |
Question
I am involved in writing a little internal SharePoint portal for our company. I thought it would be a 'quick win' to get create a web part that would display the user's unread mail count, and possibly a list of today's calendar tasks. However, I have had a hunt around for information to do with OWA web services stuff and I can see no easy way of doing this.
Am I being stupid, is there a simple call you can make? If not what would my first steps be in order to achieve what I want?
Thanks!
Solution
If they're using Exchange 2007, you can use Exchange web services to query the inbox.
Here's the reference in MSDN. The FindFolder operation will return the unread count of a folder. http://msdn.microsoft.com/en-us/library/bb204119.aspx
Visual Studio can generate the proxy classes for you to help you get started: http://msdn.microsoft.com/en-us/library/bb408522.aspx
OTHER TIPS
A few months ago I have done this using CDO Library with C# .NET Windows Service.Example code was like this
MAPI.Folder inboxFolder = Inbox;
MAPI.Messages messages = (Messages) inboxFolder.Messages;
MAPI.MessageFilter filter = (MessageFilter) messages.Filter;
filter.Unread = true;