I use ExchangeVersion.Exchange2013 to get list of emails from EWS . MS Outlook allows to display messages in two tabs: "Focused" or "Other". Is there a property or parameter for Exchange Service to get the emails for the "Focused" tab like Outlook does?
I heard about the property inferenceClassification
from Microsoft Graph API. But I don't know how to use a similar approach in Exchange Web Service API.
using Microsoft.Exchange.WebServices;
using Microsoft.Exchange.WebServices.Data;
public void GetFocusedEmails()
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.AutodiscoverUrl("example.user@contoso.com");
ItemView itemView = new ItemView(int.MaxValue, 0, OffsetBasePoint.Beginning);
loItemView.PropertySet = new PropertySet(BasePropertySet.IdOnly);
loItemView.PropertySet.RequestedBodyType = BodyType.Text;
//expected property to show only message like Focused
FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, itemView);
}
The focused Inbox is a pretty complex feature and it isn't available at the API level in any of the Legacy API's like EWS, MAPI, IMAP in a Public or supportable way.
So it comes down to what are you trying to do ? eg
Are you trying to build a new application that works against Microsoft 365 using EWS - If so don't use EWS its in the process of being depreciated you need to use the Graph API.
Are you trying to build an application that works against Exchange OnPrem - The focused inbox isn't a feature of OnPrem exchange, it possible to have it work against OnPrem mailbox but this all happens within the Outlook Client not in the Exchange server.
Against M365 you can use the following extended property to potentially work around the issue until you migrate to Graph (which you will need to do a some point)
ExtendedPropertyDefinition originalInferenceClassification = new ExtendedPropertyDefinition(Guid.Parse("23239608-685D-4732-9C55-4C95CB4E8E33"), "OriginalInferenceClassification", MapiPropertyType.Integer);
This gives the original value for the InferenceClassification property on a mailbox but it doesn't update when the InferenceClassification is updated by the user so will never be 100%