如何在使用 DocumentItem 时在 Outlook 中添加自定义列
How to add custom column in outlook while using DocumentItem
我正在使用 C#
.
开发 VSTO 插件
在这里,我已经将一个文件从我的 PC 拖到 outlook 文件夹中。如图所示,它显示在 outlook 中。
现在我想在该文件夹中添加 一列。
我已经对文件夹中的 add 自定义列做了一些代码。它将显示在图片中。列名是 ABCDEFGHI
.
我想更新 ABCD.pdf
文件的值 属性。
根据展望 ABCD.pdf
是 DocumentItem
。我想为该文件添加我的自定义 属性,以显示在视图中。
这是我的示例代码。
UserProperties objUserProperties = objItem.UserProperties;
UserProperty objUserProperty = objUserProperties.Add("ABCDEFGHI", OlUserPropertyType.olText);
objt.Value = "YYYY";
这会给我一个错误。
错误:
如果您查看 MSDN 中的 UserProperties.Add 方法说明,您可以看到以下说明:
You cannot add custom properties to Office document items such as Word, Excel, or PowerPoint files. You will receive an error when you try to programmatically add a user-defined field to a DocumentItem object.
相反,我建议创建任何 Outlook 项目并将文档附加到它。按照这种方式,您将能够根据需要通过添加用户属性来自定义视图。
我正在使用 C#
.
在这里,我已经将一个文件从我的 PC 拖到 outlook 文件夹中。如图所示,它显示在 outlook 中。
现在我想在该文件夹中添加 一列。
我已经对文件夹中的 add 自定义列做了一些代码。它将显示在图片中。列名是 ABCDEFGHI
.
我想更新 ABCD.pdf
文件的值 属性。
根据展望 ABCD.pdf
是 DocumentItem
。我想为该文件添加我的自定义 属性,以显示在视图中。
这是我的示例代码。
UserProperties objUserProperties = objItem.UserProperties;
UserProperty objUserProperty = objUserProperties.Add("ABCDEFGHI", OlUserPropertyType.olText);
objt.Value = "YYYY";
这会给我一个错误。
错误:
如果您查看 MSDN 中的 UserProperties.Add 方法说明,您可以看到以下说明:
You cannot add custom properties to Office document items such as Word, Excel, or PowerPoint files. You will receive an error when you try to programmatically add a user-defined field to a DocumentItem object.
相反,我建议创建任何 Outlook 项目并将文档附加到它。按照这种方式,您将能够根据需要通过添加用户属性来自定义视图。