1

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()
The Hungry Dictator
  • 3,444
  • 5
  • 37
  • 53
Laeeq Qazi
  • 43
  • 1
  • 6
  • Surely the API docs will say? However, you don't clearly say what you want, what you have tried, and what the results were. –  Aug 30 '17 at 21:41
  • 1
    Looks like it does https://github.com/gautamsi/ews-javascript-api/issues/46 – Glen Scales Aug 30 '17 at 23:08
  • Thanks Glen, I would check this. – Laeeq Qazi Aug 31 '17 at 21:47
  • Jdv...I think my question is clear, as I have also provided powershell code, which I want to convert to ews-js api (exchange web services using javascript). I want to set user owa signature using ews-js api.Thanks – Laeeq Qazi Aug 31 '17 at 21:49

1 Answers1

0

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");
            });
        }
    }
});
Gautam Singh
  • 1,028
  • 1
  • 9
  • 13
  • Thanks Guatam. This helps. – Laeeq Qazi Sep 05 '17 at 20:42
  • Gautam, I am getting following error: Unhandled rejection Exception: The array contains at least one null element. at UserConfigurationDictionary.WriteObjectValueToXml (C:\Users\Administrator\node_modules\ews-javascript-api\js\ComplexProperties\UserConfigurationDictionary.js:557:23) at UserConfigurationDictionary.WriteObjectToXml (C:\Users\Administrator\node_modules\ews-javascript-api\js\ComplexProperties\UserConfigurationDictionary.js:503:18) at UserConfigurationDictionary.WriteElementsToXml – Laeeq Qazi Sep 11 '17 at 22:31