/// <summary> /// Gets the property value for a <see cref="_ContactItem">_ContactItem</see> user property. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="contactItem">The contact item.</param> /// <param name="name">The name of the user property.</param> /// <param name="type">The type of the user property.</param> /// <param name="create">if set to <c>false</c> the property will not be created if it doesn't exist.</param> /// <param name="converter">The converter to use to convert the object to.</param> /// <param name="defaultValue">The default value to use if user property not found.</param> /// <returns>User property vlaue or default</returns> public static T GetPropertyValue <T>(this _ContactItem contactItem, string name, OlUserPropertyType type, bool create, Func <object, T> converter, T defaultValue) { using (var userProperties = contactItem.UserProperties.WithComCleanup()) return(GetPropertyValue(userProperties.Resource, name, type, create, converter, defaultValue)); }
/// <summary> /// Sets the user property value. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="contactItem">The contact item.</param> /// <param name="name">The name of the user property to set.</param> /// <param name="type">The type of the user property.</param> /// <param name="value">The value to set.</param> /// <param name="addToFolder">if set to <c>true</c> add to containing folder. Enables search/display column for user property.</param> public static void SetPropertyValue <T>(this _ContactItem contactItem, string name, OlUserPropertyType type, T value, bool addToFolder) { using (var userProperties = contactItem.UserProperties.WithComCleanup()) SetPropertyValue(userProperties.Resource, name, type, value, addToFolder); }