public static void SetSingleSelectFromMultiSelectProperty(this IObjVerEx obj, int singleselect_property, int multiselect_property) { Vault vault = obj.objVerEx.Vault; if (!obj.objVerEx.HasProperty(multiselect_property)) { throw new Exception("Multi-select property not found."); } if (!obj.objVerEx.HasProperty(singleselect_property)) { throw new Exception("Single-select property not found."); } PropertyDefAdmin mpd = vault.PropertyDefOperations.GetPropertyDefAdmin(multiselect_property); if (mpd == null) { throw new Exception("Multi-select property not found."); } if (!mpd.PropertyDef.BasedOnValueList) { throw new Exception("Invalid multi-select property parameter."); } PropertyDefAdmin spd = vault.PropertyDefOperations.GetPropertyDefAdmin(singleselect_property); if (spd == null) { throw new Exception("Single-select property not found."); } if (!spd.PropertyDef.BasedOnValueList) { throw new Exception("Invalid single-select property parameter."); } if (spd.PropertyDef.ValueList != mpd.PropertyDef.ValueList) { throw new Exception("Target property is not based on the same multi-select value with the Source."); } Lookups mvalues = obj.objVerEx.GetProperty(multiselect_property).TypedValue.GetValueAsLookups(); IEnumerator m_enumerator = mvalues.GetEnumerator(); m_enumerator.MoveNext(); Lookup first_mvalue = m_enumerator.Current as Lookup; obj.objVerEx.SetProperty(singleselect_property, MFDataType.MFDatatypeLookup, first_mvalue?.Item); }