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);

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,618 questions
C#
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.
10,266 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,187 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Noah Ma-MSFT 610 Reputation points Microsoft Vendor
    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