2

我正在尝试使用新属性更新现有电子邮件,但无法使其正常工作..我正在通过添加带有时间戳字符串的自定义属性来对其进行测试..

当我在运行后获取项目时,我根本看不到它的任何扩展属性......

这是我试图保存它的方法:

message.Load();
Guid MyPropertySetId = new Guid("{117c7745-5df5-4049-97be-8e2d2d92d566}");
ExtendedPropertyDefinition extendedPropertyDefinition = new ExtendedPropertyDefinition(MyPropertySetId, "JNB", MapiPropertyType.String);
message.SetExtendedProperty(extendedPropertyDefinition, DateTime.Now.AddDays(2).ToString());
message.Update(ConflictResolutionMode.AlwaysOverwrite);

然后当我再次将其拉回时,我正在这样做:

if (item.ExtendedProperties.Count > 0)
{
    // Display the name and value of the extended property.
    foreach (ExtendedProperty extendedProperty in item.ExtendedProperties)
    {
        if (extendedProperty.PropertyDefinition.Name == "ccpUniqueID")
        {
            messageAlreadyLogged = AccountMessageManager.HasMessageAlreadyBeenSaved(extendedProperty.Value.ToString());
        }

    }
}

只是没有任何扩展属性....

4

1 回答 1

2

Exchange 只会返回您告诉它返回的扩展属性,因此在您的情况下,您需要将该属性添加到属性集,然后使用 Load 将其加载回来(默认情况下不会发生)例如

        Guid MyPropertySetId = new Guid("{117c7745-5df5-4049-97be-8e2d2d92d566}");
        ExtendedPropertyDefinition extendedPropertyDefinition = new ExtendedPropertyDefinition(MyPropertySetId, "JNB", MapiPropertyType.String);
        PropertySet psPropSet = new PropertySet(BasePropertySet.FirstClassProperties){extendedPropertyDefinition};
        message.Load(psPropSet);
于 2017-05-17T01:53:02.960 回答