exchangewebservicesewsjavaapi

EWS UserConfiguration class to EWS-JS API


I need to know if any of the EWS-JS API(e.g https://github.com/gautamsi/ews-javascript-api) supports EWS UserConfiguration object and its Update method to update OWA Signature.

Here is EWS+ PowerShell code, which I need to convert to EWS JS API, and execute from Node.js code:

$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()

Solution

  • disclaimer: I am author of the lib. I was also approached by Laeeq privately on email. posting my answer for community benefit. code block uses 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");
                });
            }
        }
    });