public new static CalendarItemInstance Bind(StoreSession session, StoreId storeId, ICollection <PropertyDefinition> propsToReturn)
 {
     return(ItemBuilder.ItemBind <CalendarItemInstance>(session, storeId, CalendarItemInstanceSchema.Instance, propsToReturn));
 }
        private int MoveItems(IConversationTree conversationTree, List <GroupOperationResult> results, bool isUndo)
        {
            int            num              = 0;
            List <StoreId> list             = new List <StoreId>();
            StoreId        defaultFolderId  = ((MailboxSession)base.Session).GetDefaultFolderId(DefaultFolderType.Inbox);
            StoreId        defaultFolderId2 = ((MailboxSession)base.Session).GetDefaultFolderId(DefaultFolderType.SentItems);
            StoreId        defaultFolderId3 = ((MailboxSession)base.Session).GetDefaultFolderId(DefaultFolderType.DeletedItems);

            foreach (IConversationTreeNode conversationTreeNode in conversationTree)
            {
                for (int i = 0; i < conversationTreeNode.StorePropertyBags.Count; i++)
                {
                    if (!this.CanSkipProcessing(conversationTreeNode.StorePropertyBags[i]))
                    {
                        StoreId item    = conversationTreeNode.StorePropertyBags[i].TryGetProperty(ItemSchema.Id) as StoreId;
                        StoreId storeId = conversationTreeNode.StorePropertyBags[i].TryGetProperty(StoreObjectSchema.ParentItemId) as StoreId;
                        if (isUndo)
                        {
                            if (!storeId.Equals(defaultFolderId2) && !storeId.Equals(defaultFolderId))
                            {
                                num++;
                                list.Add(item);
                            }
                        }
                        else if (!storeId.Equals(defaultFolderId2) && !storeId.Equals(this.TargetFolderId) && (this.ConversationActionLastMoveFolderId == null || (this.ConversationActionLastMoveFolderId.Length == 0 && !this.TargetFolderId.Equals(defaultFolderId3)) || ArrayComparer <byte> .Comparer.Equals(storeId.GetBytes(), this.ConversationActionLastMoveFolderId)))
                        {
                            num++;
                            list.Add(item);
                        }
                    }
                }
            }
            if (list.Count > 0)
            {
                AggregateOperationResult aggregateOperationResult;
                if (isUndo)
                {
                    aggregateOperationResult = base.Session.Move(defaultFolderId, list.ToArray());
                }
                else
                {
                    aggregateOperationResult = base.Session.Move(this.TargetFolderId, list.ToArray());
                }
                if (aggregateOperationResult != null && aggregateOperationResult.GroupOperationResults != null && aggregateOperationResult.GroupOperationResults.Length > 0)
                {
                    foreach (GroupOperationResult item2 in aggregateOperationResult.GroupOperationResults)
                    {
                        results.Add(item2);
                    }
                }
            }
            if (isUndo)
            {
                base.Delete(ConversationActionItemSchema.ConversationActionLastMoveFolderId);
            }
            else if (this.AlwaysDeleteValue)
            {
                if (this.ConversationActionLastMoveFolderId == null || this.ConversationActionLastMoveFolderId.Length != 0)
                {
                    this.ConversationActionLastMoveFolderId = Array <byte> .Empty;
                }
            }
            else if (!ArrayComparer <byte> .Comparer.Equals(this.ConversationActionLastMoveFolderId, this.TargetFolderId.GetBytes()))
            {
                this.ConversationActionLastMoveFolderId = this.TargetFolderId.GetBytes();
            }
            return(num);
        }
Example #3
0
 public new static PostItem Bind(StoreSession session, StoreId postId, ICollection <PropertyDefinition> propsToReturn)
 {
     return(ItemBuilder.ItemBind <PostItem>(session, postId, PostItemSchema.Instance, propsToReturn));
 }
Example #4
0
 public static Subscription Create(StoreSession session, NotificationHandler handler, NotificationType notificationType, StoreId id)
 {
     return(Subscription.Create(session, handler, notificationType, id, true, false));
 }
Example #5
0
        public static Subscription Create(StoreSession session, NotificationHandler handler, NotificationType notificationType, StoreId id, bool isSyncCallback, bool passthruCallback)
        {
            EnumValidator.ThrowIfInvalid <NotificationType>(notificationType, "notificationType");
            if (session == null)
            {
                ExTraceGlobals.StorageTracer.TraceError <string>(0L, "Subscription::Create. {0} should not be null.", "session");
                throw new ArgumentNullException("session");
            }
            if (handler == null)
            {
                ExTraceGlobals.StorageTracer.TraceError <string>(0L, "Subscription::Create. {0} should not be null.", "handler");
                throw new ArgumentNullException("handler");
            }
            if (id == null)
            {
                ExTraceGlobals.StorageTracer.TraceError <string>(0L, "Subscription::Create. {0} should not be null.", "id");
                throw new ArgumentNullException("id");
            }
            if ((notificationType & NotificationType.ConnectionDropped) == NotificationType.ConnectionDropped)
            {
                ExTraceGlobals.StorageTracer.TraceError(0L, "Subscription::Create. ConnectionDropped not valid on object notifications.");
                throw new InvalidOperationException("ConnectionDropped not valid on object notifications.");
            }
            StoreObjectId            storeObjectId = StoreId.GetStoreObjectId(id);
            NotificationCallbackMode callbackMode  = isSyncCallback ? NotificationCallbackMode.Sync : NotificationCallbackMode.Async;

            return(Subscription.InternalCreate(session, handler, notificationType, storeObjectId, callbackMode, passthruCallback));
        }
Example #6
0
 public PropProblem[] DeleteProperties(StoreId folderId, PropTag[] propertyTags, out Guid contentMailboxGuid)
 {
     PropProblem[] result;
     using (PublicFolderConnectionLimitsTracker.Instance.GetToken(this.PrimaryHierarchyMailboxPrincipal.MailboxInfo.Location.ServerFqdn))
     {
         StoreSession storeSession = null;
         object       thisObject   = null;
         bool         flag         = false;
         try
         {
             if (storeSession != null)
             {
                 storeSession.BeginMapiCall();
                 storeSession.BeginServerHealthCall();
                 flag = true;
             }
             if (StorageGlobals.MapiTestHookBeforeCall != null)
             {
                 StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
             }
             using (MapiStore hierarchyStore = this.GetHierarchyStore())
             {
                 using (MapiFolder mapiFolder = (MapiFolder)hierarchyStore.OpenEntry(this.GetDestinationSpecificEntryId(hierarchyStore, folderId)))
                 {
                     contentMailboxGuid = RPCPrimaryHierarchyProvider.GetMailboxGuidFromPersonalizedLegacyDN(mapiFolder.GetReplicaServers()[0]);
                     result             = mapiFolder.DeleteProps(propertyTags, true);
                 }
             }
         }
         catch (MapiPermanentException ex)
         {
             throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotDeleteProperties, ex, storeSession, thisObject, "{0}. MapiException = {1}.", new object[]
             {
                 string.Format("RPCPrimaryHierarchyProvider.DeleteProperties : folderId = {0}", folderId),
                 ex
             });
         }
         catch (MapiRetryableException ex2)
         {
             throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotDeleteProperties, ex2, storeSession, thisObject, "{0}. MapiException = {1}.", new object[]
             {
                 string.Format("RPCPrimaryHierarchyProvider.DeleteProperties : folderId = {0}", folderId),
                 ex2
             });
         }
         finally
         {
             try
             {
                 if (storeSession != null)
                 {
                     storeSession.EndMapiCall();
                     if (flag)
                     {
                         storeSession.EndServerHealthCall();
                     }
                 }
             }
             finally
             {
                 if (StorageGlobals.MapiTestHookAfterCall != null)
                 {
                     StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                 }
             }
         }
     }
     return(result);
 }
Example #7
0
        private byte[] GetDestinationSpecificEntryId(MapiStore hierarchyStore, StoreId folderId)
        {
            StoreSession storeSession = null;
            object       thisObject   = null;
            bool         flag         = false;

            byte[] result;
            try
            {
                if (storeSession != null)
                {
                    storeSession.BeginMapiCall();
                    storeSession.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                result = hierarchyStore.CreateEntryId(hierarchyStore.GetFidFromEntryId(StoreId.GetStoreObjectId(folderId).ProviderLevelItemId));
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotCreateEntryIdFromShortTermId, ex, storeSession, thisObject, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("RPCPrimaryHierarchyProvider.GetDestinationSpecificEntryId : folderId = {0}", folderId),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotCreateEntryIdFromShortTermId, ex2, storeSession, thisObject, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("RPCPrimaryHierarchyProvider.GetDestinationSpecificEntryId : folderId = {0}", folderId),
                    ex2
                });
            }
            finally
            {
                try
                {
                    if (storeSession != null)
                    {
                        storeSession.EndMapiCall();
                        if (flag)
                        {
                            storeSession.EndServerHealthCall();
                        }
                    }
                }
                finally
                {
                    if (StorageGlobals.MapiTestHookAfterCall != null)
                    {
                        StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                    }
                }
            }
            return(result);
        }
Example #8
0
 public static TaskGroup Bind(MailboxSession session, StoreId storeId)
 {
     return(TaskGroup.Bind(session, storeId, null));
 }
 public UserConfiguration GetFolderConfiguration(string configName, UserConfigurationTypes freefetchDataTypes, StoreId folderId, StoreObjectId messageId)
 {
     EnumValidator.ThrowIfInvalid <UserConfigurationTypes>(freefetchDataTypes, "freefetchDataTypes");
     return(this.InternalGetUserConfiguration(folderId, new UserConfigurationName(configName, ConfigurationNameKind.Name), freefetchDataTypes, messageId));
 }
 internal new static ConfigurationItem Bind(StoreSession session, StoreId id)
 {
     return(ItemBuilder.ItemBind <ConfigurationItem>(session, id, ConfigurationItemSchema.Instance, null));
 }
Example #11
0
 protected override bool IsCompatibleId(StoreId id, ICoreObject coreObject)
 {
     return((coreObject == null || coreObject is CoreFolder) && IdConverter.IsFolderId(StoreId.GetStoreObjectId(id)));
 }
Example #12
0
 public static bool RemoveWorkingHoursFrom(MailboxSession session, StoreId folderId)
 {
     return(WorkHoursInCalendar.DeleteFromCalendar(session, folderId));
 }
Example #13
0
        public void SaveTo(MailboxSession session, StoreId folderId)
        {
            WorkHoursInCalendar workHoursInCalendar = WorkHoursInCalendar.Create(this.timeZone, (int)this.daysOfWeek, this.startTimeInMinutes, this.endTimeInMinutes);

            workHoursInCalendar.SaveToCalendar(session, folderId);
        }
Example #14
0
 public virtual DefaultFolderType IsDefaultFolderType(StoreId folderId)
 {
     throw new NotImplementedException();
 }
 OperationResult IUserConfigurationManager.DeleteFolderConfigurations(StoreId folderId, params string[] configurationNames)
 {
     return(this.DeleteFolderConfigurations(folderId, configurationNames));
 }
        public ICollection <UserConfiguration> FindFolderConfigurations(string searchString, UserConfigurationSearchFlags searchFlags, StoreId folderId)
        {
            ICollection <UserConfiguration> result;

            using (Folder folder = Folder.Bind(this.mailboxSession, folderId))
            {
                result = this.InternalFindUserConfigurations(folder, searchString, searchFlags);
            }
            return(result);
        }
Example #17
0
 public void MoveFolder(StoreId parentFolderId, StoreId destinationFolderId, StoreId sourceFolderId, string newFolderName)
 {
     using (PublicFolderConnectionLimitsTracker.Instance.GetToken(this.PrimaryHierarchyMailboxPrincipal.MailboxInfo.Location.ServerFqdn))
     {
         StoreSession storeSession = null;
         object       thisObject   = null;
         bool         flag         = false;
         try
         {
             if (storeSession != null)
             {
                 storeSession.BeginMapiCall();
                 storeSession.BeginServerHealthCall();
                 flag = true;
             }
             if (StorageGlobals.MapiTestHookBeforeCall != null)
             {
                 StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
             }
             using (MapiStore hierarchyStore = this.GetHierarchyStore())
             {
                 using (MapiFolder mapiFolder = (MapiFolder)hierarchyStore.OpenEntry(this.GetDestinationSpecificEntryId(hierarchyStore, parentFolderId)))
                 {
                     using (MapiFolder mapiFolder2 = (MapiFolder)hierarchyStore.OpenEntry(this.GetDestinationSpecificEntryId(hierarchyStore, destinationFolderId)))
                     {
                         mapiFolder.CopyFolder(CopyFolderFlags.FolderMove, mapiFolder2, this.GetDestinationSpecificEntryId(hierarchyStore, sourceFolderId), newFolderName);
                     }
                 }
             }
         }
         catch (MapiPermanentException ex)
         {
             throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCopyMessagesFailed, ex, storeSession, thisObject, "{0}. MapiException = {1}.", new object[]
             {
                 string.Format("RPCPrimaryHierarchyProvider.MoveFolder : folderId = {0}, ParentId = {1}, DestinationId = {2}", sourceFolderId, parentFolderId, destinationFolderId),
                 ex
             });
         }
         catch (MapiRetryableException ex2)
         {
             throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCopyMessagesFailed, ex2, storeSession, thisObject, "{0}. MapiException = {1}.", new object[]
             {
                 string.Format("RPCPrimaryHierarchyProvider.MoveFolder : folderId = {0}, ParentId = {1}, DestinationId = {2}", sourceFolderId, parentFolderId, destinationFolderId),
                 ex2
             });
         }
         finally
         {
             try
             {
                 if (storeSession != null)
                 {
                     storeSession.EndMapiCall();
                     if (flag)
                     {
                         storeSession.EndServerHealthCall();
                     }
                 }
             }
             finally
             {
                 if (StorageGlobals.MapiTestHookAfterCall != null)
                 {
                     StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                 }
             }
         }
     }
 }
        public UserConfiguration CreateFolderConfiguration(string configurationName, UserConfigurationTypes dataTypes, StoreId folderId)
        {
            EnumValidator.ThrowIfInvalid <UserConfigurationTypes>(dataTypes, "dataTypes");
            if (folderId == null)
            {
                throw new ArgumentNullException("folderId");
            }
            UserConfiguration result;

            using (Folder folder = Folder.Bind(this.mailboxSession, folderId))
            {
                result = this.InternalCreateUserConfiguration(folder, new UserConfigurationName(configurationName, ConfigurationNameKind.Name), dataTypes);
            }
            return(result);
        }
Example #19
0
        public void ModifyPermissions(StoreId folderId, AclTableEntry.ModifyOperation[] modifyOperations, ModifyTableOptions options, bool replaceAllRows)
        {
            using (PublicFolderConnectionLimitsTracker.Instance.GetToken(this.PrimaryHierarchyMailboxPrincipal.MailboxInfo.Location.ServerFqdn))
            {
                StoreSession storeSession = null;
                object       thisObject   = null;
                bool         flag         = false;
                try
                {
                    if (storeSession != null)
                    {
                        storeSession.BeginMapiCall();
                        storeSession.BeginServerHealthCall();
                        flag = true;
                    }
                    if (StorageGlobals.MapiTestHookBeforeCall != null)
                    {
                        StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                    }
                    using (MapiStore hierarchyStore = this.GetHierarchyStore())
                    {
                        using (MapiFolder mapiFolder = (MapiFolder)hierarchyStore.OpenEntry(this.GetDestinationSpecificEntryId(hierarchyStore, folderId)))
                        {
                            using (MapiModifyTable mapiModifyTable = (MapiModifyTable)mapiFolder.OpenProperty(PropTag.AclTable, InterfaceIds.IExchangeModifyTable, 0, OpenPropertyFlags.DeferredErrors))
                            {
                                GetTableFlags    getTableFlags    = GetTableFlags.None;
                                ModifyTableFlags modifyTableFlags = ModifyTableFlags.None;
                                if (options == ModifyTableOptions.FreeBusyAware)
                                {
                                    getTableFlags    |= GetTableFlags.FreeBusy;
                                    modifyTableFlags |= ModifyTableFlags.FreeBusy;
                                }
                                if (replaceAllRows)
                                {
                                    modifyTableFlags |= ModifyTableFlags.RowListReplace;
                                }
                                using (MapiTable table = mapiModifyTable.GetTable(getTableFlags))
                                {
                                    Dictionary <byte[], long> entryIdToMemberIdMap = RPCPrimaryHierarchyProvider.GetEntryIdToMemberIdMap(table.QueryAllRows(null, RPCPrimaryHierarchyProvider.MapiAclTableColumns));
                                    List <RowEntry>           list = new List <RowEntry>(modifyOperations.Length);
                                    foreach (AclTableEntry.ModifyOperation modifyOperation in modifyOperations)
                                    {
                                        switch (modifyOperation.Operation)
                                        {
                                        case ModifyTableOperationType.Add:
                                            list.Add(RPCPrimaryHierarchyProvider.ConvertToRowEntry(modifyOperation));
                                            break;

                                        case ModifyTableOperationType.Modify:
                                        case ModifyTableOperationType.Remove:
                                        {
                                            AclTableEntry.ModifyOperation modifyOperation2 = modifyOperation;
                                            if (modifyOperation.Entry.MemberId != -1L && modifyOperation.Entry.MemberId != 0L)
                                            {
                                                if (entryIdToMemberIdMap.ContainsKey(modifyOperation.Entry.MemberEntryId))
                                                {
                                                    modifyOperation2 = new AclTableEntry.ModifyOperation(modifyOperation.Operation, new AclTableEntry(entryIdToMemberIdMap[modifyOperation.Entry.MemberEntryId], null, null, modifyOperation.Entry.MemberRights));
                                                }
                                                else if (modifyOperation.Operation == ModifyTableOperationType.Modify)
                                                {
                                                    modifyOperation2 = new AclTableEntry.ModifyOperation(ModifyTableOperationType.Add, new AclTableEntry(0L, modifyOperation.Entry.MemberEntryId, null, modifyOperation.Entry.MemberRights));
                                                }
                                                else
                                                {
                                                    modifyOperation2 = null;
                                                }
                                            }
                                            if (modifyOperation2 != null)
                                            {
                                                list.Add(RPCPrimaryHierarchyProvider.ConvertToRowEntry(modifyOperation2));
                                            }
                                            break;
                                        }
                                        }
                                    }
                                    mapiModifyTable.ModifyTable(modifyTableFlags, list.ToArray());
                                }
                            }
                        }
                    }
                }
                catch (MapiPermanentException ex)
                {
                    throw StorageGlobals.TranslateMapiException(ServerStrings.ExWrappedStreamFailure, ex, storeSession, thisObject, "{0}. MapiException = {1}.", new object[]
                    {
                        string.Format("RPCPrimaryHierarchyProvider.WriteAclPropertyStream : folderId = {0}", folderId),
                        ex
                    });
                }
                catch (MapiRetryableException ex2)
                {
                    throw StorageGlobals.TranslateMapiException(ServerStrings.ExWrappedStreamFailure, ex2, storeSession, thisObject, "{0}. MapiException = {1}.", new object[]
                    {
                        string.Format("RPCPrimaryHierarchyProvider.WriteAclPropertyStream : folderId = {0}", folderId),
                        ex2
                    });
                }
                finally
                {
                    try
                    {
                        if (storeSession != null)
                        {
                            storeSession.EndMapiCall();
                            if (flag)
                            {
                                storeSession.EndServerHealthCall();
                            }
                        }
                    }
                    finally
                    {
                        if (StorageGlobals.MapiTestHookAfterCall != null)
                        {
                            StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                        }
                    }
                }
            }
        }
 private UserConfiguration InternalGetUserConfiguration(StoreId folderId, UserConfigurationName configurationName, UserConfigurationTypes freefetchDataType)
 {
     return(this.InternalGetUserConfiguration(folderId, configurationName, freefetchDataType, null));
 }
Example #21
0
        public StoreId CreateFolder(string folderName, string folderDescription, StoreId parentFolderId, CreateMode mode, out Guid contentMailboxGuid)
        {
            StoreId result;

            using (PublicFolderConnectionLimitsTracker.Instance.GetToken(this.PrimaryHierarchyMailboxPrincipal.MailboxInfo.Location.ServerFqdn))
            {
                StoreSession storeSession = null;
                object       thisObject   = null;
                bool         flag         = false;
                try
                {
                    if (storeSession != null)
                    {
                        storeSession.BeginMapiCall();
                        storeSession.BeginServerHealthCall();
                        flag = true;
                    }
                    if (StorageGlobals.MapiTestHookBeforeCall != null)
                    {
                        StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                    }
                    using (MapiStore hierarchyStore = this.GetHierarchyStore())
                    {
                        using (MapiFolder mapiFolder = (MapiFolder)hierarchyStore.OpenEntry(this.GetDestinationSpecificEntryId(hierarchyStore, parentFolderId)))
                        {
                            using (MapiFolder mapiFolder2 = mapiFolder.CreateFolder(folderName, folderDescription, mode == CreateMode.OpenIfExists))
                            {
                                contentMailboxGuid = RPCPrimaryHierarchyProvider.GetMailboxGuidFromPersonalizedLegacyDN(mapiFolder2.GetReplicaServers()[0]);
                                result             = StoreObjectId.FromProviderSpecificId(mapiFolder2.GetProp(PropTag.EntryId).GetBytes(), StoreObjectType.Folder);
                            }
                        }
                    }
                }
                catch (MapiPermanentException ex)
                {
                    throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotCreateFolder(folderName), ex, storeSession, thisObject, "{0}. MapiException = {1}.", new object[]
                    {
                        string.Format("RPCPrimaryHierarchyProvider.CreateFolder : folderName = {0}", folderName),
                        ex
                    });
                }
                catch (MapiRetryableException ex2)
                {
                    throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotCreateFolder(folderName), ex2, storeSession, thisObject, "{0}. MapiException = {1}.", new object[]
                    {
                        string.Format("RPCPrimaryHierarchyProvider.CreateFolder : folderName = {0}", folderName),
                        ex2
                    });
                }
                finally
                {
                    try
                    {
                        if (storeSession != null)
                        {
                            storeSession.EndMapiCall();
                            if (flag)
                            {
                                storeSession.EndServerHealthCall();
                            }
                        }
                    }
                    finally
                    {
                        if (StorageGlobals.MapiTestHookAfterCall != null)
                        {
                            StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                        }
                    }
                }
            }
            return(result);
        }
        private UserConfiguration InternalGetUserConfiguration(StoreId folderId, UserConfigurationName configurationName, UserConfigurationTypes freefetchDataType, StoreObjectId messageId)
        {
            if (this.aggregators.Count > 0)
            {
                lock (this.aggregators)
                {
                    foreach (UserConfigurationManager.AggregationContext aggregationContext in this.aggregators)
                    {
                        ExTraceGlobals.StorageTracer.TraceWarning <UserConfigurationName>((long)this.GetHashCode(), "UserConfigurationManager::InternalGetUserConfiguration cache miss = {0}.", configurationName);
                        aggregationContext.FaiCacheMiss();
                    }
                }
            }
            if (folderId == null)
            {
                throw new ArgumentNullException("folderId");
            }
            UserConfiguration userConfiguration = null;
            bool flag2 = false;
            UserConfiguration result;

            try
            {
                userConfiguration = this.userConfigurationCache.Get(configurationName, StoreId.GetStoreObjectId(folderId));
                if (userConfiguration == null)
                {
                    if (messageId != null)
                    {
                        userConfiguration = this.GetMessageConfiguration(configurationName, freefetchDataType, messageId);
                    }
                    if (userConfiguration == null)
                    {
                        ExTraceGlobals.UserConfigurationTracer.TraceDebug <string>((long)this.GetHashCode(), "UserConfigurationManager::InternalBindAndGetUserConfiguration. Miss the cache. ConfigName = {0}.", configurationName.Name);
                        userConfiguration = this.InternalBindAndGetUserConfiguration(folderId, configurationName, freefetchDataType);
                    }
                }
                if ((userConfiguration.DataTypes & freefetchDataType) == (UserConfigurationTypes)0)
                {
                    ExTraceGlobals.StorageTracer.TraceError(0L, "The configuration data's field has been corrupted. Field = UserConfigurationType.");
                    throw new CorruptDataException(ServerStrings.ExConfigDataCorrupted("UserConfigurationType"));
                }
                flag2  = true;
                result = userConfiguration;
            }
            finally
            {
                if (!flag2 && userConfiguration != null)
                {
                    userConfiguration.Dispose();
                    userConfiguration = null;
                }
            }
            return(result);
        }
Example #23
0
 public static Subscription Create(StoreSession session, NotificationHandler handler, NotificationType notificationType, StoreId id, bool isSyncCallback)
 {
     return(Subscription.Create(session, handler, notificationType, id, isSyncCallback, false));
 }
        public IReadableUserConfiguration GetReadOnlyFolderConfiguration(string configName, UserConfigurationTypes freefetchDataTypes, StoreId folderId)
        {
            IReadableUserConfiguration result = null;

            if (!this.TryGetAggregatedConfiguration(() => UserConfigurationDescriptor.CreateFolderDescriptor(configName, freefetchDataTypes, StoreId.GetStoreObjectId(folderId)), out result))
            {
                result = this.GetFolderConfiguration(configName, freefetchDataTypes, folderId);
            }
            return(result);
        }
        public static IList <StoreId> QueryConversationActionsFolder(MailboxSession session, ConversationId conversationId, int maxRowCount, out int totalActionItemCount)
        {
            totalActionItemCount = 0;
            StoreId conversationActionsFolderId = ConversationActionItem.GetConversationActionsFolderId(session, false);

            if (conversationActionsFolderId == null)
            {
                return(null);
            }
            IList <StoreId> result;

            try
            {
                using (Folder folder = Folder.Bind(session, conversationActionsFolderId))
                {
                    int?valueAsNullable = folder.GetValueAsNullable <int>(FolderSchema.AssociatedItemCount);
                    if (valueAsNullable != null && valueAsNullable <= 0)
                    {
                        result = null;
                    }
                    else
                    {
                        totalActionItemCount = ((valueAsNullable != null) ? valueAsNullable.Value : 0);
                        if (conversationId == null)
                        {
                            result = null;
                        }
                        else
                        {
                            SortBy[] sortColumns = new SortBy[]
                            {
                                new SortBy(ItemSchema.ConversationIndex, SortOrder.Ascending),
                                new SortBy(StoreObjectSchema.LastModifiedTime, SortOrder.Descending)
                            };
                            ConversationIndex conversationIndex = ConversationActionItem.GetConversationIndex(conversationId);
                            using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.Associated, null, sortColumns, new PropertyDefinition[]
                            {
                                ItemSchema.ConversationIndex,
                                ItemSchema.Id,
                                ConversationActionItemSchema.ConversationActionVersion
                            }))
                            {
                                if (queryResult.SeekToCondition(SeekReference.OriginBeginning, new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.ConversationIndex, conversationIndex.ToByteArray())))
                                {
                                    IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(maxRowCount);
                                    if (propertyBags.Length >= 1)
                                    {
                                        List <StoreId> list = new List <StoreId>();
                                        for (int i = 0; i < propertyBags.Length; i++)
                                        {
                                            byte[] array = propertyBags[i][ItemSchema.ConversationIndex] as byte[];
                                            if (array != null)
                                            {
                                                ConversationIndex conversationIndex2;
                                                bool flag = ConversationIndex.TryCreate(array, out conversationIndex2);
                                                if (flag)
                                                {
                                                    if (!conversationIndex2.Equals(conversationIndex))
                                                    {
                                                        break;
                                                    }
                                                    if (!(propertyBags[i].TryGetProperty(ConversationActionItemSchema.ConversationActionVersion) is PropertyError))
                                                    {
                                                        int version = (int)propertyBags[i].TryGetProperty(ConversationActionItemSchema.ConversationActionVersion);
                                                        if (ConversationActionItem.GetMajorVersion(version) >= 4)
                                                        {
                                                            list.Add(propertyBags[i][ItemSchema.Id] as VersionedId);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        return((list.Count == 0) ? null : list);
                                    }
                                }
                                result = null;
                            }
                        }
                    }
                }
            }
            catch (ObjectNotFoundException)
            {
                result = null;
            }
            return(result);
        }
 IUserConfiguration IUserConfigurationManager.GetFolderConfiguration(string configName, UserConfigurationTypes freefetchDataTypes, StoreId folderId)
 {
     return(this.GetFolderConfiguration(configName, freefetchDataTypes, folderId));
 }
Example #27
0
 public new static PostItem Bind(StoreSession session, StoreId postId)
 {
     return(PostItem.Bind(session, postId, null));
 }
 IUserConfiguration IUserConfigurationManager.CreateFolderConfiguration(string configurationName, UserConfigurationTypes dataTypes, StoreId folderId)
 {
     return(this.CreateFolderConfiguration(configurationName, dataTypes, folderId));
 }
Example #29
0
 public PostItem ReplyToFolder(StoreId parentFolderId, ReplyForwardConfiguration configuration)
 {
     return(this.ReplyToFolder(base.Session, parentFolderId, configuration));
 }
 public new static CalendarItemInstance Bind(StoreSession session, StoreId storeId, params PropertyDefinition[] propsToReturn)
 {
     return(CalendarItemInstance.Bind(session, storeId, (ICollection <PropertyDefinition>)propsToReturn));
 }