[英]C# EWS Managed API : How to get mailbox maximum size or quota limit
I want to get maximum size of mailbox or quota limit. 我想获得邮箱或配额限制的最大大小。 Actually I am find free space of mailbox.
其实我发现邮箱的可用空间。 So I am finding used space and max space and then finding difference to find free space.
所以我要找到已用空间和最大空间,然后找到差异以找到可用空间。
I got below code to find used size for folder. 我得到下面的代码来查找文件夹的使用大小。 I think I can iterate to all folder to get full size.
我想我可以遍历所有文件夹以获取完整大小。 But how can I get maximum quota limit?
但是如何获得最大配额限制?
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();
}
}
}
您可以使用已有的代码,而不是PR_Extended_Message_Size
查询PR_Prohibit_Receive_Quota
(十六进制值0x666A0003),根据文档 ,这是“禁止接收邮件的限制(也是邮箱的最大大小)”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.