EWS UserConfiguration类到EWS-JS API

时间:2017-08-30 21:12:22

标签: exchangewebservices ewsjavaapi

我需要知道是否有任何EWS-JS API(例如https://github.com/gautamsi/ews-javascript-api)支持EWS UserConfiguration对象及其Update方法来更新OWA签名。

这是EWS + PowerShell代码,我需要将其转换为EWS JS API,并从Node.js代码执行:

$owaUserOptions= [Microsoft.Exchange.WebServices.Data.UserConfiguration]::Bind( $exService,"OWA.UserOptions",
[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Root, 
[Microsoft.Exchange.WebServices.Data.UserConfigurationProperties]::All);

if (-not $owaUserOptions.Dictionary.ContainsKey("signaturehtml")) {
        if (-not [System.String]::IsNullOrEmpty($HtmlSignature)) {
            $owaUserOptions.Dictionary.Add("signaturehtml",$HtmlSignature)
        }
    }

$owaUserOptions.Update()

1 个答案:

答案 0 :(得分:0)

免责声明:我是lib的作者。 Laeeq私下也通过电子邮件与我联系。发布我的社区福利答案。代码块使用typescript。

var HtmlSignature = "signature html";
UserConfiguration.Bind(service,"OWA.UserOptions", WellKnownFolderName.Root, UserConfigurationProperties.All)
.then(owaUserOptions =>{
    if(!owaUserOptions.Dictionary.ContainsKey("signaturehtml")){
        if(StringHelper.IsNullOrEmpty(HtmlSignature)){
            owaUserOptions.Dictionary.Add("signaturehtml",HtmlSignature)
            owaUserOptions.Update().then(()=>{
                console.log("update complete");
            });
        }
    }
});