我想獲得最大郵箱大小或配額限制。其實我找到了郵箱的免費空間。所以我找到了已用空間和最大空間,然後找到差異來找到空閒空間。C#EWS託管API:如何獲取郵箱最大大小或配額限制
我得到下面的代碼來找到文件夾的使用大小。我想我可以遍歷所有文件夾以獲得完整大小。但是,我怎樣才能獲得最大限額?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Exchange.WebServices.Data;
namespace ConsoleApplication12
{
class Program
{
static void Main(string[] args)
{
ExchangeService service = new ExchangeService();
service.Credentials = new WebCredentials("mail", "pass");
service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
ExtendedPropertyDefinition PR_Extended_Message_Size = new ExtendedPropertyDefinition(3592, MapiPropertyType.Long);
PropertySet psPropertySet = new PropertySet(BasePropertySet.FirstClassProperties) { PR_Extended_Message_Size };
Folder Inbox = Folder.Bind(service, WellKnownFolderName.Inbox, psPropertySet);
long FolderSize = 0;
if (Inbox.TryGetProperty(PR_Extended_Message_Size, out FolderSize))
{
Console.WriteLine(FolderSize/1024);
}
Console.ReadKey();
}
}
}
您應該可以像查詢extended_message_size一樣查詢它們。在此查找配額的MAPI屬性常量:https://blogs.technet.microsoft.com/outlooking/2013/09/19/mailbox-quota-in-outlook-2010-general-information-and-troubleshooting-tips/ – dlatikay