我试图在不使用EWS相关方法的情况下,在Outlook VSTO加载项的上下文中将以下代码转换为C#。这有可能吗?
$contact = new EWSType_ItemType();
// Build the extended property and set it on the item.
$property = new EWSType_ExtendedPropertyType();
$property->ExtendedFieldURI = new EWSType_PathToExtendedFieldType();
$property->ExtendedFieldURI->PropertyName = 'MyProperty';
$property->ExtendedFieldURI->PropertyType = EWSType_MapiPropertyTypeType::STRING;
$property->Value = "MyValue";
$contact->ExtendedProperty = $property;
// Build the set item field object and set the item on it.
$field = new EWSType_SetItemFieldType();
$field->ExtendedFieldURI = new EWSType_PathToExtendedFieldType();
$field->ExtendedFieldURI->PropertyName = 'MyProperty';
$field->ExtendedFieldURI->PropertySetId = '00000000-0000-0000-B000-000000000041';
$field->ExtendedFieldURI->PropertyType = EWSType_MapiPropertyTypeType::STRING;
$field->Contact = $contact;
$change->Updates->SetItemField[] = $field;
$request->ItemChanges[] = $change;
我相信使用EWS可以使用SetExtendedProperty方法,但是我正在VSTO加载项项目中工作,并且不想连接到EWS。到目前为止,我了解我可以使用setProperty方法:
appointmentItem.PropertyAccessor.SetProperty(http://schemas.microsoft.com/mapi/string/{00000000-0000-0000-B000-000000000041}/MyProperty/, "MyValue");
但是生成的属性略有不同,这似乎是由于$ field包含一个名为contact的属性,该属性包含一个子属性。
任何帮助将不胜感激。