Manupilation of extended properties with exchange 2007 link
PathToExtendedFieldType propertyId = new PathToExtendedFieldType();
propertyId.DistinguishedPropertySetId =
DistinguishedPropertySetType.Appointment;
propertyId.PropertyId = 0x820e;
propertyId.PropertyType = MapiPropertyTypeType.SystemTime;
propertyId.PropertyIdSpecified = true;
propertyId.DistinguishedPropertySetIdSpecified = true;
private static ExtendedPropertyType
CreateExtendedProperty<T>(PathToExtendedFieldType id, IEnumerable<T> values)
{
ExtendedPropertyType result = newExtendedPropertyType();
result.ExtendedFieldURI = id;
result.Item = (values != null) ?
newList<T>(values).ConvertAll<string>(delegate(T input) { return
SerializeValue(input); }).ToArray() : null;
return result;
}
private ExtendedPropertyType
CreateExtendedProperty<T>(PathToExtendedFieldType id, T value) {
ExtendedPropertyType result = newExtendedPropertyType();
result.ExtendedFieldURI = id;
result.Item = SerializeValue(value);
return result;
}
private static string SerializeValue<T>(T value) {
Type type;
TypeConverter converter;
object result;
result = value;
if (result == null) return null;
//Unbox nullable types
type = Nullable.GetUnderlyingType(typeof(T));
if (type != null)
{
converter = new NullableConverter(typeof(T));
result = converter.ConvertTo(value, type);
}
else type = typeof(T);
if (type.IsEnum)
{
result = Convert.ChangeType(result, Enum.GetUnderlyingType(type));
return result.ToString();
}
elseif (type == typeof(DateTime))
{
return XmlConvert.ToString(((DateTime)result).ToUniversalTime(),
XmlDateTimeSerializationMode.Utc);
}
elseif (type == typeof(bool))
{
return ((bool)result) ? "1" : "0";
}
elseif (type == typeof(byte[]))
{
return Convert.ToBase64String((byte[])result);
}
else
{
return string.Format(CultureInfo.InvariantCulture, "{0}", result);
}
}