In the last days, I struggled with different challenges on the mailboxes. Therefore, I had to change different attributes on multiple mailboxes. A bulk-update via advanced find is only possible on the server profile.
Therefore, I decided to create a small console application to set the attributes and test the mailbox again.
First I queried the mailboxes, that I wanted change.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
var query = new QueryExpression("mailbox") { ColumnSet = new ColumnSet("emailaddress"), Criteria = new FilterExpression { FilterOperator = LogicalOperator.And, Conditions = { new ConditionExpression("processanddeleteemails", ConditionOperator.Equal, "0"), new ConditionExpression("emailserverprofile", ConditionOperator.Equal, new Guid("{23C64630-66CC-EB11-BACC-000D3A272DB5}")) } } }; var q = orgService.RetrieveMultiple(query); |
Based on the result, I changed the attributes I had to.
1 2 3 4 5 6 7 |
foreach (var x in q.Entities) { x.Attributes["processanddeleteemails"] = true; x.Attributes["testemailconfigurationscheduled"] = true; orgService.Update(x); } |
Setting the attribute testemailconfigurationscheduled to true during the update leads crm to “Test & Enable the mailbox” again.