EWS托管API:FindFolders找不到用户创建的文件夹 [英] EWS Managed API: FindFolders not finding user-created folders

查看:105
本文介绍了EWS托管API:FindFolders找不到用户创建的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我希望这很简单......我需要在每个用户的邮箱中找到最早的电子邮件。 更具体地说,在每个用户的邮箱中的ARCHIVE文件夹下的任何位置(包括该文件夹的子文件夹中的电子邮件)。 这不是托管文件夹 - 我们是为每个用户创建的。 它不在收件箱下,而是与Outlook中的收件箱显示在同一级别。

我不是Exchange管理员,所以我不确定我哪里出错,但是当我使用深度遍历为所有文件夹查询邮箱(没有搜索过滤器),我似乎只获取内置文件夹,没有用户创建的文件夹。

这是文件夹列表我'回来了:
12/23/2009 5:12:33 PM  查找文件夹
12/23/2009 5:12:34 PM    退回:22
12/23/2009 5:12:34 PM  处理文件夹
12/23/2009 5:12:34 PM    处理:公共视图
12/23/2009 5:12:34 PM    处理:延期行动
12/23/2009 5:12:34 PM    处理:Finder
12/23/2009 5:12:34 PM    处理:Freebusy数据
12/23/2009 5:12:34 PM    处理:提醒
12/23/2009 5:12:34 PM    处理:时间表11/23/2009 5:12:34 PM    处理:快捷方式
12/23/2009 5:12:34 PM    处理:后台处理队列
12/23/2009 5:12:34 PM    处理:待办事项搜索
12/23/2009 5:12:34 PM    处理:信息存储首页
12/23/2009 5:12:34 PM    处理:日历
12/23/2009 5:12:34 PM    处理:联系人
12/23/2009 5:12:34 PM    处理:已删除的项目
12/23/2009 5:12:34 PM    处理:草稿
12/23/2009 5:12:34 PM    处理:收件箱
12/23/2009 5:12:34 PM    处理:期刊
12/23/2009 5:12:34 PM    处理:垃圾邮件
12/23/2009 5:12:34 PM    处理:备注
12/23/2009 5:12:34 PM    处理:发件箱
12/23/2009 5:12:34 PM    处理:已发送物品
12/23/2009 5:12:34 PM    处理:任务
12/23/2009 5:12:34 PM    处理:意见

代码:
       昏暗视图为新文件夹视图(65535)
        view.PropertySet = New PropertySet(BasePropertySet.IdOnly)
        view.PropertySet.Add(FolderSchema.DisplayName)
        view.Traversal = FolderTraversal.Deep  'subtree
       昏暗的结果如FindFoldersResults = ews.FindFolders(WellKnownFolderName.Root,view)

或许WellKnownFolderName.Root是错误的开始搜索的地方? 还有什么地方? 有什么想法吗?

提前谢谢!

Hi there,

I hope this is very simple... I need find the oldest email message in every user's mailbox.  More specifically, anywhere under the ARCHIVE folder in every user's mailbox (including email messages in sub-folders of that folder).  This is not a managed folder - we created it for each user.  It is not under Inbox, but rather shows at the same level as Inbox in Outlook.

I'm not an Exchange Administrator, so I'm not sure where I'm going wrong, but when I query a mailbox using a Deep traversal for all folders, (no search filter), I seem to be getting only built-in folders, and no user-created folders.

This is the folder list I'm getting back:
12/23/2009 5:12:33 PM   Find Folders
12/23/2009 5:12:34 PM     Returned: 22
12/23/2009 5:12:34 PM   Process folders
12/23/2009 5:12:34 PM     Processing: Common Views
12/23/2009 5:12:34 PM     Processing: Deferred Action
12/23/2009 5:12:34 PM     Processing: Finder
12/23/2009 5:12:34 PM     Processing: Freebusy Data
12/23/2009 5:12:34 PM     Processing: Reminders
12/23/2009 5:12:34 PM     Processing: Schedule
12/23/2009 5:12:34 PM     Processing: Shortcuts
12/23/2009 5:12:34 PM     Processing: Spooler Queue
12/23/2009 5:12:34 PM     Processing: To-Do Search
12/23/2009 5:12:34 PM     Processing: Top of Information Store
12/23/2009 5:12:34 PM     Processing: Calendar
12/23/2009 5:12:34 PM     Processing: Contacts
12/23/2009 5:12:34 PM     Processing: Deleted Items
12/23/2009 5:12:34 PM     Processing: Drafts
12/23/2009 5:12:34 PM     Processing: Inbox
12/23/2009 5:12:34 PM     Processing: Journal
12/23/2009 5:12:34 PM     Processing: Junk E-Mail
12/23/2009 5:12:34 PM     Processing: Notes
12/23/2009 5:12:34 PM     Processing: Outbox
12/23/2009 5:12:34 PM     Processing: Sent Items
12/23/2009 5:12:34 PM     Processing: Tasks
12/23/2009 5:12:34 PM     Processing: Views

Code:
        Dim view As New FolderView(65535)
        view.PropertySet = New PropertySet(BasePropertySet.IdOnly)
        view.PropertySet.Add(FolderSchema.DisplayName)
        view.Traversal = FolderTraversal.Deep  ' subtree
        Dim results As FindFoldersResults = ews.FindFolders(WellKnownFolderName.Root, view)

Perhaps WellKnownFolderName.Root is the wrong place to start the search?  Where else?  Any ideas?

Thanks in advance!

推荐答案

好吧,它*非常简单。 我想,这只是学习曲线的一部分。 我没有正确理解如何连接到其他用户的邮箱。 我得到的结果来自我的管理员帐户的邮箱(我运行代码的帐户),而不是我想要定位的帐户。

我以为我通过设置自动发现来定位特定帐户使用该帐户的电子邮件地址。

        ews.AutodiscoverURL(targetEmailAddress)

但是没有连接到其他用户的邮箱。 相反,这是有效的线路:

        ews.ImpersonatedUserId = New ImpersonatedUserId(ConnectingIdType.SmtpAddress,targetEmailAddress)

希望这可以帮助正在学习API的其他人。
Well, it *was* very simple.  Just a part of the learning curve, I guess.  I didn't properly understand how to connect to another user's mailbox.  The results I got were from my admin account's mailbox (the account I was running the code as), and not the account I wanted to target.

I thought I was targeting a particular account by setting the AutodiscoverURL using that account's email address.

        ews.AutodiscoverURL(targetEmailAddress)

But that didn't connect to the other user's mailbox.  Instead, this is the line that worked:

        ews.ImpersonatedUserId = New ImpersonatedUserId(ConnectingIdType.SmtpAddress, targetEmailAddress)

Hope this helps someone else who is learning the API.


这篇关于EWS托管API:FindFolders找不到用户创建的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆