Search code examples
c#outlookvstooutlook-addin

How to bind a TextBox on a Formregion to a custom property?


C#, VSTO, Outlook 2016

I've created a Outlook Formregion with a TextBox.
I want to bind the TextBox control to a custom property.

I've found the SetControlItemProperty method:
https://learn.microsoft.com/en-us/office/vba/api/outlook.formregion.setcontrolitemproperty

Is there a similar method in c# and how can I use this method
and where should this method be called?


Solution

  • In case of managed add-ins you need to set the property programmatically. There are no automatic bindings in case of VSTO add-ins.

    You can read a property value at runtime using any standard Outlook mechanisms like UserProperties or CustomProperties and set the Text property of your control programmatically.