Question

My VSTO add-in creates a view with enabled in-cell editing. When this view is applied to shared folder in-cell editing doesn't work. Add-in generated view works in folders that belong to my Exchange account. When I create similar view from the Outlook UI, in-cell editing works fine in the shared folder.

To create the view I use the following code:

Outlook.View newView = Application.ActiveExplorer().CurrentFolder.Views.Add("Test", Outlook.OlViewType.olTableView, Outlook.OlViewSaveOption.olViewSaveOptionAllFoldersOfType);
newView.XML = 
@"<?xml version=""1.0""?>
<view type=""table"">
    <viewname>SharedInboxFromScratch2</viewname>
    <incelledit>1</incelledit>
    <column>
        <heading>Subject</heading>
        <prop>urn:schemas:httpmail:subject</prop>
        <type>string</type>
        <editable>0</editable>
    </column>
    <column>
        <type>string</type>
        <heading>Responsible</heading>
        <prop>http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/Responsible</prop>
        <editable>1</editable>
    </column>
</view>";
newView.Save();

When I put focus to a cell with Responsible column and press F2 it enters edit mode, I can type new value, but when I click Enter new value disappears and the initial cell value is back.

The question is how to make in-cell editing work for the shared folders within add-in generated views?

I have tried applying the view to one folder or to all folders - no effect. Folder is shared using right click - properties - permissions - add. I have owner permissions.

Was it helpful?

Solution

To solve the problem I have added user defined property that represents my custom field to the shared folder:

folder.UserDefinedProperties.Add("Responsible", OlUserPropertyType.olText);

OTHER TIPS

It is also possible to add user defined property to each item in the folder.

foreach (var item in folder.Items)
{
    if(item is Microsoft.Office.Interop.Outlook.MailItem)
        (item as Microsoft.Office.Interop.Outlook.MailItem).UserProperties.Add("Responsible", OlUserPropertyType.olText);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top