public virtual bool UpdateDisplayNameProperties(ICorePropertyBag propertyBag) { bool flag = false; foreach (NativeStorePropertyDefinition propertyDefinition in this.allSourceProperties) { if (propertyBag.IsPropertyDirty(propertyDefinition)) { flag = true; break; } } if (!flag) { return(false); } bool flag2 = false; for (int i = 0; i < this.candidateProperties.Count; i++) { PriorityBasedDisplayNamePropertyRule.CandidateProperty candidateProperty = this.candidateProperties[i]; if (candidateProperty.HasNonEmptyValue(propertyBag)) { string value = null; string value2 = null; candidateProperty.GetValue(propertyBag, out value, out value2); propertyBag.SetProperty(InternalSchema.DisplayNameFirstLast, value); propertyBag.SetProperty(InternalSchema.DisplayNameLastFirst, value2); propertyBag.SetProperty(InternalSchema.DisplayNamePriority, i); flag2 = true; break; } } if (!flag2) { propertyBag.Delete(InternalSchema.DisplayNameFirstLast); propertyBag.Delete(InternalSchema.DisplayNameLastFirst); propertyBag.Delete(InternalSchema.DisplayNamePriority); } return(true); }
internal static void SetOrDeleteProperty(this ICorePropertyBag propertyBag, PropertyDefinition property, object newValue) { if (property == null) { throw new ArgumentNullException("property"); } if (newValue == null || PropertyError.IsPropertyNotFound(newValue)) { propertyBag.Delete(property); return; } propertyBag.SetProperty(property, newValue); }
public NativeStorePropertyDefinition[] SetPropertiesHelper(ICorePropertyBag propertyBag, PropValueData[] pvda) { if (pvda == null || pvda.Length == 0) { return(null); } PropTag[] array = new PropTag[pvda.Length]; for (int i = 0; i < pvda.Length; i++) { array[i] = (PropTag)pvda[i].PropTag; if (base.IsPublicFolderMailbox && array[i] == PropTag.IpmWasteBasketEntryId) { byte[] array2 = pvda[i].Value as byte[]; if (array2 != null) { pvda[i].Value = this.StoreSession.IdConverter.GetLongTermIdFromId(StoreObjectId.FromProviderSpecificId(array2)); } } } NativeStorePropertyDefinition[] result; using (base.RHTracker.Start()) { NativeStorePropertyDefinition[] array3 = this.ConvertPropTagsToDefinitions(array); for (int j = 0; j < pvda.Length; j++) { if (pvda[j].Value == null) { propertyBag.Delete(array3[j]); } else { propertyBag.SetProperty(array3[j], pvda[j].Value); } } result = array3; } return(result); }