/// <summary> /// Get the CRM id for this item, if known, else the empty string. /// </summary> /// <param name="olItem">The Outlook item under consideration.</param> /// <returns>the CRM id for this item, if known, else null.</returns> public static CrmId GetCrmId(this Outlook.AppointmentItem olItem) { string result; if (olItem.IsValid()) { try { Outlook.UserProperty property = olItem.UserProperties[SyncStateManager.CrmIdPropertyName]; if (property == null) { /* #6661: fail over to legacy property name if current property * name not found */ property = olItem.UserProperties[SyncStateManager.LegacyCrmIdPropertyName]; } if (property != null && !string.IsNullOrEmpty(property.Value)) { result = property.Value; } else { result = olItem.GetVCalId(); } } catch (COMException) { /* this is bad! It shouldn't be possible to get here, but * it is. */ try { result = olItem.GetVCalId(); } catch (COMException) { result = null; } } } else { result = null; } return(CrmId.Get(result)); }
/// <summary> /// Get the CRM id for this item, if known, else the empty string. /// </summary> /// <param name="olItem">The Outlook item under consideration.</param> /// <returns>the CRM id for this item, if known, else the empty string.</returns> public static CrmId GetCrmId(this Outlook.AppointmentItem olItem) { string result; Outlook.UserProperty property = olItem.UserProperties[SyncStateManager.CrmIdPropertyName]; if (property != null && !string.IsNullOrEmpty(property.Value)) { result = property.Value; } else { result = olItem.GetVCalId(); } return(CrmId.Get(result)); }