Suppose we want to Test & Enable Mailbox of the below user programmatically.
We can see the below notification for the disabled mailbox.
This mailbox is disabled for email processing. For more information, see the alerts.

Below is the sample code –

On running the code, we can see the notification removed and the mailbox for the user enabled successfully.


C# Code –
CrmServiceClient svc = new CrmServiceClient(ConnectionString);
if (svc.IsReady)
{
var mailBox = new Entity("mailbox", new Guid("C88A539A-F493-EC11-B400-000D3A4F37D3"));
// testemailconfigurationscheduled = Indicates if the email configuration test has been scheduled for a mailbox record
mailBox.Attributes["testemailconfigurationscheduled"] = true;
svc.Update(mailBox);
Hope it helps..
2 thoughts on “Sample Code to Test and Enable Mailbox programmatically C# (Dynamics 365/CRM)”