internal RowEntry ToRowEntry(StoreSession session, MapiProp propertyMappingReference) { PropertyTable.Operation.MapiRowFactory mapiRowFactory = null; switch (base.Operation) { case ModifyTableOperationType.Add: mapiRowFactory = new PropertyTable.Operation.MapiRowFactory(RowEntry.Add); break; case ModifyTableOperationType.Modify: mapiRowFactory = new PropertyTable.Operation.MapiRowFactory(RowEntry.Modify); break; case ModifyTableOperationType.Remove: mapiRowFactory = new PropertyTable.Operation.MapiRowFactory(RowEntry.Remove); break; } ICollection <PropTag> collection = PropertyTagCache.Cache.PropTagsFromPropertyDefinitions(propertyMappingReference, session, from propValue in base.Properties select(NativeStorePropertyDefinition) propValue.Property); PropValue[] array = new PropValue[base.Properties.Length]; int num = 0; foreach (PropTag propTag in collection) { array[num] = MapiPropertyBag.GetPropValueFromValue(session, session.ExTimeZone, propTag, base.Properties[num].Value); num++; } return(mapiRowFactory(array)); }
internal static PropValue[] MapiPropValuesFromXsoProperties(StoreSession storeSession, MapiProp mapiProp, PropertyDefinition[] propertyDefinitions, object[] propertyValues) { PropValue[] array = new PropValue[propertyValues.Length]; ICollection <PropTag> collection = PropertyTagCache.Cache.PropTagsFromPropertyDefinitions <PropertyDefinition>(mapiProp, storeSession, false, propertyDefinitions); int num = 0; foreach (PropTag propTag in collection) { array[num] = MapiPropertyBag.GetPropValueFromValue(storeSession, storeSession.ExTimeZone, propTag, propertyValues[num]); num++; } return(array); }
private static AdrEntry GetAdrEntry(StoreSession session, ExTimeZone timeZone, RuleAction.ForwardActionBase.ActionRecipient recipient) { Util.ThrowOnNullArgument(recipient, "recipient"); ICollection <PropTag> collection = PropertyTagCache.Cache.PropTagsFromPropertyDefinitions(session.Mailbox.MapiStore, session, recipient.PropertyDefinitions); PropValue[] array = new PropValue[recipient.PropertyDefinitions.Count]; int num = 0; foreach (PropTag propTag in collection) { array[num] = MapiPropertyBag.GetPropValueFromValue(session, timeZone, propTag, recipient.PropertyValues[num]); num++; } return(new AdrEntry(array)); }
private static IEnumerable <KeyValuePair <string, object> > PropValuesToAttributeNameValues(IEnumerable <PropValue> propValues) { foreach (PropValue propValue in propValues) { PropValue propValue2 = propValue; XmlAttributePropertyDefinition xmlAttrPropDef = propValue2.Property as XmlAttributePropertyDefinition; if (xmlAttrPropDef != null) { string xmlAttributeName = xmlAttrPropDef.XmlAttributeName; PropValue propValue3 = propValue; yield return(new KeyValuePair <string, object>(xmlAttributeName, propValue3.Value)); } } yield break; }
protected PropValue[] FromMapiPropValueToXsoPropValue(PropValue[] propValues) { PropTag[] array = new PropTag[propValues.Length]; for (int i = 0; i < propValues.Length; i++) { array[i] = propValues[i].PropTag; } NativeStorePropertyDefinition[] array2 = PropertyTagCache.Cache.PropertyDefinitionsFromPropTags(NativeStorePropertyDefinition.TypeCheckingFlag.DisableTypeCheck, this.MapiFolder, this.Session, array); PropValue[] array3 = new PropValue[propValues.Length]; for (int j = 0; j < array2.Length; j++) { if (array2[j] == null) { throw new NotSupportedException(string.Format("The property tag cannot be resolved to a property definition. PropertyTag = {0}", array[j])); } object valueFromPropValue = MapiPropertyBag.GetValueFromPropValue(this.Session, CoreObject.GetPersistablePropertyBag(this.folder).ExTimeZone, array2[j], propValues[j]); array3[j] = new PropValue(array2[j], valueFromPropValue); } return(array3); }
private static void WriteRecipient(BinaryWriter writer, BlobRecipient recipient) { List <PropValue> list = new List <PropValue>(recipient.PropertyValues.Count); foreach (PropValue item in PropValue.ConvertEnumerator <PropertyDefinition>(recipient.PropertyValues)) { if (!PropertyError.IsPropertyError(item.Value) && !((PropTag)((PropertyTagPropertyDefinition)item.Property).PropertyTag).IsNamedProperty()) { list.Add(item); } } uint count = (uint)list.Count; uint value = 0U; writer.Write(count); writer.Write(value); foreach (PropValue propValue in list) { PropertyTagPropertyDefinition propertyTagPropertyDefinition = (PropertyTagPropertyDefinition)propValue.Property; object value2 = ExTimeZoneHelperForMigrationOnly.ToUtcIfDateTime(propValue.Value); BlobRecipientParser.WritePropValue(writer, (PropTag)propertyTagPropertyDefinition.PropertyTag, value2); } }
internal static object GetValueFromPropValue(StoreSession storeSession, ExTimeZone exTimeZone, StorePropertyDefinition propertyDefinition, PropValue propertyValue) { if (propertyValue.IsError()) { int num = propertyValue.GetErrorValue(); if (num == -2147220732 && (propertyDefinition.SpecifiedWith == PropertyTypeSpecifier.GuidId || propertyDefinition.SpecifiedWith == PropertyTypeSpecifier.GuidString)) { num = -2147221233; } return(MapiPropertyBag.CreatePropertyError(num, propertyDefinition)); } PropType propType = propertyValue.PropTag.ValueType(); if (propType == PropType.Restriction) { if (storeSession == null) { throw new NotSupportedException("PT_RESTRICTION is not supported when we do not have a session. This very likely is an attachment."); } return(FilterRestrictionConverter.CreateFilter(storeSession, storeSession.Mailbox.MapiStore, (Restriction)propertyValue.Value, false)); } else { if (propertyValue.Value == null) { return(MapiPropertyBag.CreatePropertyError(-2147221233, propertyDefinition)); } if (propType == PropType.Actions) { if (storeSession == null) { throw new NotSupportedException("RuleAction type not supported without a session."); } RuleAction[] array = (RuleAction[])propertyValue.Value; RuleAction[] array2 = new RuleAction[array.Length]; for (int i = 0; i < array2.Length; i++) { array2[i] = RuleActionConverter.ConvertRuleAction(storeSession, exTimeZone, array[i]); } return(array2); } else if (propType == PropType.SysTime) { DateTime dateTime = (DateTime)propertyValue.Value; if (ExDateTime.IsValidDateTime(dateTime)) { return(new ExDateTime(exTimeZone, dateTime)); } return(MapiPropertyBag.CreatePropertyError(-2147221221, propertyDefinition)); } else { if (propType == PropType.SysTimeArray) { DateTime[] array3 = (DateTime[])propertyValue.Value; foreach (DateTime dateTime2 in array3) { if (!ExDateTime.IsValidDateTime(dateTime2)) { return(MapiPropertyBag.CreatePropertyError(-2147221221, propertyDefinition)); } } return(ExTimeZoneHelperForMigrationOnly.ToExDateTimeArray(exTimeZone, array3)); } return(propertyValue.Value); } } }
internal void ImportDeletes(DeleteItemFlags deleteItemFlags, byte[][] sourceKeys) { this.CheckDisposed(null); Util.ThrowOnNullArgument(sourceKeys, "sourceKeys"); ImportDeletionFlags importDeletionFlags = ((deleteItemFlags & DeleteItemFlags.HardDelete) == DeleteItemFlags.HardDelete) ? ImportDeletionFlags.HardDelete : ImportDeletionFlags.None; PropValue[] array = new PropValue[sourceKeys.Length]; for (int i = 0; i < sourceKeys.Length; i++) { array[i] = new PropValue(PropTag.SourceKey, sourceKeys[i]); } StoreSession session = this.Session; bool flag = false; try { if (session != null) { session.BeginMapiCall(); session.BeginServerHealthCall(); flag = true; } if (StorageGlobals.MapiTestHookBeforeCall != null) { StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod()); } this.MapiImportDeletes(importDeletionFlags, array); } catch (MapiPermanentException ex) { throw StorageGlobals.TranslateMapiException(ServerStrings.CannotImportDeletion, ex, session, this, "{0}. MapiException = {1}.", new object[] { string.Format("Import of object deletions failed", new object[0]), ex }); } catch (MapiRetryableException ex2) { throw StorageGlobals.TranslateMapiException(ServerStrings.CannotImportDeletion, ex2, session, this, "{0}. MapiException = {1}.", new object[] { string.Format("Import of object deletions failed", new object[0]), ex2 }); } finally { try { if (session != null) { session.EndMapiCall(); if (flag) { session.EndServerHealthCall(); } } } finally { if (StorageGlobals.MapiTestHookAfterCall != null) { StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod()); } } } }