I put together some information to help with writing code to set retention tags on a folder. The articles at the end will go over how the retention properties are used in code, one has a sample which shows setting the retention tags on a folder using PowerShell and the EWS Managed API and the last is to a Microsoft MVP blog where there is a large quantity of samples which you might be able to leverage.
About: Exchange Web Services (EWS) – Getting started with EWS
EWSEditor has code in it which can set tags on a folder – you can access that functionality by right clicking on a folder (FolderRetentionSettings.cs). You will need the policy GUID from ECP in order to add a tag. Under the Tools menu is a window which will show the policies for a mailbox (UserRetentionTagPolicyTagsForm.cs) and also let you search mailbox to see where a tag is applied. The full source is downloadable.
Here are the related properties:
ExtendedPropertyDefinition Prop_PR_START_DATE_ETC = new
ExtendedPropertyDefinition Prop_PR_POLICY_TAG = new
ExtendedPropertyDefinition Prop_PR_RETENTION_FLAGS = new
ExtendedPropertyDefinition Prop_PR_RETENTION_PERIOD = new
ExtendedPropertyDefinition Prop_PR_RETENTION_DATE = new
Search and Replace Retention tag on Microsoft Exchange 2010 (MRM)
Stamping Retention Policy Tag using EWS Managed API 1.1 from PowerShell(Exchange 2010)
Note: You will need to alter this sample per your needs. Be sure to change out the GUID used with the one for the policy from ECP.
Glean Scales blog – It has a lot of Exchange PowerShell script samples which use the EWS Managed API.