Example #1
0
        /// <summary>
        /// Utility to augment the label set on a preexisting array node in an IContactProperties.
        /// </summary>
        /// <param name="contact">The IContactProperties where the labels are to be set.</param>
        /// <param name="arrayNode">The array node to apply the labels to.</param>
        /// <param name="labels">The labels to add to the array node.</param>
        /// <returns>HRESULT.</returns>
        /// <remarks>
        /// This is a thin wrapper over the COM IContactProperties::SetLabels to make it more easily consumable
        /// in .Net.  Behavior and returned error codes should be similar to the native version.
        /// </remarks>
        public static HRESULT SetLabels(INativeContactProperties contact, string arrayNode, ICollection<string> labels)
        {
            Verify.IsNotNull(contact, "contact");

            HRESULT hr = HRESULT.S_OK;

            using (MarshalableLabelCollection marshalable = new MarshalableLabelCollection(labels))
            {
                hr = contact.SetLabels(arrayNode, ContactValue.CGD_DEFAULT, marshalable.Count, marshalable.MarshaledLabels);
            }

            return hr;
        }
Example #2
0
		public static HRESULT GetPropertyCollection(INativeContactProperties contact, string collection, string[] labels, bool anyLabelMatches, out IContactPropertyCollection propertyCollection)
        {
            propertyCollection = null;
            Verify.IsNotNull(contact, "contact");

            uint fAnyLabelMatches = anyLabelMatches ? Win32Value.TRUE : Win32Value.FALSE;

            using (MarshalableLabelCollection mlc = new MarshalableLabelCollection(labels))
            {
                return contact.GetPropertyCollection(out propertyCollection, ContactValue.CGD_DEFAULT, collection, mlc.Count, mlc.MarshaledLabels, fAnyLabelMatches);
            }
        }