如何确定 Outlook 文件夹是否是公共的?

发布于 2024-10-07 07:37:56 字数 94 浏览 0 评论 0原文

我需要一种方法来确定 Outlook 文件夹是否是公共的。我怀疑有一些属性 Microsoft.Office.Interop.Outlook 允许我执行此操作,但我找不到它。

I need a way to determine if an Outlook folder is public. I suspect there is some property Microsoft.Office.Interop.Outlook that will allow me to do it, but I can't find it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

妳是的陽光 2024-10-14 07:37:56

如果您可以访问与相关文件夹关联的 IMsgStore 界面(抱歉,不知道如何使用纯 C# 实现这一点 - 我建议 赎回)您可以查询 PR_MDB_PROVIDER 属性来查看它是否为 pbExchangeProviderPublicGuid

根据您对 KG 答案的评论更新

如果您想过滤掉主邮箱中的联系人,只需将他们的 StoreID 与您的默认收件箱文件夹的 StoreID 进行比较即可 -或者一开始就不要枚举任何其他存储中的文件夹。

If you can get at the IMsgStore interface associated with the folder in question (sorry, no idea how to do that with pure C# - I recommend Redemption) you could query the PR_MDB_PROVIDER property to see whether it is pbExchangeProviderPublicGuid.

Update based on your comment to KG's answer:

If you want to filter out the contacts that are inside your primary mailbox, just compare their StoreID with that of your default inbox folder - or simply don't enumerate folders from any other stores to begin with.

只为守护你 2024-10-14 07:37:56

您想要的是 Exchange Web 服务,特别是 FindFolder 操作(请参阅 此处此处< /a> 一些 MSDN 描述)。

尽管从表面上看,没有特定的属性来标识该文件夹是否是“公共”的,就像 @RedDeckWins 提到的那样。

更新

如果您没有特别要求为此使用托管 C#,则可以使用 Powershell Exchange Cmdlet(查看此处)。具体来说,这个命令可能会有所帮助:

Get-PublicFolder -Recurse | Format-List Name

Powershell 本身非常容易使用,但如果运行代码的服务器安装了它(对于大多数现代机器来说应该如此),也可以从 C# 调用它。

如果您仅限于 C#,请查看以下 StackOverflow 问题:交换中公共文件夹的电子邮件地址列表

What you want is Exchange Web Service, specifically the FindFolder operation (see here or here for some MSDN descriptions).

Although, from the looks of it, there is no specific property that identifies whether or not the folder is "public", like @RedDeckWins mentions.

UPDATE

If you are not specifically required to use managed C# for this, you can use the Powershell Exchange Cmdlets (check this out here). Specifically, this command might be helpful:

Get-PublicFolder -Recurse | Format-List Name

Powershell is pretty easy to use by itself, but it can also be called from C#, if the server your code is running on has it installed (which, for most modern boxes, should).

If you ARE limited to C#, take a look at this StackOverflow question: List of email address to public folders in exchange

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文