Update/Set SignatureHTML with ExchangeService for Office 365 Users

Akmal Eldahdouh 0 Reputation points
2024-04-18T23:50:59.3966667+00:00

Hello,

Could you please confirm if the code below is not working? If so, I need guidance on how to change the OWA user signature globally, as we plan to reflect the company branding for all users.

The OWAConfig does not include any key related to user's signature.

Below is the code I'm using.

var cca = ConfidentialClientApplicationBuilder

.Create(clientId)

.WithClientSecret(clientSecret)

.WithTenantId(tenantId)

.Build();

var ewsScopes = new string[] { "https://outlook.office.com/EWS.AccessAsUser.All" };

var authResult = await cca.AcquireTokenForClient(ewsScopes).ExecuteAsync();

var ewsClient = new ExchangeService();

ewsClient.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");

ewsClient.Credentials = new OAuthCredentials(authResult.AccessToken);

ewsClient.ImpersonatedUserId =

new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "email@domain");

ewsClient.HttpHeaders.Add("X-AnchorMailbox", "email@domain");

var OWAConfig = UserConfiguration.Bind(ewsClient, "OWA.UserOptions", WellKnownFolderName.Root,

UserConfigurationProperties.All);

Exchange Online
Exchange Online
A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
Microsoft Security | Microsoft Graph
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-04-19T07:03:17.7+00:00

    Hi @Akmal Eldahdouh ,

    Welcome to Microsoft Q&A! Please understand that we cannot provide further help about code/script. However, if you want to set a signature in OWA for all users, you could try to do it in another way as the following steps:

    1. You can sign in to EAC using an Exchange Online admin account.
    2. Go to Mail Flow > Rules. Click Add a rule and select Apply disclaimers. A screenshot of a computer

    For more details you can refer to the links below:

    Create organization-wide signatures and disclaimers - Microsoft 365 admin | Microsoft Learn


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.