博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何使用Exchange Web Service Managed API获取公共文件夹日历(包括循环会议)
阅读量:5987 次
发布时间:2019-06-20

本文共 2417 字,大约阅读时间需要 8 分钟。

在Exchange2010及其以后,MS提供了来调用Exchange的接口

下面代码演示了如何获取公共日历

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);        service.Credentials = new NetworkCredential("user", "password", "domain");        service.Url = new Uri();        System.Net.ServicePointManager.ServerCertificateValidationCallback =            delegate(            Object obj,            X509Certificate certificate,            X509Chain chain,            SslPolicyErrors errors            )            {                return true;            };        //CAL        string _id = "AAEuAAAAAAAaRHOQqmYRzZvIAKoAL8RaAwBZaXl0Ei75TYF0WbP9Pt4/AAAFNPQsAAA=";        CalendarView view = new CalendarView(DateTime.Now.AddDays(-5), DateTime.Now.AddDays(5));        CalendarFolder cf = CalendarFolder.Bind(service, new FolderId(_id));        //CalendarFolder.(service);        //Folder inbox = Folder.Bind(service, WellKnownFolderName.Inbox);        // service.ClientRequestId = _id;        FindItemsResults
findResults = cf.FindAppointments(view); foreach (Appointment appointment in findResults.Items) { Response.Write(appointment.Start+"--" + appointment.Subject + "
"); }

在上面代码里,有一个_id参数,他是日历的ID,下面代码演示了如何获取日历的ID

系统的入口是PublicFoldersRoot参数

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);        service.Credentials = new NetworkCredential("user", "password", "domain");        service.Url = new Uri("https://www.sohu.com/ews/exchange.asmx");        System.Net.ServicePointManager.ServerCertificateValidationCallback =            delegate(                    Object obj,                    X509Certificate certificate,                    X509Chain chain,                    SslPolicyErrors errors            )                {                return true;              };               FolderView view = new FolderView(5);        view.PropertySet = new PropertySet(BasePropertySet.IdOnly);        view.PropertySet.Add(FolderSchema.DisplayName);        view.Traversal = FolderTraversal.Shallow;        FindFoldersResults findFolderResults = service.FindFolders(WellKnownFolderName.PublicFoldersRoot, view);        //find specific folder        foreach (Folder f in findFolderResults)        {            //show folderId of the folder "test"           // if (f.DisplayName == "Test")            Response.Write(f.DisplayName+"**"+f.Id.UniqueId+"
"); }

 

 

转载地址:http://eiulx.baihongyu.com/

你可能感兴趣的文章
curl操作CouchDB
查看>>
ASP.NET MVC5 + EF6 入门教程 (6) View中的Razor使用
查看>>
2015北京楼市涨价地图解密
查看>>
深入理解PHP内核(五)变量及数据类型-变量的结构和类型
查看>>
MyBatis学习总结(五)——实现关联表查询
查看>>
python __init__.py
查看>>
使用rollup构建你的JavaScript项目【一】
查看>>
面向对象的JavaScript之继承(二) 构造函数继承
查看>>
用code打造自己的过渡动画
查看>>
火掌柜iOS端基于CocoaPods的组件二进制化实践
查看>>
Jenkins集成Docker镜像实现自动发布
查看>>
Java MVC 1.0规范开始进入公开评审阶段
查看>>
(翻译) MongoDB(14) 在 Debian 上安装MongoDB社区版
查看>>
WeX5中input拍照上传图片方法分享,可单图与多图
查看>>
android servicemanager与binder源码分析二 ------ servicemanager服务提供者
查看>>
href的那些事
查看>>
RecyclerView中Adapter和ViewHolder的封装
查看>>
xcache 源码包编译安装
查看>>
前端开发思考与实践
查看>>
tcp/ip参数控制
查看>>