public static string GetSerializedNotificationSubscription(IMailboxSession mailboxSession, IStorePropertyBag propertyBag, IXSOFactory xsoFactory)
        {
            string valueOrDefault = propertyBag.GetValueOrDefault <string>(PushNotificationSubscriptionItemSchema.SerializedNotificationSubscription, null);

            if (string.IsNullOrWhiteSpace(valueOrDefault))
            {
                ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceError(0L, "PushNotificationStorage.GetSerializedNotificationSubscription: A subscription with an empty serialized value was returned by the Enumerator.");
                throw new CannotResolvePropertyException(PushNotificationSubscriptionItemSchema.SerializedNotificationSubscription.Name);
            }
            if (valueOrDefault.Length < 255)
            {
                return(valueOrDefault);
            }
            ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceDebug(0L, "PushNotificationStorage.GetSerializedNotificationSubscription: We need to bind to the item in order to obtain the full serialized notification subscription.");
            VersionedId valueOrDefault2 = propertyBag.GetValueOrDefault <VersionedId>(ItemSchema.Id, null);
            string      result;

            using (IPushNotificationSubscriptionItem pushNotificationSubscriptionItem = xsoFactory.BindToPushNotificationSubscriptionItem(mailboxSession, valueOrDefault2, new PropertyDefinition[]
            {
                PushNotificationSubscriptionItemSchema.SerializedNotificationSubscription
            }))
            {
                string serializedNotificationSubscription = pushNotificationSubscriptionItem.SerializedNotificationSubscription;
                if (string.IsNullOrWhiteSpace(serializedNotificationSubscription))
                {
                    ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceError <VersionedId, string>(0L, "PushNotificationStorage.GetFullSerializedNotificationSubscription: Unable to obtain the full SerializedNotificationSubscription from {0}, partial value: {1}", valueOrDefault2, valueOrDefault);
                    throw new CannotResolvePropertyException(PushNotificationSubscriptionItemSchema.SerializedNotificationSubscription.Name);
                }
                result = serializedNotificationSubscription;
            }
            return(result);
        }
        // Token: 0x060014A1 RID: 5281 RVA: 0x000491C4 File Offset: 0x000473C4
        public int DetermineSortGroupPriority(IStorePropertyBag folder)
        {
            StoreObjectId objectId        = ((VersionedId)folder.TryGetProperty(FolderSchema.Id)).ObjectId;
            int           valueOrDefault  = folder.GetValueOrDefault <int>(FolderSchema.PeopleHubSortGroupPriorityVersion, -1);
            int           num             = folder.GetValueOrDefault <int>(FolderSchema.PeopleHubSortGroupPriority, -1);
            bool          valueOrDefault2 = folder.GetValueOrDefault <bool>(FolderSchema.IsPeopleConnectSyncFolder, false);

            if (valueOrDefault == 2 && num >= 0)
            {
                return(num);
            }
            if (object.Equals(objectId, this.DefaultContactsFolderId))
            {
                num = 2;
            }
            else if (object.Equals(objectId, this.QuickContactsFolderId))
            {
                num = 4;
            }
            else if (valueOrDefault2)
            {
                num = 3;
            }
            else
            {
                num = 10;
            }
            using (IFolder folder2 = this.xsoFactory.BindToFolder(this.session, objectId))
            {
                PeopleFilterGroupPriorityManager.SetSortGroupPriorityOnFolder(folder2, num);
                folder2.Save();
            }
            return(num);
        }
        private PostalAddress GetFromAllPropertiesForConversationViewInternal(IStorePropertyBag propertyBag)
        {
            PostalAddress postalAddress = new PostalAddress
            {
                Street         = propertyBag.GetValueOrDefault <string>(this.Street, null),
                City           = propertyBag.GetValueOrDefault <string>(this.City, null),
                State          = propertyBag.GetValueOrDefault <string>(this.State, null),
                Country        = propertyBag.GetValueOrDefault <string>(this.Country, null),
                PostalCode     = propertyBag.GetValueOrDefault <string>(this.PostalCode, null),
                Latitude       = propertyBag.GetValueOrDefault <double?>(this.Latitude, null),
                Longitude      = propertyBag.GetValueOrDefault <double?>(this.Longitude, null),
                LocationSource = propertyBag.GetValueOrDefault <LocationSource>(this.LocationSource, Microsoft.Exchange.Data.Storage.LocationSource.None),
                LocationUri    = propertyBag.GetValueOrDefault <string>(this.LocationUri, null),
                Type           = this.PostalAddressType
            };

            if (!postalAddress.IsEmpty() && postalAddress.LocationSource == Microsoft.Exchange.Data.Storage.LocationSource.None)
            {
                postalAddress.LocationSource = Microsoft.Exchange.Data.Storage.LocationSource.Contact;
                foreach (NativeStorePropertyDefinition propertyDefinition in PostalAddressProperties.AdditionalProperties)
                {
                    string valueOrDefault = propertyBag.GetValueOrDefault <string>(propertyDefinition, null);
                    if (valueOrDefault != null)
                    {
                        postalAddress.LocationUri = valueOrDefault;
                        break;
                    }
                }
            }
            return(postalAddress);
        }
        private Event GetOccurrenceWithStartAndEnd(IStorePropertyBag propertyBag)
        {
            Event basicSeriesEventData = EventExtensions.GetBasicSeriesEventData(propertyBag, this.Scope);

            basicSeriesEventData.Start = propertyBag.GetValueOrDefault <ExDateTime>(CalendarItemInstanceSchema.StartTime, ExDateTime.MinValue);
            basicSeriesEventData.End   = propertyBag.GetValueOrDefault <ExDateTime>(CalendarItemInstanceSchema.EndTime, ExDateTime.MaxValue);
            return(basicSeriesEventData);
        }
        public static ExTimeZone GetRecurringTimeZoneFromPropertyBag(IStorePropertyBag propertyBag)
        {
            string valueOrDefault = propertyBag.GetValueOrDefault <string>(InternalSchema.TimeZone, null);

            byte[] valueOrDefault2 = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.TimeZoneBlob, null);
            byte[] valueOrDefault3 = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.TimeZoneDefinitionRecurring, null);
            return(TimeZoneHelper.GetTimeZoneFromProperties(valueOrDefault, valueOrDefault2, valueOrDefault3));
        }
Exemple #6
0
        private PushNotificationSubscription CreatePresentationObject(IStorePropertyBag propertyBag, ADUser aduser, MailboxSession mailboxSession)
        {
            VersionedId valueOrDefault  = propertyBag.GetValueOrDefault <VersionedId>(ItemSchema.Id, null);
            string      valueOrDefault2 = propertyBag.GetValueOrDefault <string>(PushNotificationSubscriptionItemSchema.SubscriptionId, null);
            string      serializedNotificationSubscription = PushNotificationStorage.GetSerializedNotificationSubscription(mailboxSession, propertyBag, GetPushNotificationSubscription.xsoFactory);

            base.WriteVerbose(Strings.WriteVerboseSerializedSubscription(serializedNotificationSubscription));
            return(new PushNotificationSubscription(aduser.ObjectId, valueOrDefault, valueOrDefault2, serializedNotificationSubscription));
        }
        internal static Event GetBasicSeriesEventData(IStorePropertyBag propertyBag, IStorageEntitySetScope <IStoreSession> scope)
        {
            VersionedId valueOrDefault  = propertyBag.GetValueOrDefault <VersionedId>(ItemSchema.Id, null);
            Event       @event          = scope.IdConverter.CreateBasicEntity <Event>(valueOrDefault, scope.StoreSession);
            string      valueOrDefault2 = propertyBag.GetValueOrDefault <string>(StoreObjectSchema.ItemClass, null);

            if (!string.IsNullOrEmpty(valueOrDefault2))
            {
                @event.Type = (ObjectClass.IsCalendarItemSeries(valueOrDefault2) ? EventType.SeriesMaster : EventType.Exception);
            }
            @event.StoreId = valueOrDefault;
            return(@event);
        }
        public PostalAddress GetFromAllProperties(IStorePropertyBag propertyBag)
        {
            PostalAddress fromAllPropertiesForConversationViewInternal = this.GetFromAllPropertiesForConversationViewInternal(propertyBag);

            fromAllPropertiesForConversationViewInternal.PostOfficeBox    = propertyBag.GetValueOrDefault <string>(this.PostOfficeBox, null);
            fromAllPropertiesForConversationViewInternal.Accuracy         = propertyBag.GetValueOrDefault <double?>(this.Accuracy, null);
            fromAllPropertiesForConversationViewInternal.Altitude         = propertyBag.GetValueOrDefault <double?>(this.Altitude, null);
            fromAllPropertiesForConversationViewInternal.AltitudeAccuracy = propertyBag.GetValueOrDefault <double?>(this.AltitudeAccuracy, null);
            if (fromAllPropertiesForConversationViewInternal.IsEmpty())
            {
                return(null);
            }
            return(fromAllPropertiesForConversationViewInternal);
        }
        internal static TaskGroupEntryInfo GetTaskGroupEntryInfoFromRow(IStorePropertyBag row)
        {
            VersionedId versionedId = (VersionedId)row.TryGetProperty(ItemSchema.Id);

            byte[] valueOrDefault  = row.GetValueOrDefault <byte[]>(TaskGroupEntrySchema.NodeEntryId, null);
            byte[] valueOrDefault2 = row.GetValueOrDefault <byte[]>(FolderTreeDataSchema.ParentGroupClassId, null);
            string valueOrDefault3 = row.GetValueOrDefault <string>(ItemSchema.Subject, string.Empty);

            byte[] valueOrDefault4 = row.GetValueOrDefault <byte[]>(FolderTreeDataSchema.Ordinal, null);
            row.GetValueOrDefault <byte[]>(TaskGroupEntrySchema.StoreEntryId, null);
            ExDateTime valueOrDefault5 = row.GetValueOrDefault <ExDateTime>(StoreObjectSchema.LastModifiedTime, ExDateTime.MinValue);

            row.GetValueOrDefault <FolderTreeDataType>(FolderTreeDataSchema.Type, FolderTreeDataType.NormalFolder);
            FolderTreeDataFlags valueOrDefault6 = row.GetValueOrDefault <FolderTreeDataFlags>(FolderTreeDataSchema.FolderTreeDataFlags, FolderTreeDataFlags.None);
            Guid safeGuidFromByteArray          = FolderTreeData.GetSafeGuidFromByteArray(valueOrDefault2);

            if (safeGuidFromByteArray.Equals(Guid.Empty))
            {
                ExTraceGlobals.StorageTracer.TraceDebug <int>(0L, "Found TaskGroupEntry with invalid parent group class id. ArrayLength: {0}", (valueOrDefault2 == null) ? -1 : valueOrDefault2.Length);
                return(null);
            }
            if (IdConverter.IsFolderId(valueOrDefault))
            {
                StoreObjectId storeObjectId = StoreObjectId.FromProviderSpecificId(valueOrDefault);
                if ((valueOrDefault6 & FolderTreeDataFlags.IsDefaultStore) == FolderTreeDataFlags.IsDefaultStore)
                {
                    return(new TaskGroupEntryInfo(valueOrDefault3, versionedId, storeObjectId, safeGuidFromByteArray, valueOrDefault4, valueOrDefault5));
                }
                ExTraceGlobals.StorageTracer.TraceDebug <StoreObjectType, string, VersionedId>(0L, "Found TaskGroupEntry of type {0} referencing a non-task folder. ObjectType: {0}. TaskFfolderName: {1}. Id: {2}.", storeObjectId.ObjectType, valueOrDefault3, versionedId);
            }
            return(null);
        }
Exemple #10
0
 internal static ReplyTo CreateInstance(IStorePropertyBag storePropertyBag)
 {
     if (storePropertyBag.GetValueOrDefault <bool>(MessageItemSchema.ReplyToNamesExists, false) && storePropertyBag.GetValueOrDefault <bool>(MessageItemSchema.ReplyToBlobExists, false))
     {
         string valueOrDefault  = storePropertyBag.GetValueOrDefault <string>(InternalSchema.MapiReplyToNames, null);
         byte[] valueOrDefault2 = storePropertyBag.GetValueOrDefault <byte[]>(InternalSchema.MapiReplyToBlob, null);
         if (valueOrDefault != null && valueOrDefault2 != null)
         {
             PropertyBag propertyBag = new MemoryPropertyBag();
             propertyBag[InternalSchema.MapiReplyToNames] = valueOrDefault;
             propertyBag[InternalSchema.MapiReplyToBlob]  = valueOrDefault2;
             return(new ReplyTo(propertyBag));
         }
     }
     return(null);
 }
            public override bool IsSelectable(IStorePropertyBag source)
            {
                Util.ThrowOnNullArgument(source, "source");
                string valueOrDefault = source.GetValueOrDefault <string>(ContactBaseSchema.DisplayNameFirstLast, null);

                return(!string.IsNullOrWhiteSpace(valueOrDefault));
            }
        private StoreId GetMessageStoreId(string internetId, IMailboxSession session)
        {
            if (string.IsNullOrEmpty(internetId))
            {
                return(null);
            }
            IStorePropertyBag[] array = AllItemsFolderHelper.FindItemsFromInternetId((MailboxSession)session, internetId, new StorePropertyDefinition[]
            {
                CoreItemSchema.Id
            });
            if (array == null || array.Length == 0)
            {
                return(null);
            }
            IStorePropertyBag storePropertyBag = array[0];

            if (storePropertyBag == null)
            {
                return(null);
            }
            VersionedId valueOrDefault = storePropertyBag.GetValueOrDefault <VersionedId>(CoreItemSchema.Id, null);

            if (valueOrDefault == null)
            {
                return(null);
            }
            return(valueOrDefault.ObjectId);
        }
Exemple #13
0
        private static Event GetBasicSeriesEventDataWithClinetId(IStorePropertyBag propertyBag, IStorageEntitySetScope <IStoreSession> scope)
        {
            Event basicSeriesEventData = EventExtensions.GetBasicSeriesEventData(propertyBag, scope);

            basicSeriesEventData.ClientId = propertyBag.GetValueOrDefault <string>(CalendarItemBaseSchema.EventClientId, null);
            return(basicSeriesEventData);
        }
Exemple #14
0
 private void LoadChildNodesCollection(IStorePropertyBag[] rows, int startIndex)
 {
     for (int i = startIndex; i < rows.Length; i++)
     {
         IStorePropertyBag storePropertyBag = rows[i];
         if (TaskGroup.IsTaskSection(storePropertyBag) && TaskGroup.IsFolderTreeData(storePropertyBag) && TaskGroup.IsTaskGroupEntry(storePropertyBag))
         {
             byte[] valueOrDefault = storePropertyBag.GetValueOrDefault <byte[]>(FolderTreeDataSchema.ParentGroupClassId, null);
             if (valueOrDefault == null || valueOrDefault.Length != 16)
             {
                 ExTraceGlobals.StorageTracer.TraceDebug <int>(0L, "Found TaskGroupEntry with invalid parent group id. ArrayLength: {0}", (valueOrDefault == null) ? -1 : valueOrDefault.Length);
             }
             else
             {
                 Guid g = new Guid(valueOrDefault);
                 if (this.groupClassId.Equals(g))
                 {
                     TaskGroupEntryInfo taskGroupEntryInfoFromRow = TaskGroupEntry.GetTaskGroupEntryInfoFromRow(storePropertyBag);
                     if (taskGroupEntryInfoFromRow != null)
                     {
                         this.children.Add(taskGroupEntryInfoFromRow);
                     }
                 }
             }
         }
     }
     this.hasLoadedTaskFoldersCollection = true;
 }
Exemple #15
0
        private Event GetInstancePropagationData(IStorePropertyBag propertyBag)
        {
            Event basicSeriesEventData = EventExtensions.GetBasicSeriesEventData(propertyBag, this.Scope);
            IActionPropagationState actionPropagationState = basicSeriesEventData;

            actionPropagationState.LastExecutedAction = propertyBag.GetValueOrDefault <Guid?>(CalendarItemSchema.LastExecutedCalendarInteropAction, null);
            return(basicSeriesEventData);
        }
Exemple #16
0
        public static bool HasDefaultPriority(IStorePropertyBag item1, IStorePropertyBag item2)
        {
            Util.ThrowOnNullArgument(item1, "item1");
            Util.ThrowOnNullArgument(item2, "item2");
            ExDateTime valueOrDefault  = item1.GetValueOrDefault <ExDateTime>(InternalSchema.CreationTime, ExDateTime.MinValue);
            ExDateTime valueOrDefault2 = item2.GetValueOrDefault <ExDateTime>(InternalSchema.CreationTime, ExDateTime.MinValue);

            return(valueOrDefault > valueOrDefault2);
        }
Exemple #17
0
        private static TaskGroupInfo GetTaskGroupInfoFromRow(IStorePropertyBag row)
        {
            VersionedId id = (VersionedId)row.TryGetProperty(ItemSchema.Id);

            byte[] valueOrDefault  = row.GetValueOrDefault <byte[]>(TaskGroupSchema.GroupClassId, null);
            string valueOrDefault2 = row.GetValueOrDefault <string>(ItemSchema.Subject, string.Empty);

            byte[]     valueOrDefault3       = row.GetValueOrDefault <byte[]>(FolderTreeDataSchema.Ordinal, null);
            ExDateTime valueOrDefault4       = row.GetValueOrDefault <ExDateTime>(StoreObjectSchema.LastModifiedTime, ExDateTime.MinValue);
            Guid       safeGuidFromByteArray = FolderTreeData.GetSafeGuidFromByteArray(valueOrDefault);

            if (safeGuidFromByteArray.Equals(Guid.Empty))
            {
                ExTraceGlobals.StorageTracer.TraceDebug <int>(0L, "Found task group with invalid group class id. ArrayLength: {0}", (valueOrDefault == null) ? -1 : valueOrDefault.Length);
                return(null);
            }
            return(new TaskGroupInfo(valueOrDefault2, id, safeGuidFromByteArray, TaskGroup.GetGroupTypeFromGuid(safeGuidFromByteArray), valueOrDefault3, valueOrDefault4));
        }
            public override bool HasPriority(IStorePropertyBag contact1, IStorePropertyBag contact2)
            {
                Util.ThrowOnNullArgument(contact1, "contact1");
                Util.ThrowOnNullArgument(contact2, "contact2");
                int valueOrDefault  = contact1.GetValueOrDefault <int>(ContactBaseSchema.DisplayNamePriority, int.MaxValue);
                int valueOrDefault2 = contact2.GetValueOrDefault <int>(ContactBaseSchema.DisplayNamePriority, int.MaxValue);

                return(valueOrDefault < valueOrDefault2 || (valueOrDefault <= valueOrDefault2 && ContactSelectionStrategy.HasDefaultPriority(contact1, contact2)));
            }
        private void RemoveStaleItem(IStoreSession session, IStorePropertyBag staleItem)
        {
            VersionedId valueOrDefault  = staleItem.GetValueOrDefault <VersionedId>(ItemSchema.Id, null);
            ExDateTime  valueOrDefault2 = staleItem.GetValueOrDefault <ExDateTime>(StoreObjectSchema.LastModifiedTime, ExDateTime.MinValue);

            this.Tracer.TraceDebug <VersionedId, ExDateTime>((long)this.GetHashCode(), "SingleInstanceItemHandler<T>:RemoveStaleItem - Removing stale metadata item with ID={0} and ModifiedTime={1}", valueOrDefault, valueOrDefault2);
            try
            {
                session.Delete(DeleteItemFlags.HardDelete, new StoreId[]
                {
                    valueOrDefault
                });
            }
            catch (ObjectNotFoundException arg)
            {
                this.Tracer.TraceWarning <VersionedId, ObjectNotFoundException>((long)this.GetHashCode(), "SingleInstanceItemHandler<T>:RemoveStaleItem - Failed to remove stale metadata item with ID {0} as object was not found. Exception: {1}", valueOrDefault, arg);
            }
        }
 public static bool SupportsSideConversation(IStorePropertyBag message)
 {
     if (!message.GetValueOrDefault <bool>(ItemSchema.SupportsSideConversation, false))
     {
         string itemClass = message.TryGetProperty(InternalSchema.ItemClass) as string;
         return(ObjectClass.IsCalendarItem(itemClass));
     }
     return(true);
 }
        private static string GetString(Func <string, string> normalize, IStorePropertyBag propertyBag, PropertyDefinition property)
        {
            string text = normalize(propertyBag.GetValueOrDefault <string>(property, string.Empty));

            if (!string.IsNullOrEmpty(text))
            {
                return(text);
            }
            return(null);
        }
 public override object GetValue(IStorePropertyBag contact)
 {
     Util.ThrowOnNullArgument(contact, "contact");
     byte[] valueOrDefault = contact.GetValueOrDefault <byte[]>(InternalSchema.EntryId, null);
     if (valueOrDefault == null)
     {
         return(null);
     }
     return(StoreObjectId.FromProviderSpecificId(valueOrDefault, StoreObjectType.Unknown));
 }
Exemple #23
0
        public static IPushNotificationSubscriptionItem CreateOrUpdateSubscription(IMailboxSession session, IXSOFactory xsoFactory, IFolder folder, string subscriptionId, PushNotificationServerSubscription subscription)
        {
            Util.ThrowOnNullArgument(session, "session");
            Util.ThrowOnNullArgument(xsoFactory, "xsoFactory");
            Util.ThrowOnNullArgument(folder, "folder");
            Util.ThrowOnNullOrEmptyArgument(subscriptionId, "subscriptionId");
            Util.ThrowOnNullArgument(subscription, "subscription");
            ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceDebug <string, IExchangePrincipal>((long)subscription.GetHashCode(), "PushNotificationSubscriptionItem.CreateOrUpdateSubscription: Searching for Subscription {0} on Mailbox {1}.", subscriptionId, session.MailboxOwner);
            IStorePropertyBag[] array = PushNotificationSubscriptionItem.GetSubscriptionById(folder, subscriptionId).ToArray <IStorePropertyBag>();
            IPushNotificationSubscriptionItem pushNotificationSubscriptionItem = null;

            try
            {
                if (array.Length >= 1)
                {
                    if (array.Length > 1)
                    {
                        ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceWarning <string, Guid>(0L, "PushNotificationSubscriptionItem.CreateOrUpdateSubscription: AmbiguousSubscription for subscription {0} and user {1}", subscriptionId, session.MailboxGuid);
                    }
                    IStorePropertyBag storePropertyBag = array[0];
                    VersionedId       valueOrDefault   = storePropertyBag.GetValueOrDefault <VersionedId>(ItemSchema.Id, null);
                    if (valueOrDefault == null)
                    {
                        ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceError <string>((long)storePropertyBag.GetHashCode(), "PushNotificationSubscriptionItem.CreateOrUpdateSubscription: Cannot resolve the ItemSchema.Id property from the Enumerable.", subscriptionId);
                        throw new CannotResolvePropertyException(ItemSchema.Id.Name);
                    }
                    ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceDebug <VersionedId>((long)storePropertyBag.GetHashCode(), "PushNotificationSubscriptionItem.CreateOrUpdateSubscription: Found one existing subscription with ItemSchema.Id = {0}.", valueOrDefault);
                    pushNotificationSubscriptionItem = xsoFactory.BindToPushNotificationSubscriptionItem(session, valueOrDefault, null);
                    pushNotificationSubscriptionItem.LastUpdateTimeUTC = ExDateTime.UtcNow;
                    subscription.LastSubscriptionUpdate = (DateTime)pushNotificationSubscriptionItem.LastUpdateTimeUTC;
                    pushNotificationSubscriptionItem.SerializedNotificationSubscription = subscription.ToJson();
                    ConflictResolutionResult conflictResolutionResult = pushNotificationSubscriptionItem.Save(SaveMode.ResolveConflicts);
                    if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
                    {
                        ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceError <string>((long)storePropertyBag.GetHashCode(), "PushNotificationSubscriptionItem.CreateOrUpdateSubscription: Save failed due to conflicts for subscription {0}.", subscriptionId);
                        throw new SaveConflictException(ServerStrings.ExSaveFailedBecauseOfConflicts(subscriptionId));
                    }
                    pushNotificationSubscriptionItem.Load(SubscriptionItemEnumeratorBase.PushNotificationSubscriptionItemProperties);
                }
                else
                {
                    ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceDebug((long)subscription.GetHashCode(), "PushNotificationSubscriptionItem.CreateOrUpdateSubscription: Cannot resolve given subscription, about to create a new SubscriptionItem.");
                    pushNotificationSubscriptionItem = PushNotificationSubscriptionItem.Create(session, xsoFactory, folder.StoreObjectId, subscriptionId, subscription);
                }
            }
            catch
            {
                if (pushNotificationSubscriptionItem != null)
                {
                    pushNotificationSubscriptionItem.Dispose();
                }
                throw;
            }
            return(pushNotificationSubscriptionItem);
        }
        internal static ContactInfoForSuggestion Create(IStorePropertyBag propertyBag)
        {
            Util.ThrowOnNullArgument(propertyBag, "propertyBag");
            StoreId  valueOrDefault  = propertyBag.GetValueOrDefault <StoreId>(ItemSchema.Id, null);
            PersonId valueOrDefault2 = propertyBag.GetValueOrDefault <PersonId>(ContactSchema.PersonId, null);

            PersonId[]       valueOrDefault3 = propertyBag.GetValueOrDefault <PersonId[]>(ContactSchema.LinkRejectHistory, null);
            string           @string         = ContactInfoForSuggestion.GetString(new Func <string, string>(ContactInfoForSuggestion.NormalizeName), propertyBag, ContactSchema.GivenName);
            string           string2         = ContactInfoForSuggestion.GetString(new Func <string, string>(ContactInfoForSuggestion.NormalizeName), propertyBag, ContactSchema.Surname);
            string           valueOrDefault4 = propertyBag.GetValueOrDefault <string>(ContactSchema.PartnerNetworkId, null);
            string           valueOrDefault5 = propertyBag.GetValueOrDefault <string>(ItemSchema.ParentDisplayName, null);
            HashSet <string> stringSet       = ContactInfoForSuggestion.GetStringSet(new Func <string, string>(ContactInfoForSuggestion.NormalizeEmailAddress), propertyBag, new PropertyDefinition[]
            {
                ContactSchema.Email1EmailAddress,
                ContactSchema.Email2EmailAddress,
                ContactSchema.Email3EmailAddress,
                ContactSchema.PrimarySmtpAddress
            });
            HashSet <string> aliasOfEmailAddresses = ContactInfoForSuggestion.GetAliasOfEmailAddresses(stringSet);
            HashSet <string> stringSet2            = ContactInfoForSuggestion.GetStringSet(new Func <string, string>(Util.NormalizePhoneNumber), propertyBag, new PropertyDefinition[]
            {
                ContactSchema.BusinessPhoneNumber,
                ContactSchema.BusinessPhoneNumber2,
                ContactSchema.HomePhone,
                ContactSchema.MobilePhone,
                ContactSchema.OtherTelephone
            });

            return(new ContactInfoForSuggestion
            {
                ItemId = valueOrDefault,
                PersonId = valueOrDefault2,
                LinkRejectHistory = valueOrDefault3,
                GivenName = @string,
                Surname = string2,
                EmailAddresses = stringSet,
                AliasOfEmailAddresses = aliasOfEmailAddresses,
                PhoneNumbers = stringSet2,
                PartnerNetworkId = valueOrDefault4,
                ParentDisplayName = valueOrDefault5
            });
        }
        private VersionedId GetVersionedId(IStorePropertyBag propertyBag)
        {
            VersionedId valueOrDefault = propertyBag.GetValueOrDefault <VersionedId>(ItemSchema.Id, null);

            if (valueOrDefault != null)
            {
                return(valueOrDefault);
            }
            ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceError((long)this.GetHashCode(), "PushNotificationStorage.GetPushNotificationSubscriptionIds: A subscription with an empty ItemSchema.Id value was returned by the Enumerator.");
            throw new CannotResolvePropertyException(ItemSchema.Id.Name);
        }
        private Event GetBasicEventDataForRetry(IStorePropertyBag propertyBag)
        {
            Event  basicSeriesEventData = EventExtensions.GetBasicSeriesEventData(propertyBag, this.Scope);
            string valueOrDefault       = propertyBag.GetValueOrDefault <string>(CalendarItemBaseSchema.EventClientId, null);
            int    valueOrDefault2      = propertyBag.GetValueOrDefault <int>(CalendarItemSchema.InstanceCreationIndex, -1);
            int    valueOrDefault3      = propertyBag.GetValueOrDefault <int>(CalendarItemSeriesSchema.SeriesCreationHash, -1);

            basicSeriesEventData.ClientId = valueOrDefault;
            IEventInternal eventInternal = basicSeriesEventData;

            if (valueOrDefault2 != -1)
            {
                eventInternal.InstanceCreationIndex = valueOrDefault2;
            }
            if (valueOrDefault3 != -1)
            {
                eventInternal.SeriesCreationHash = valueOrDefault3;
            }
            return(basicSeriesEventData);
        }
Exemple #27
0
        private Event GetBasicEventData(IStorePropertyBag propertyBag)
        {
            Event basicSeriesEventData = EventExtensions.GetBasicSeriesEventData(propertyBag, this.Scope);

            byte[] valueOrDefault = propertyBag.GetValueOrDefault <byte[]>(CalendarItemBaseSchema.GlobalObjectId, null);
            if (valueOrDefault != null)
            {
                IEventInternal eventInternal = basicSeriesEventData;
                eventInternal.GlobalObjectId = new GlobalObjectId(valueOrDefault).ToString();
            }
            return(basicSeriesEventData);
        }
        public static bool HasDefaultPriority(IStorePropertyBag contact1, IStorePropertyBag contact2)
        {
            Util.ThrowOnNullArgument(contact1, "contact1");
            Util.ThrowOnNullArgument(contact2, "contact2");
            string valueOrDefault  = contact1.GetValueOrDefault <string>(InternalSchema.PartnerNetworkId, string.Empty);
            string valueOrDefault2 = contact2.GetValueOrDefault <string>(InternalSchema.PartnerNetworkId, string.Empty);
            int    num             = ContactSelectionStrategy.NumericalRankingFromPartnerNetworkId(valueOrDefault);
            int    num2            = ContactSelectionStrategy.NumericalRankingFromPartnerNetworkId(valueOrDefault2);

            if (num < num2)
            {
                return(true);
            }
            if (num == num2)
            {
                ExDateTime valueOrDefault3 = contact1.GetValueOrDefault <ExDateTime>(InternalSchema.CreationTime, ExDateTime.MinValue);
                ExDateTime valueOrDefault4 = contact2.GetValueOrDefault <ExDateTime>(InternalSchema.CreationTime, ExDateTime.MinValue);
                return(valueOrDefault3 > valueOrDefault4);
            }
            return(false);
        }
Exemple #29
0
        private bool ShouldExportContact(IStorePropertyBag contact)
        {
            string valueOrDefault = contact.GetValueOrDefault <string>(ContactSchema.PartnerNetworkId, string.Empty);
            bool   flag           = string.IsNullOrEmpty(valueOrDefault);

            this.performanceTracker.IncrementContactsRead();
            if (flag)
            {
                this.performanceTracker.IncrementContactsExported();
            }
            return(flag);
        }
Exemple #30
0
        private bool MasterMessageArrived(MailboxSession session, MeetingSeriesMessageOrderingAgent.SeriesHeadersData headersData, out StoreId instanceCalendarItemId)
        {
            OrFilter seekFilter = new OrFilter(new QueryFilter[]
            {
                new ComparisonFilter(ComparisonOperator.Equal, CalendarItemBaseSchema.GlobalObjectId, headersData.InstanceGoid),
                new ComparisonFilter(ComparisonOperator.Equal, CalendarItemBaseSchema.GlobalObjectId, headersData.MasterGoid)
            });

            instanceCalendarItemId = null;
            bool flag = false;

            using (CalendarFolder calendarFolder = CalendarFolder.Bind(session, DefaultFolderType.Calendar))
            {
                using (QueryResult queryResult = calendarFolder.ItemQuery(ItemQueryType.None, null, MeetingSeriesMessageOrderingAgent.SortByGoid, MeetingSeriesMessageOrderingAgent.AdditionalQueryProperties))
                {
                    bool flag2 = true;
                    while (queryResult.SeekToCondition(flag2 ? SeekReference.OriginBeginning : SeekReference.OriginCurrent, seekFilter, SeekToConditionFlags.AllowExtendedFilters))
                    {
                        flag2 = false;
                        IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(1);
                        if (propertyBags.Length == 1)
                        {
                            IStorePropertyBag storePropertyBag = propertyBags[0];
                            if (ObjectClass.IsCalendarItemSeries(storePropertyBag.GetValueOrDefault <string>(StoreObjectSchema.ItemClass, null)))
                            {
                                int valueOrDefault = storePropertyBag.GetValueOrDefault <int>(CalendarItemBaseSchema.AppointmentSequenceNumber, -1);
                                flag = (headersData.SeriesSequenceNumber <= valueOrDefault);
                                MeetingSeriesMessageOrderingAgent.tracer.TraceDebug <int, int, bool>((long)this.GetHashCode(), "Message SSN: {0}, Master SSN: {1} => Master message arrived: {2}.", headersData.SeriesSequenceNumber, valueOrDefault, flag);
                            }
                            else
                            {
                                instanceCalendarItemId = storePropertyBag.GetValueOrDefault <StoreId>(ItemSchema.Id, null);
                            }
                        }
                    }
                }
            }
            return(flag);
        }