`
wen_pp
  • 浏览: 22843 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

从exchange server 获取out of office 信息

    博客分类:
  • .Net
阅读更多
using System;
using System.Net;
using GetOFFS.sg.com.ncs.webmail;
using Microsoft.Exchange.WebServices;
using Microsoft.Exchange.WebServices.Data;


namespace GetOFFS
{

    public class Program
    {
        public static string url = "https://exchangeserveraddress/ews/Exchange.asmx";
        static void Main(string[] args)
        {
            ExchangeServiceBinding esb = new ExchangeServiceBinding();
            esb.Credentials = new NetworkCredential("username", "password", "domain");
            esb.Url = url;
            esb.RequestServerVersionValue = new RequestServerVersion();
            esb.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2010_SP1;
            GetMessageTrackingReportRequestType gmt = new GetMessageTrackingReportRequestType();
            
            GetMailTipsType gmType = new GetMailTipsType();
            gmType.MailTipsRequested = new MailTipTypes();
            gmType.MailTipsRequested = MailTipTypes.OutOfOfficeMessage;
            gmType.Recipients = new EmailAddressType[1];
            EmailAddressType rcip = new EmailAddressType();
            rcip.EmailAddress = "target@emailaddress";
            gmType.Recipients[0] = rcip;
            EmailAddressType sendAs = new EmailAddressType();
            sendAs.EmailAddress = "target@emailaddress";
            gmType.SendingAs = sendAs;

            GetMailTipsResponseMessageType gmResponse = esb.GetMailTips(gmType);
            if (gmResponse.ResponseClass == ResponseClassType.Success)
            {
                if (gmResponse.ResponseMessages[0].MailTips.OutOfOffice.ReplyBody.Message != "")
                {
                    //User Out   
                    Console.WriteLine(gmResponse.ResponseMessages[0].MailTips.OutOfOffice.ReplyBody.Message);
                }
                else
                {
                    //user In   
                }

            } 
        }
    }
}
分享到:
评论

相关推荐

    计算机网络第六版答案

    An Internet Exchange Points (IXP) (typically in a standalone building with its own switches) is a meeting point where multiple ISPs can connect and/or peer together. An ISP earns its money by ...

    Deploying.SharePoint.2016.1484219988

    Chapter 9: Configuring Office Online Server for SharePoint Chapter 10: Workflow Manager Chapter 11: SharePoint and Exchange Integration Chapter 12: Business Intelligence Service Applications Chapter ...

    Java邮件开发Fundamentals of the JavaMail API

    take advantage of protocols for which Sun does not provide out-of-the-box support. You'll find support for NNTP (Network News Transport Protocol) [newsgroups], S/MIME (Secure Multipurpose Internet ...

    a project model for the FreeBSD Project.7z

    This, combined with the vast amount of dependencies in the kernel and that it is not easy to see all the consequences of a kernel change, demands developers with a relative full understanding of the ...

    UE(官方下载)

    This power tip provides an explanation as well as some tips to get the most out of temp files. Backup and Restore Settings One of the staples of UltraEdit (and UEStudio) is its highly configurable ...

    Duplicate Email Remover 2.7

    (you can find out this information through properties of the "My Computer" item on the desktop or the "System" item in the Control Panel). - Please try to provide as much information as possible...

    VB编程资源大全(英文源码 其它)

    6 , chunks.zip This will open a file and read it in "Chunks" of a selected file.<END><br>7 , logging.zip This is a bas that will log installation procedures so the file can be removed later....

    Linux操作系统基础教程

    清华大学信息学院计算机系 目 录 前言..................................................................................................................................................2 第一讲 ...

    Set-OutlookSignatures:用于文本签名和外出 (OOF) 自动回复消息的中央 Outlook for Windows 管理和部署脚本

    从 DOCX 或 HTML 文件格式的模板生成 使用广泛的变量进行自定义,包括来自 Active Directory 的照片 应用于所有邮箱、特定组或特定地址 指定的有效时间范围 设置为新邮件或回复和转发的默认签名(仅限签名) 设置为...

Global site tag (gtag.js) - Google Analytics