internal NativeStorePropertyDefinition[] InternalPropertyDefinitionsFromPropTags(NativeStorePropertyDefinition.TypeCheckingFlag propertyTypeCheckingFlag, MapiProp mapiProp, StoreSession storeSession, PropTag[] propTags, out int resolvedPropertyCount) { EnumValidator.ThrowIfInvalid <NativeStorePropertyDefinition.TypeCheckingFlag>(propertyTypeCheckingFlag, "propertyTypeCheckingFlag"); resolvedPropertyCount = 0; NativeStorePropertyDefinition[] array = new NativeStorePropertyDefinition[propTags.Length]; List <PropertyTagCache.NamedPropertyToResolve> list = null; PropTag[] array2 = null; for (int i = 0; i < propTags.Length; i++) { PropTag propTag = propTags[i]; if (!PropertyTagCache.TryFixPropTagWithErrorType(storeSession, mapiProp, ref array2, ref propTag)) { ExTraceGlobals.PropertyMappingTracer.TraceError <PropTag>((long)storeSession.GetHashCode(), "Failed to infer the property type for PropertyTag {0:X}", propTag); } else { PropertyTagCache.ChangeStringPropTagTypeToUnicode(ref propTag); int num = propTag.Id(); if (num < 32768) { NativeStorePropertyDefinition nativeStorePropertyDefinition = PropertyTagPropertyDefinition.InternalCreateCustom(string.Empty, propTag, PropertyFlags.None, propertyTypeCheckingFlag); array[i] = nativeStorePropertyDefinition; if (nativeStorePropertyDefinition != null) { resolvedPropertyCount++; } } else { if (list == null) { list = new List <PropertyTagCache.NamedPropertyToResolve>(); } list.Add(new PropertyTagCache.NamedPropertyToResolve((ushort)num, propTag.ValueType(), i)); } } } if (list != null) { NamedProp[] namedPropsFromIds = NamedPropConverter.GetNamedPropsFromIds(storeSession, mapiProp, from namedPropertyToResolve in list select namedPropertyToResolve.PropId); int num2 = 0; foreach (PropertyTagCache.NamedPropertyToResolve namedPropertyToResolve2 in list) { NativeStorePropertyDefinition propDefByMapiNamedProp = PropertyTagCache.GetPropDefByMapiNamedProp(namedPropsFromIds[num2++], namedPropertyToResolve2.PropType, propertyTypeCheckingFlag); array[namedPropertyToResolve2.Index] = propDefByMapiNamedProp; if (propDefByMapiNamedProp != null) { resolvedPropertyCount++; } else { ExTraceGlobals.PropertyMappingTracer.TraceDebug <ushort, PropType>((long)storeSession.GetHashCode(), "Failed to resolve a named property from PropertyId {0:X} [{1:X}]", namedPropertyToResolve2.PropId, namedPropertyToResolve2.PropType); } } } return(array); }
internal ICollection <PropValue> GetAllProperties() { PropValue[] mapiPropValues = null; StoreSession storeSession = this.StoreSession; bool flag = false; try { if (storeSession != null) { storeSession.BeginMapiCall(); storeSession.BeginServerHealthCall(); flag = true; } if (StorageGlobals.MapiTestHookBeforeCall != null) { StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod()); } mapiPropValues = this.mapiProp.GetAllProps(); } catch (MapiPermanentException ex) { throw StorageGlobals.TranslateMapiException(ServerStrings.ExGetPropsFailed, ex, storeSession, this, "{0}. MapiException = {1}.", new object[] { string.Format("MapiPropertyBag::GetAllProperties. MapiProp = {0}.", this.MapiProp), ex }); } catch (MapiRetryableException ex2) { throw StorageGlobals.TranslateMapiException(ServerStrings.ExGetPropsFailed, ex2, storeSession, this, "{0}. MapiException = {1}.", new object[] { string.Format("MapiPropertyBag::GetAllProperties. MapiProp = {0}.", this.MapiProp), ex2 }); } finally { try { if (storeSession != null) { storeSession.EndMapiCall(); if (flag) { storeSession.EndServerHealthCall(); } } } finally { if (StorageGlobals.MapiTestHookAfterCall != null) { StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod()); } } } NativeStorePropertyDefinition[] array; PropTag[] allPropTags; object[] array2; PropertyTagCache.ResolveAndFilterPropertyValues(NativeStorePropertyDefinition.TypeCheckingFlag.DoNotCreateInvalidType, this.storeSession, this.mapiProp, this.exTimeZone, mapiPropValues, out array, out allPropTags, out array2); this.RetryBigProperties(array, allPropTags, array2); return(new ComputedElementCollection <NativeStorePropertyDefinition, object, PropValue>(new Func <NativeStorePropertyDefinition, object, PropValue>(PropValue.CreatePropValue <NativeStorePropertyDefinition>), array, array2, array2.Length)); }
private static Notification CreateNotification(MapiNotification notification) { Notification result; if (notification.NotificationType == AdviseFlags.NewMail) { MapiNewMailNotification mapiNewMailNotification = notification as MapiNewMailNotification; result = new NewMailNotification(StoreObjectId.FromProviderSpecificId(mapiNewMailNotification.EntryId, ObjectClass.GetObjectType(mapiNewMailNotification.MessageClass)), StoreObjectId.FromProviderSpecificId(mapiNewMailNotification.ParentId, StoreObjectType.Folder), mapiNewMailNotification.MessageClass, (MessageFlags)mapiNewMailNotification.MessageFlags); } else if (notification.NotificationType == AdviseFlags.SearchComplete) { result = new ObjectNotification(null, null, null, null, (NotificationObjectType)0, null, NotificationType.SearchComplete); } else if (notification.NotificationType == AdviseFlags.ConnectionDropped) { MapiConnectionDroppedNotification mapiConnectionDroppedNotification = notification as MapiConnectionDroppedNotification; result = new ConnectionDroppedNotification(mapiConnectionDroppedNotification.ServerDN, mapiConnectionDroppedNotification.UserDN, mapiConnectionDroppedNotification.TickDeath); } else { MapiObjectNotification mapiObjectNotification = notification as MapiObjectNotification; if (mapiObjectNotification == null) { throw new InvalidOperationException(ServerStrings.ExNotSupportedNotificationType((uint)notification.NotificationType)); } AdviseFlags notificationType = notification.NotificationType; NotificationType type; if (notificationType <= AdviseFlags.ObjectDeleted) { if (notificationType == AdviseFlags.ObjectCreated) { type = NotificationType.Created; goto IL_10A; } if (notificationType == AdviseFlags.ObjectDeleted) { type = NotificationType.Deleted; goto IL_10A; } } else { if (notificationType == AdviseFlags.ObjectModified) { type = NotificationType.Modified; goto IL_10A; } if (notificationType == AdviseFlags.ObjectMoved) { type = NotificationType.Moved; goto IL_10A; } if (notificationType == AdviseFlags.ObjectCopied) { type = NotificationType.Copied; goto IL_10A; } } throw new InvalidOperationException(ServerStrings.ExNotSupportedNotificationType((uint)notification.NotificationType)); IL_10A: UnresolvedPropertyDefinition[] propertyDefinitions; if (mapiObjectNotification.Tags != null) { propertyDefinitions = PropertyTagCache.UnresolvedPropertyDefinitionsFromPropTags(mapiObjectNotification.Tags); } else { propertyDefinitions = Array <UnresolvedPropertyDefinition> .Empty; } result = new ObjectNotification((mapiObjectNotification.EntryId == null) ? null : StoreObjectId.FromProviderSpecificId(mapiObjectNotification.EntryId, StoreObjectType.Unknown), (mapiObjectNotification.ParentId == null) ? null : StoreObjectId.FromProviderSpecificId(mapiObjectNotification.ParentId, StoreObjectType.Folder), (mapiObjectNotification.OldId == null) ? null : StoreObjectId.FromProviderSpecificId(mapiObjectNotification.OldId, StoreObjectType.Unknown), (mapiObjectNotification.OldParentId == null) ? null : StoreObjectId.FromProviderSpecificId(mapiObjectNotification.OldParentId, StoreObjectType.Folder), (NotificationObjectType)mapiObjectNotification.ObjectType, propertyDefinitions, type); } return(result); }