3

We're using Exchange Web Services to set user signature in Outlook Web Access. It works great, we see the signature under Options>Settings and the "Automatically include my signature on messages I send" check box is checked. We also set this programmatically.

However, when the user creates a new e-mail message in OWA the signature does not show up. A work around for this is to go to Options>Setting, uncheck the "Automatically include my signature on messages I send" check box , Save, check the check box again and save.

The code we use to set the signature looks something like this:

Folder rootFolder;
UserConfiguration OWAConfig;
rootFolder = Folder.Bind(service, WellKnownFolderName.Root);
OWAConfig = UserConfiguration.Bind(service, "OWA.UserOptions",rootFolder.ParentFolderId, UserConfigurationProperties.All);

OWAConfig.Dictionary["signaturehtml"] = "Hello World";
OWAConfig.Dictionary["autoaddsignature"] = "True";
OWAConfig.Update();

Any idea how to get around this problem?

PW763
  • 251
  • 1
  • 6
  • 12

1 Answers1

4

I have some old code that does the same thing which is working fine. I have pasted the code below. There are a few minor differences between my code and yours. I am not sure if they make a difference but you may want to try it out. Here is an extract of my code with the differences highlighted with a comment:

private void SetSettingValue(UserConfiguration owaConfig, string propName, object propValue)
{
    if (owaConfig.Dictionary.ContainsKey(propName))
    {
        owaConfig.Dictionary[propName] = propValue;
    }
    else
    {
        // Adds a key if it does not explicitly exist.
        // I am not sure if it makes a difference.
        owaConfig.Dictionary.Add(propName, propValue);
    }
}

public void AddSignature()
{
   // Extract
    UserConfiguration OWAConfig = UserConfiguration.Bind(
        service, 
        "OWA.UserOptions", 
        WellKnownFolderName.Root, // Binding to Root and not Root.ParentFolderId.
        UserConfigurationProperties.Dictionary // Binds to Dictionary and not to All.
        );

    SetSettingValue(OWAConfig, "autoaddsignature", true);
    SetSettingValue(OWAConfig, "signaturehtml", html);

    OWAConfig.Update();
}
Jakob Christensen
  • 14,826
  • 2
  • 51
  • 81
  • Thank you, but the code I've posted is a shorted version of what we use, we do check if the property exist before setting creating or updating it. That part works fine, its the signature refresh in OWA that's a problem. – PW763 Jan 11 '13 at 13:43
  • I that case I am out of ideas. – Jakob Christensen Jan 11 '13 at 14:27
  • Problem was I set the value to "True" should've been true as in boolean. Your code is 100%. – PW763 Jan 14 '13 at 07:29