摘要

有时在操作exchange的时候,需要查找用户exchange文件夹,比如用户新建了一些文件夹。

一个例子

这里以查找用户outlook邮箱中的历史对话文件夹为例。

  private const ExchangeVersion EXCHANGE_VERSION = ExchangeVersion.Exchange2010_SP2;
private ExchangeService _service; public MyExchangeClient(UserInfo userInfo)
{
if (userInfo == null)
{
throw new ArgumentNullException("user is empty");
}
this._userInfo = userInfo;
this._service = new ExchangeService(EXCHANGE_VERSION);
_service.Credentials = new NetworkCredential(userInfo.Itcode, userInfo.Pwd, _userInfo.Domain);
_service.Url = new Uri(ConfigManager.ExchangeServerUrl); }
 /// <summary>
/// 查找对话历史文件夹
/// </summary>
/// <returns></returns>
private Folder FindImHistoryFolder()
{
int _pageSize = ;
FolderView folderView = new FolderView(_pageSize, );
folderView.PropertySet = new PropertySet(BasePropertySet.IdOnly);
folderView.PropertySet.Add(FolderSchema.DisplayName);
folderView.PropertySet.Add(FolderSchema.ChildFolderCount); folderView.Traversal = FolderTraversal.Shallow;
Folder imHistoryFolder = null; FindFoldersResults findFolderResults;
bool foundImHistoryFolder = false;
do
{
findFolderResults = this._service.FindFolders(WellKnownFolderName.MsgFolderRoot, folderView);
foreach (Folder folder in findFolderResults)
{
if (folder.DisplayName.ToLower() == "conversation history" || folder.DisplayName.ToLower() == "对话历史记录")
{
imHistoryFolder = folder;
foundImHistoryFolder = true;
}
}
folderView.Offset += _pageSize;
} while (findFolderResults.MoreAvailable && !foundImHistoryFolder); return imHistoryFolder;
}

[EWS]查找 文件夹的更多相关文章

  1. shell脚本实现查找文件夹下重复的文件,并提供删除功能

    Windows下有软件FindDupFile,可以搜索指定目录及其下子目录,列出所有内容完全相同的文件(文件名可能不同),然后由用户选择删除重复的文件. 然而shell脚本却可以使用几行的命令完成与此 ...

  2. linux grep find查找文件夹、代码中的某行/字符串

    本文转载于:https://blog.csdn.net/Mr_Cat123/article/details/80541658 在Linux中,由于文件很多,代码很长,可能我们只知道其中的一两个字符串, ...

  3. linux查找文件夹命令

    查找命令: 查找根目录下查找文件夹名称叫www.91cnm.com的目录地址 find / -name www.91cnm.com -d 1 查找/var/www/目录下叫index.php的文件 f ...

  4. linux查找文件夹下的全部文件里是否含有某个字符串

    查找文件夹下的全部文件里是否含有某个字符串  find .|xargs grep -ri "IBM"  查找文件夹下的全部文件里是否含有某个字符串,而且仅仅打印出文件名称  fin ...

  5. c#做的查找文件夹内内容的小工具

    第一次写博客有点激动啊QAQ 来新单位,一直没活干,公司代码控制器太多,其中有很多文件夹,每次找一个控制器都老找不到,我又不愿意用VS的全局搜索,想着没事就做了个查找控制器的小工具.代码如下: 先添加 ...

  6. linux下面查找文件夹名称

    其中如果查找redis开头的文件夹,可以输入 find / -name redis* -d

  7. C++ 查找文件夹下的文件

    #include <string> #include <vector> #include <cstring> #include <cstdio> #in ...

  8. Linux查找文件夹下包含某字符的所有文件

    Linux grep 命令用于查找文件里符合条件的字符串.grep 指令用于查找内容包含指定的范本样式的文件,如果发现某文件的内容符合所指定的范本样式,预设 grep 指令会把含有范本样式的那一列显示 ...

  9. Ubuntu 查找文件夹中内容包含关键字的文件,路径为当前文件夹

    From CSDN http://blog.csdn.net/lizhenmingdirk/article/details/44834997 grep -rl "keyword" ...

随机推荐

  1. 【vue】http-server开启本地服务

    在写前端页面中,经常会在浏览器运行HTML页面,从本地文件夹中直接打开的一般都是file协议,当代码中存在http或https的链接时,HTML页面就无法正常打开,为了解决这种情况,需要在在本地开启一 ...

  2. python做数据分析pandas库介绍之DataFrame基本操作

    怎样删除list中空字符? 最简单的方法:new_list = [ x for x in li if x != '' ] 这一部分主要学习pandas中基于前面两种数据结构的基本操作. 设有DataF ...

  3. Android Dagger 2

    Dagger 2 依赖注入 1. 基本概念 最重要有四个概念,也是四个注解(annotation),Provide,Inject,Module,Component. Provide 是提供者,创建实例 ...

  4. 关于IE9 table显示错位的问题

    首先,win10无法安装IE9,所以需要用IE11模拟IE9,这样:http://www.w10zj.com/Win10xy/Win10yh_638.html: 其次,table显示错位的可能原因:h ...

  5. Java并发编程总结5——ThreadPoolExecutor

    一.ThreadPoolExecutor介绍 在jdk1.8中,构造函数有4个.以 ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, ...

  6. Python大黑阔—url采集+exp验证,带你批量测试

    i春秋作家:大木瓜 前言: 最近几天在整理从各处收集来的各种工具包,大大小小的塞满了十几个G的硬盘,无意间发现了一个好几年前的0day.心血来潮就拿去试了一下,没想到真的还可以用,不过那些站点都已经老 ...

  7. Spring static 静态属性注入

    <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> &l ...

  8. Spring Boot中使用@Scheduled创建定时任务

    我们在编写Spring Boot应用中经常会遇到这样的场景,比如:我需要定时地发送一些短信.邮件之类的操作,也可能会定时地检查和监控一些标志.参数等. 创建定时任务 在Spring Boot中编写定时 ...

  9. vue 路由传参的三种基本模式

    路由是连接各个页面的桥梁,而参数在其中扮演者异常重要的角色,在一定意义上,决定着两座桥梁是否能够连接成功. 在vue路由中,支持3中传参方式. 场景,点击父组件的li元素跳转到子组件中,并携带参数,便 ...

  10. Linux发邮件

    一.mail命令 1.配置 vim /etc/mail.rc 文件尾增加以下内容  set from=1968089885@qq.com smtp="smtp.qq.com"set ...