gpt4 book ai didi

c# - 使用 EWS 按路径获取 Exchange 文件夹

转载 作者:行者123 更新时间:2023-11-30 16:21:24 27 4
gpt4 key购买 nike

我需要使用 EWS 从“收件箱\测试\最终”Exchange 文件夹中检索项目。该文件夹由上面所写的文字路径提供。我知道我可以将此字符串拆分为文件夹名称并递归搜索必要的文件夹,但是否有更优化的方法可以将字符串路径转换为文件夹实例或文件夹 ID?

我使用的是最新的 EWS 2.0 程序集。这些程序集是否提供任何帮助,或者我是否坚持手动递归?

最佳答案

您可以像本例一样使用扩展属性

private string GetFolderPath(ExchangeService service, FolderId folderId) 
{
var folderPathExtendedProp = new ExtendedPropertyDefinition(26293, MapiPropertyType.String);
var folderPropSet = new PropertySet(BasePropertySet.FirstClassProperties) { folderPathExtendedProp };
var folder = Folder.Bind(service, folderId, folderPropSet);

string path = null;
folder.TryGetProperty(folderPathExtendedProp, out path);

return path?.Replace("\ufffe", "\\");
}

来源:https://social.msdn.microsoft.com/Forums/en-US/e5d07492-f8a3-4db5-b137-46e920ab3dde/exchange-ews-managed-getting-full-path-for-a-folder?forum=exchangesvrdevelopment

关于c# - 使用 EWS 按路径获取 Exchange 文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13251684/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com