最近做项目碰到Exchange中,用EWS API方法读取的未读邮箱(ConnectingIdType.PrincipalName设置该属性的方法)附带代码部分: 核心代码 using Microsoft.Exchange.WebServices.Data; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Security; using Sy
如果在mailkit中,文件夹已经选中并打开了的话,那直接使用ImapFolder.Unread属性就可以获取到有多少封未读邮件了. 如果文件夹没有打开,那么你还可以使用查询状态的方法来获取未读状态的邮件数量. 实例如下:获取邮件总数和未读邮件数量 folder.Status (StatusItems.Count | StatusItems.Unread); int total = folder.Count; int unread = folder.Unread;
using Microsoft.Exchange.WebServices.Data; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace ExchangeTest { class Program { static ExchangeService service;