C#EWS更改扩展属性

时间:2017-04-24 17:08:08

标签: c# exchange-server exchangewebservices mapi

如果在使用之前需要更改数据库中的表,我想知道是否更改了EWS扩展属性的数据类型?

目前我只是宣布自定义扩展属性并开始使用它,但现在我想将其从MapiPropertyType.Integer更改为MapiPropertyType.Long

以下是我当前的示例属性定义:

static class MyAppSchema {
   private static readonly Guid property_set = Guid.Parse("{my guid value}");
   public static ExtendedPropertyDefinition ItemId = new ExtendedPropertyDefinition(
       propertySetId: property_set,
       name: "ItemId",
       mapiType: MapiPropertyType.Integer
   );
}

我目前正在使用它:

  • item.SetProperty<int>(MyAppSchema.ItemId, item_from_another_db.ItemId);

我想开始使用以下属性定义:

static class MyAppSchema {
   private static readonly Guid property_set = Guid.Parse("{my guid value}");
   public static ExtendedPropertyDefinition ItemId = new ExtendedPropertyDefinition(
       propertySetId: property_set,
       name: "ItemId",
       mapiType: MapiPropertyType.Long
   );
}

我开始像这样使用它:

  • item.SetProperty<long>(MyAppSchema.ItemId, item_from_another_db.ItemId);

相关邮箱中存在现有数据,我仍然希望能够使用SearchFilter.IsEqualTo等搜索过滤器。我担心如果我改变数据类型,我将在以后为自己设置问题。

1 个答案:

答案 0 :(得分:2)

无法做到这一点 - 一旦您在特定邮箱中使用自定义属性,您将永远陷入该属性及其定义。如果需要其他类型,则需要使用其他名称创建属性。