使用 PowerShell 或 EWS 为 o365 中的用户获取 UM 语音邮件问候语

Getting to UM voicemail greetings for users in o365 using PowerShell or EWS

希望是一个简单的问题 - 我曾经知道用户何时在 o365 中录制他们对 UM 语音邮件的个人问候语(常规问候语 and/or 长时间缺席问候语),这些使用特殊项目类型存储在他们的 Exchange 收件箱中(即 "IPM.Configuration.Um.CustomGreetings.External")。但是,设置我的测试 o365 设置,配置 UM 等等,在记录我的个人问候语并从收件箱的根目录开始浏览每个项目之后,(大约 900 多个项目 - 里面有很多奇怪的东西)- 我不知道再也看不到这样的东西了。很多日志,activity 项,一些消息,但与问候无关。将所有可以转换为电子邮件类型的内容提取到一个文件夹中,我逐一检查 - 没什么希望。 任何人都知道用户 UM 的自定义问候语(不是自动助理录音 - 那是不同的野兽)在哪里以及如何到达它?
非常感谢。

经过一番折腾后终于成功了。

Ben Lye 的 post Glen Scales 在上面的评论中提供的是让我从 A 到 B 的原因 - 谢谢 Glen。 http://www.onesimplescript.com/2015/07/getting-um-voicemail-greetings-in.html

在相关新闻中,Glen 非常出色的用于 FAI 探索的 PowerShell 插件也非常有帮助,可以为您节省大量时间来增加文件夹相关信息: https://gsexdev.blogspot.com/2018/03/ews-fai-module-for-browsing-and.html

对于那些在使用 EWS 的 .NET 中遇到这个问题的人来说,这里有一个快速精简的代码简介,用于为用户获取标准和扩展的问候录音 - 我花了比它应该更长的时间来解决这个问题,也许这可以为某人节省一些时间:

请注意 运行 针对多个邮箱,您需要为您用于 EWS 功能验证的帐户配置模拟。

        ExchangeService _service;
        _service = new ExchangeService(ExchangeVersion.Exchange2016); // Exchange2013_SP1);
        _service.Credentials = new WebCredentials("user@domain", "myPw");
        _service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");

        //select the user you're fetching greetings for
        _service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "user@domain");

        //get the root folder for the current account
        var oParamList = new List<FolderId> {WellKnownFolderName.Root};
        var oTemp = _service.BindToFolders(oParamList, PropertySet.FirstClassProperties);
        var oRoot = oTemp.First().Folder;

        var oView = new ItemView(50)
        {
            PropertySet = new PropertySet(BasePropertySet.FirstClassProperties),
            Traversal = ItemTraversal.Associated
        };
        SearchFilter oGreetingFilter = new SearchFilter.ContainsSubstring(ItemSchema.ItemClass,
            "IPM.Configuration.Um.CustomGreetings", ContainmentMode.Substring, ComparisonMode.IgnoreCase);
        var oResults = _service.FindItems(oRoot.Id, oGreetingFilter, oView);

        //fetch the binary for the greetings as values 
        var oPropSet = new PropertySet(BasePropertySet.FirstClassProperties);
        var oRoamingBinary = new ExtendedPropertyDefinition(31753, MapiPropertyType.Binary);
        oPropSet.Add(oRoamingBinary);
        _service.LoadPropertiesForItems(oResults, oPropSet);

        var strFileName = "";
        foreach (var oItem in oResults.Items)
        {
            if (oItem.ItemClass.Equals("IPM.Configuration.Um.CustomGreetings.External",
                StringComparison.InvariantCultureIgnoreCase))
                strFileName = "jlindborg_Standard.wav";
            if (oItem.ItemClass.Equals("IPM.Configuration.Um.CustomGreetings.Oof",
                StringComparison.InvariantCultureIgnoreCase))
                strFileName = "jlindborg_Extended.wav";
            File.WriteAllBytes("d:\" + strFileName, (byte[]) oItem.ExtendedProperties.First().Value);
        }
    }