简体   繁体   English

在 Exchange 中访问 email 属性 web 服务器托管 API

[英]Accessing email properties in Exchange web server managed API

I'm a complete newbie to EWS, but am trying to convert a happily functioning IMAP program into EWS & am having problems accessing simple fields in the managed API, eg From, Sender, BodyType.我是 EWS 的新手,但我正在尝试将运行愉快的 IMAP 程序转换为 EWS,并且在访问托管 API 中的简单字段时遇到问题,例如 From、Sender、BodyType。 Can anyone spot what I am doing wrong?谁能发现我做错了什么? Many thanks folks.非常感谢各位。

        ItemView view = new ItemView(99);
        SearchFilter.Exists filter = new SearchFilter.Exists(EmailMessageSchema.Id);
        FindItemsResults<Item> inboxMessageList = service.FindItems(WellKnownFolderName.Inbox, view);
        Console.WriteLine("Inbox message count: " + inboxMessageList.TotalCount);
        int messageCounter = 1;

        //message loop
        foreach (Item thisMessage in inboxMessageList)
        {
            //Collect info about current email message
            Item thisItem = Item.Bind(service, thisMessage.Id);
            Console.WriteLine("Current message ID: " + thisMessage.Id);

            string uniqueID = "EMAIL-" + DateTime.UtcNow.ToString("yyyyMMdd-HHmmss-fff");
            string messageTo = thisItem.DisplayTo;
            string messageCC = thisItem.DisplayCc;
            string messageFrom = //cant get this to work
            string messageSubject = thisItem.Subject;
            string messageDate = thisMessage.DateTimeReceived.ToString();
            int noOfAttachments = 0;
            Boolean messageHasAttachments = thisMessage.HasAttachments;
            if (messageHasAttachments) noOfAttachments = thisMessage.Attachments.Count();
            string isBodyHtml = //cant seem to implement this either
            Boolean domainblacklistResult = fn.CheckIfDomainBlacklisted(messageFrom);
            Boolean emailblacklistResult = fn.CheckIfEmailBlacklisted(messageFrom);

To access information about the email message, you need to bind it as an EmailMessage , instead of as an Item .要访问有关 email 消息的信息,您需要将其绑定为EmailMessage ,而不是Item Example:例子:

EmailMessage message = EmailMessage.Bind(service, thisMessage.Id);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Exchange Web服务托管API:访问其他用户项 - Exchange Web Services Managed API: Accessing other users items 使用Exchange Web服务托管API检测电子邮件移动? - Detect email move using Exchange Web Service Managed API? 在iOS应用程序中访问Microsoft Exchange Server Web服务(EWS)API - Accessing Microsoft Exchange Server Web Services (EWS) API in an iOS application 使用EWS托管API访问共享的联系人(Exchange 2010) - Accessing Shared Contacts with EWS Managed API (Exchange 2010) 在某些属性上更新EmailMessage时发生Exchange EWS托管API错误 - Exchange EWS Managed API Error while Updating EmailMessage on certain properties Exchange Webservice Managed API - 按扩展属性查找项目 - Exchange Webservice Managed API - Find items by extended properties Folder.Bind - “Id格式错误” - Exchange Web服务托管API - Folder.Bind - “Id is malformed” - Exchange Web Services Managed API 使用EWS托管API将.msg文件上传到Exchange Server - Upload .msg file to Exchange Server using EWS Managed API 允许模拟用户通过EWS托管API 2.0登录到Exchange Server - Allow impersonation users to login to Exchange Server by EWS Managed API 2.0 如何使用EWS托管API验证Exchange凭据和验证Exchange服务器通信? - How to validate Exchange credentials and verify Exchange server communication using EWS managed API?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM