Exemplo n.º 1
0
        private static TaskGroup CreateMyTasksGroup(MailboxSession session)
        {
            TaskGroup taskGroup  = TaskGroup.InternalCreateDefaultGroup(session);
            bool      flag       = TaskGroup.AddDefaultTaskFolder(session, taskGroup, DefaultFolderType.ToDoSearch, ClientStrings.ToDoSearch.ToString(session.InternalCulture));
            string    folderType = DefaultFolderType.ToDoSearch.ToString();

            if (flag)
            {
                flag       = TaskGroup.AddDefaultTaskFolder(session, taskGroup, DefaultFolderType.Tasks, ClientStrings.Tasks.ToString(session.InternalCulture));
                folderType = DefaultFolderType.Tasks.ToString();
            }
            if (!flag)
            {
                AggregateOperationResult aggregateOperationResult = session.Delete(DeleteItemFlags.HardDelete, new StoreId[]
                {
                    taskGroup.Id
                });
                if (aggregateOperationResult.OperationResult != OperationResult.Succeeded)
                {
                    ExTraceGlobals.StorageTracer.TraceWarning <SmtpAddress>(0L, "Unable to delete default task group after failing to add the default task folder to it. User: {0}", session.MailboxOwner.MailboxInfo.PrimarySmtpAddress);
                }
                throw new DefaultTaskNodeCreationException(folderType);
            }
            return(taskGroup);
        }