// Token: 0x060009C3 RID: 2499 RVA: 0x00039960 File Offset: 0x00037B60
        private void WriteFolderXml(XmlDocument xmlResponse, XmlElement foldersNode, object[] folderProperties)
        {
            StoreObjectId objectId          = ((VersionedId)folderProperties[0]).ObjectId;
            StoreObjectId storeObjectId     = (StoreObjectId)folderProperties[1];
            string        orAddSyncFolderId = GetHierarchyCommand.GetOrAddSyncFolderId(this.folderIdMappingSyncState, objectId);
            string        innerText         = storeObjectId.Equals(base.MailboxSession.GetDefaultFolderId(DefaultFolderType.Root)) ? "0" : GetHierarchyCommand.GetOrAddSyncFolderId(this.folderIdMappingSyncState, storeObjectId);
            string        innerText2        = folderProperties[2] as string;
            string        airSyncFolderType = AirSyncUtility.GetAirSyncFolderType(base.MailboxSession, objectId);
            XmlElement    xmlElement        = xmlResponse.CreateElement("Folder", "FolderHierarchy:");

            foldersNode.AppendChild(xmlElement);
            XmlElement xmlElement2 = xmlResponse.CreateElement("DisplayName", "FolderHierarchy:");

            xmlElement2.InnerText = innerText2;
            xmlElement.AppendChild(xmlElement2);
            XmlElement xmlElement3 = xmlResponse.CreateElement("ServerId", "FolderHierarchy:");

            xmlElement3.InnerText = orAddSyncFolderId;
            xmlElement.AppendChild(xmlElement3);
            XmlElement xmlElement4 = xmlResponse.CreateElement("Type", "FolderHierarchy:");

            xmlElement4.InnerText = airSyncFolderType;
            xmlElement.AppendChild(xmlElement4);
            XmlElement xmlElement5 = xmlResponse.CreateElement("ParentId", "FolderHierarchy:");

            xmlElement5.InnerText = innerText;
            xmlElement.AppendChild(xmlElement5);
        }
Пример #2
0
        public static StoreObjectId OptUserIn(MailboxSession session, VariantConfigurationSnapshot snapshot, IFrontEndLocator frontEndLocator)
        {
            snapshot = ClutterUtilities.LoadSnapshotIfNeeded(session, snapshot);
            StoreObjectId storeObjectId = null;

            if (!session.Mailbox.GetValueOrDefault <bool>(MailboxSchema.InferenceClutterEnabled, false) || !session.Mailbox.GetValueOrDefault <bool>(MailboxSchema.InferenceClassificationEnabled, false))
            {
                using (MailboxSession mailboxSession = ClutterUtilities.OpenAdminSession(session))
                {
                    StoreObjectId storeObjectId2 = ClutterUtilities.SetClassificationEnabled(mailboxSession, true);
                    ClutterUtilities.AddClutterToFavorite(session);
                    ClutterUtilities.VerifyReadyVersionInCrumb(mailboxSession);
                    storeObjectId = session.RefreshDefaultFolder(DefaultFolderType.Clutter);
                    ClutterUtilities.RefreshInferenceProperties(session, true);
                    using (NotificationManager notificationManager = new NotificationManager(session, snapshot, frontEndLocator))
                    {
                        notificationManager.SendNotification(ClutterNotificationType.OptedIn, DefaultFolderType.Inbox);
                        notificationManager.ScheduleNotification(ClutterNotificationType.FirstReminder, 5, DayOfWeek.Monday);
                        notificationManager.CancelScheduledNotification(ClutterNotificationType.AutoEnablementNotice);
                        notificationManager.Save();
                    }
                    ExAssert.RetailAssert(mailboxSession.Mailbox.GetValueOrDefault <bool>(MailboxSchema.InferenceClutterEnabled, false), "InferenceClutterEnabled should have been set to true in admin session");
                    ExAssert.RetailAssert(mailboxSession.Mailbox.GetValueOrDefault <bool>(MailboxSchema.InferenceClassificationEnabled, false), "InferenceClassificationEnabled should have been set to true in admin session");
                    ExAssert.RetailAssert(storeObjectId2 != null, "Clutter folder id created in admin session should not be null");
                    ExAssert.RetailAssert(storeObjectId2.Equals(storeObjectId), "Clutter folder id created in admin session should equal the id created by refreshing the user session");
                    goto IL_FD;
                }
            }
            storeObjectId = ClutterUtilities.ValidateClutterFolder(session);
IL_FD:
            ExAssert.RetailAssert(session.Mailbox.GetValueOrDefault <bool>(MailboxSchema.InferenceClutterEnabled, false), "InferenceClutterEnabled should have been set to true in user session");
            ExAssert.RetailAssert(session.Mailbox.GetValueOrDefault <bool>(MailboxSchema.InferenceClassificationEnabled, false), "InferenceClassificationEnabled should have been set to true in user session");
            ExAssert.RetailAssert(storeObjectId != null, "Clutter folder could not be created");
            return(storeObjectId);
        }
Пример #3
0
        public CalendarSecondaryNavigation(OwaContext owaContext, StoreObjectId selectedFolderId, ExDateTime?day, CalendarFolderList calendarFolderList) : base(owaContext, selectedFolderId)
        {
            HttpRequest request     = owaContext.HttpContext.Request;
            UserContext userContext = owaContext.UserContext;

            if (selectedFolderId == null)
            {
                this.selectedFolderId = (RequestParser.GetFolderIdFromQueryString(request, false) ?? userContext.CalendarFolderId);
            }
            if (day != null)
            {
                this.day = day.Value;
            }
            else
            {
                CalendarModuleViewState calendarModuleViewState = userContext.LastClientViewState as CalendarModuleViewState;
                if (calendarModuleViewState != null && selectedFolderId.Equals(calendarModuleViewState.FolderId))
                {
                    this.day = calendarModuleViewState.DateTime;
                }
                else
                {
                    this.day = DateTimeUtilities.GetLocalTime().Date;
                }
            }
            this.calendarFolderList = calendarFolderList;
        }
Пример #4
0
        public static ItemOperations.Result DeleteItem(UserContext userContext, StoreObjectId itemId, StoreObjectId folderId)
        {
            ItemOperations.Result result            = null;
            ListViewViewState     listViewViewState = userContext.LastClientViewState as ListViewViewState;

            if (listViewViewState != null && folderId.Equals(listViewViewState.FolderId))
            {
                result = ItemOperations.GetNextViewItem(userContext, ItemOperations.Action.Delete, itemId, folderId);
            }
            if (Utilities.IsDefaultFolderId(userContext.MailboxSession, folderId, DefaultFolderType.DeletedItems))
            {
                Utilities.DeleteItems(userContext, DeleteItemFlags.SoftDelete, new StoreId[]
                {
                    itemId
                });
            }
            else
            {
                Utilities.DeleteItems(userContext, DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                {
                    itemId
                });
            }
            return(result);
        }
        internal override void HandleNotificationInternal(Notification notif, MapiNotificationsLogEvent logEvent, object context)
        {
            NewMailNotification newMailNotification = notif as NewMailNotification;

            if (newMailNotification == null)
            {
                return;
            }
            if (newMailNotification.NewMailItemId == null || newMailNotification.ParentFolderId == null)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug((long)this.GetHashCode(), "notification has a null notifying item id");
                return;
            }
            StoreObjectId parentFolderId = newMailNotification.ParentFolderId;

            if (parentFolderId == null || newMailNotification.NewMailItemId == null)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug((long)this.GetHashCode(), "notification has a null notifying item id");
                return;
            }
            if (!parentFolderId.Equals(this.InboxFolderId))
            {
                return;
            }
            NewMailNotificationPayload newMailNotificationPayload = this.BindToItemAndCreatePayload(newMailNotification);

            if (newMailNotificationPayload != null)
            {
                this.newMailNotifier.Payload = newMailNotificationPayload;
                this.newMailNotifier.PickupData();
            }
        }
Пример #6
0
 private void CheckResultsOfGetFolder()
 {
     foreach (GetFolderRequest getFolderRequest in this.getFolderRequests)
     {
         BaseQuery query = getFolderRequest.Query;
         if (string.IsNullOrEmpty(getFolderRequest.ResultFolderId))
         {
             GetFolderAndProxyRequest.GetFolderRequestTracer.TraceDebug <object, EmailAddress>((long)this.GetHashCode(), "{0}: No ResultFolderId returned for mailbox {1}.", TraceContext.Get(), query.Email);
         }
         else
         {
             StoreObjectId storeObjectId      = StoreId.EwsIdToStoreObjectId(getFolderRequest.ResultFolderId);
             StoreObjectId associatedFolderId = query.RecipientData.AssociatedFolderId;
             if (!associatedFolderId.Equals(storeObjectId))
             {
                 GetFolderAndProxyRequest.GetFolderRequestTracer.TraceDebug((long)this.GetHashCode(), "{0}: Requested folder id {2} doesn't match default folder id {3} for mailbox {1}.", new object[]
                 {
                     TraceContext.Get(),
                     query.Email,
                     associatedFolderId,
                     storeObjectId
                 });
                 query.SetResultOnFirstCall(base.Application.CreateQueryResult(new NotDefaultCalendarException()));
             }
         }
     }
 }
Пример #7
0
        public void Render(TextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            writer.Write("<table cellspacing=0 cellpadding=0 class=\"snt\">");
            writer.Write("<tr><td class=\"clhdr\">");
            writer.Write(LocalizedStrings.GetHtmlEncoded(-583426935));
            writer.Write("</td></tr>");
            bool flag = true;

            for (int i = 0; i < base.Count; i++)
            {
                if (!Utilities.IsExternalSharedInFolder(base.GetPropertyValue(i, FolderSchema.ExtendedFolderFlags)))
                {
                    string        text        = (string)base.GetPropertyValue(i, FolderSchema.DisplayName);
                    VersionedId   versionedId = (VersionedId)base.GetPropertyValue(i, FolderSchema.Id);
                    StoreObjectId objectId    = versionedId.ObjectId;
                    writer.Write("<tr><td nowrap class=\"fld");
                    bool flag2 = objectId.Equals(this.selectedFolderId);
                    if (flag2)
                    {
                        writer.Write(" sl");
                        flag = false;
                    }
                    writer.Write("\"><a href=\"?ae=Folder&t=IPF.Appointment&id=");
                    Utilities.HtmlEncode(Utilities.UrlEncode(objectId.ToBase64String()), writer);
                    writer.Write("\" title=\"");
                    Utilities.HtmlEncode(text, writer);
                    writer.Write("\">");
                    writer.Write("<img src=\"");
                    base.UserContext.RenderThemeFileUrl(writer, ThemeFileId.Appointment);
                    writer.Write("\" alt=\"\">");
                    Utilities.CropAndRenderText(writer, text, 24);
                    writer.Write(" </a>");
                    writer.Write("</td></tr>");
                }
            }
            if (flag)
            {
                using (Folder folder = Folder.Bind(base.UserContext.MailboxSession, this.selectedFolderId))
                {
                    writer.Write("<tr><td class=\"fter\"><img src=\"");
                    base.UserContext.RenderThemeFileUrl(writer, ThemeFileId.Clear);
                    writer.Write("\" alt=\"\"></td></tr>");
                    writer.Write("<tr><td class=\"clhdr\">");
                    writer.Write(LocalizedStrings.GetHtmlEncoded(352017519));
                    writer.Write("</td></tr><tr><td class=\"fld sl\"><a href=\"#\" onClick=\"return false;\"><img src=\"");
                    base.UserContext.RenderThemeFileUrl(writer, ThemeFileId.Appointment);
                    writer.Write("\">");
                    Utilities.CropAndRenderText(writer, folder.DisplayName, 24);
                    writer.Write("</a></td></tr>");
                }
            }
            writer.Write("</table>");
        }
Пример #8
0
        // Token: 0x06000B32 RID: 2866 RVA: 0x00048320 File Offset: 0x00046520
        private static bool IsInboxOrJunkFolder(byte[] entryId, StoreObjectId inboxEntryId, StoreObjectId junkFolderEntryId)
        {
            if (entryId == null)
            {
                return(false);
            }
            StoreObjectId id = StoreObjectId.FromProviderSpecificId(entryId, StoreObjectType.Folder);

            return((inboxEntryId != null && inboxEntryId.Equals(id)) || (junkFolderEntryId != null && junkFolderEntryId.Equals(id)));
        }
Пример #9
0
        private Dictionary <UniqueItemHash, List <IStorePropertyBag> > AggregateDuplicates(IEnumerable <IStorePropertyBag> propertyBags)
        {
            StoreObjectId defaultFolderId  = this.MailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox);
            StoreObjectId defaultFolderId2 = this.MailboxSession.GetDefaultFolderId(DefaultFolderType.SentItems);
            Dictionary <UniqueItemHash, List <IStorePropertyBag> > dictionary = new Dictionary <UniqueItemHash, List <IStorePropertyBag> >();

            foreach (IStorePropertyBag storePropertyBag in propertyBags)
            {
                StoreObjectId  storeObjectId = storePropertyBag.TryGetProperty(StoreObjectSchema.ParentItemId) as StoreObjectId;
                UniqueItemHash key           = UniqueItemHash.Create(storePropertyBag, storeObjectId.Equals(defaultFolderId2));
                if (dictionary.ContainsKey(key))
                {
                    if (storeObjectId.Equals(defaultFolderId))
                    {
                        dictionary[key].Insert(0, storePropertyBag);
                    }
                    else if (storeObjectId.Equals(defaultFolderId2))
                    {
                        StoreObjectId storeObjectId2 = dictionary[key][0].TryGetProperty(StoreObjectSchema.ParentItemId) as StoreObjectId;
                        if (storeObjectId2.Equals(defaultFolderId))
                        {
                            dictionary[key].Insert(1, storePropertyBag);
                        }
                        else
                        {
                            dictionary[key].Insert(0, storePropertyBag);
                        }
                    }
                    else
                    {
                        dictionary[key].Add(storePropertyBag);
                    }
                }
                else
                {
                    dictionary.Add(key, new List <IStorePropertyBag>
                    {
                        storePropertyBag
                    });
                }
            }
            return(dictionary);
        }
Пример #10
0
        public static void BuildFolderTree(MailboxSession mailboxSession, SyncState syncState)
        {
            StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Root);

            SharingSubscriptionData[] array = null;
            using (SharingSubscriptionManager sharingSubscriptionManager = new SharingSubscriptionManager(mailboxSession))
            {
                array = sharingSubscriptionManager.GetAll();
            }
            using (Folder folder = Folder.Bind(mailboxSession, defaultFolderId))
            {
                FolderTree folderTree;
                using (QueryResult queryResult = folder.FolderQuery(FolderQueryFlags.DeepTraversal, null, null, FolderTree.fetchProperties))
                {
                    folderTree = new FolderTree();
                    object[][] rows;
                    do
                    {
                        rows = queryResult.GetRows(10000);
                        for (int i = 0; i < rows.Length; i++)
                        {
                            MailboxSyncItemId mailboxSyncItemId  = MailboxSyncItemId.CreateForNewItem(((VersionedId)rows[i][0]).ObjectId);
                            MailboxSyncItemId mailboxSyncItemId2 = MailboxSyncItemId.CreateForNewItem((StoreObjectId)rows[i][1]);
                            folderTree.AddFolder(mailboxSyncItemId);
                            object obj = rows[i][3];
                            int    num = (obj is PropertyError) ? 0 : ((int)obj);
                            if ((num & 1073741824) != 0)
                            {
                                for (int j = 0; j < array.Length; j++)
                                {
                                    if (array[j].LocalFolderId.Equals(mailboxSyncItemId.NativeId))
                                    {
                                        folderTree.SetPermissions(mailboxSyncItemId, SyncPermissions.Readonly);
                                        folderTree.SetOwner(mailboxSyncItemId, array[j].SharerIdentity);
                                        break;
                                    }
                                }
                            }
                            if (!defaultFolderId.Equals(mailboxSyncItemId2.NativeId))
                            {
                                folderTree.AddFolder(mailboxSyncItemId2);
                                folderTree.LinkChildToParent(mailboxSyncItemId2, mailboxSyncItemId);
                            }
                            if ((bool)rows[i][2])
                            {
                                folderTree.SetHidden(mailboxSyncItemId, true);
                            }
                        }
                    }while (rows.Length != 0);
                }
                syncState[CustomStateDatumType.FullFolderTree]         = folderTree;
                syncState[CustomStateDatumType.RecoveryFullFolderTree] = syncState[CustomStateDatumType.FullFolderTree];
            }
        }
Пример #11
0
 internal static DefaultFolderType?GetDefaultFolderType(MailboxSession session, StoreObjectId folderId)
 {
     foreach (DefaultFolderType defaultFolderType in ElcMailboxHelper.DefaultFolderTypeList)
     {
         if (folderId.Equals(session.GetDefaultFolderId(defaultFolderType)))
         {
             return(new DefaultFolderType?(defaultFolderType));
         }
     }
     return(null);
 }
 // Token: 0x060007B1 RID: 1969 RVA: 0x0003701C File Offset: 0x0003521C
 private static bool ShouldIgnoreFolder(MailboxSession itemStore, StoreObjectId folderId)
 {
     foreach (DefaultFolderType defaultFolderType in OldMessageDeletion.FoldersToIgnore)
     {
         StoreObjectId defaultFolderId = itemStore.GetDefaultFolderId(defaultFolderType);
         if (defaultFolderId != null && defaultFolderId.Equals(folderId))
         {
             return(true);
         }
     }
     return(CalendarAssistant.IsDumpsterFolder(itemStore, folderId));
 }
Пример #13
0
 public static bool IsPrimaryMailFolder(StoreObjectId id, UserContext userContext)
 {
     if (id == null)
     {
         throw new ArgumentNullException("id");
     }
     if (userContext == null)
     {
         throw new ArgumentNullException("userContext");
     }
     return(id.Equals(userContext.GetDeletedItemsFolderId(userContext.MailboxSession).StoreObjectId) || id.Equals(userContext.DraftsFolderId) || id.Equals(userContext.InboxFolderId) || id.Equals(userContext.JunkEmailFolderId) || id.Equals(userContext.SentItemsFolderId));
 }
        private static bool IsRootMessage(Conversation conversation, ICorePropertyBag messagePropertyBag)
        {
            StoreObjectId rootMessageId = conversation.RootMessageId;

            if (rootMessageId == null)
            {
                return(false);
            }
            VersionedId valueOrDefault = messagePropertyBag.GetValueOrDefault <VersionedId>(ItemSchema.Id, null);

            return(rootMessageId.Equals(valueOrDefault.ObjectId));
        }
Пример #15
0
        private RuleEvaluationContext CreateEvaluationContext(StoreDriverDeliveryEventArgsImpl deliveryEventArguments)
        {
            MailboxSession mailboxSession = deliveryEventArguments.MailboxSession;
            string         className      = deliveryEventArguments.ReplayItem.ClassName;
            StoreObjectId  storeObjectId  = mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox);
            bool           flag           = deliveryEventArguments.DeliverToFolder != null;

            if (!string.IsNullOrEmpty(className))
            {
                StoreObjectId receiveFolder = mailboxSession.GetReceiveFolder(className);
                if (receiveFolder != null && !receiveFolder.Equals(storeObjectId))
                {
                    deliveryEventArguments.ShouldRunMailboxRulesBasedOnDeliveryFolder = true;
                    deliveryEventArguments.DeliverToFolder = receiveFolder;
                }
            }
            bool flag2 = false;

            if (deliveryEventArguments.ShouldRunMailboxRulesBasedOnDeliveryFolder && deliveryEventArguments.DeliverToFolder != null && !deliveryEventArguments.DeliverToFolder.Equals(storeObjectId))
            {
                flag2         = true;
                storeObjectId = StoreId.GetStoreObjectId(deliveryEventArguments.DeliverToFolder);
            }
            bool   processingTestMessage = this.testMessageConfig.ReportToAddress.IsValidAddress && (this.testMessageConfig.LogTypes & LogTypesEnum.InboxRules) != LogTypesEnum.None;
            long   mimeStreamLength      = deliveryEventArguments.MailItem.MimeStreamLength;
            Folder folder = null;
            RuleEvaluationContext ruleEvaluationContext = null;

            try
            {
                folder = Folder.Bind(mailboxSession, storeObjectId, RuleEvaluationContextBase.AdditionalFolderProperties);
                ruleEvaluationContext = RuleEvaluationContext.Create(this.server, folder, deliveryEventArguments.ReplayItem, mailboxSession, (string)deliveryEventArguments.MailRecipient.Email, deliveryEventArguments.ADRecipientCache, mimeStreamLength, processingTestMessage, this.testMessageConfig.ShouldExecuteDisabledAndInErrorRules, deliveryEventArguments.MailItemDeliver);
                ruleEvaluationContext.TraceDebug(string.Format("Initial folder name: {0}, ID: {1}, requested by previous agent: {2}, overridden by receive-folder table: {3}", new object[]
                {
                    folder.DisplayName,
                    folder.Id,
                    flag,
                    flag2
                }));
            }
            finally
            {
                if (ruleEvaluationContext == null && folder != null)
                {
                    folder.Dispose();
                    folder = null;
                }
            }
            return(ruleEvaluationContext);
        }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     try
     {
         base.InternalProcessRecord();
         if (!base.HasErrors)
         {
             ADUser            user         = this.DataObject as ADUser;
             ExchangePrincipal mailboxOwner = ExchangePrincipal.FromADUser(base.SessionSettings, user);
             using (MailboxSession mailboxSession = MailboxSession.OpenAsAdmin(mailboxOwner, CultureInfo.InvariantCulture, "Client=Management;Action=Disable-ServiceEmailChannel"))
             {
                 using (Folder folder = Folder.Bind(mailboxSession, DefaultFolderType.Root))
                 {
                     StoreObjectId receiveFolder = mailboxSession.GetReceiveFolder("IPM.Note.Custom.ServiceEmail");
                     mailboxSession.ClearReceiveFolder("IPM.Note.Custom.ServiceEmail");
                     StoreObjectId receiveFolder2 = mailboxSession.GetReceiveFolder("IPM.Note.Custom.ServiceEmail");
                     if (receiveFolder != null && (receiveFolder2 == null || !receiveFolder2.Equals(receiveFolder)))
                     {
                         using (Folder folder2 = Folder.Bind(folder.Session, receiveFolder))
                         {
                             if ((string)folder2[StoreObjectSchema.DisplayName] != null && (string)folder2[StoreObjectSchema.DisplayName] == "Service E-Mail")
                             {
                                 folder.DeleteObjects(DeleteItemFlags.HardDelete, new StoreId[]
                                 {
                                     receiveFolder
                                 });
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (StorageTransientException ex)
     {
         TaskLogger.LogError(ex);
         base.WriteError(ex, ErrorCategory.ReadError, this.DataObject);
     }
     catch (StoragePermanentException ex2)
     {
         TaskLogger.LogError(ex2);
         base.WriteError(ex2, ErrorCategory.InvalidOperation, this.DataObject);
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }
 // Token: 0x0600091F RID: 2335 RVA: 0x000419BC File Offset: 0x0003FBBC
 public int GetEntryIndexByFolderId(StoreObjectId folderId)
 {
     if (folderId == null)
     {
         return(-1);
     }
     for (int i = 0; i < this.cacheLength; i++)
     {
         if (folderId.Equals(this.cacheEntries[i].FolderId))
         {
             return(i);
         }
     }
     return(-1);
 }
        public int Process(bool markAsClutter, IConversationTree conversationTree, List <GroupOperationResult> results)
        {
            ArgumentValidator.ThrowIfNull("results", results);
            int           num            = 0;
            StoreObjectId storeObjectId  = markAsClutter ? this.mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox) : this.mailboxSession.GetDefaultFolderId(DefaultFolderType.Clutter);
            StoreObjectId storeObjectId2 = markAsClutter ? this.mailboxSession.GetDefaultFolderId(DefaultFolderType.Clutter) : this.mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox);

            if (storeObjectId == null || storeObjectId2 == null)
            {
                return(num);
            }
            List <StoreObjectId> list = new List <StoreObjectId>();

            foreach (IConversationTreeNode conversationTreeNode in conversationTree)
            {
                for (int i = 0; i < conversationTreeNode.StorePropertyBags.Count; i++)
                {
                    StoreId id = conversationTreeNode.StorePropertyBags[i].TryGetProperty(ItemSchema.Id) as StoreId;
                    if (storeObjectId.Equals(conversationTreeNode.StorePropertyBags[i].TryGetProperty(StoreObjectSchema.ParentItemId) as StoreObjectId))
                    {
                        list.Add(StoreId.GetStoreObjectId(id));
                    }
                }
            }
            if (list.Count > 0)
            {
                try
                {
                    using (Folder folder = Folder.Bind(this.mailboxSession, storeObjectId))
                    {
                        using (Folder folder2 = Folder.Bind(this.mailboxSession, storeObjectId2))
                        {
                            GroupOperationResult groupOperationResult = folder.MoveItems(folder2.Id, list.ToArray());
                            results.Add(groupOperationResult);
                            if (groupOperationResult.OperationResult != OperationResult.Failed)
                            {
                                num += groupOperationResult.ObjectIds.Count;
                            }
                        }
                    }
                }
                catch (LocalizedException storageException)
                {
                    results.Add(new GroupOperationResult(OperationResult.Failed, list, storageException));
                }
            }
            return(num);
        }
Пример #19
0
 public override bool TryGetPropertyBag(StoreObjectId itemId, out IStorePropertyBag bag)
 {
     bag = null;
     if (!this.HasData || itemId == null)
     {
         return(false);
     }
     foreach (IStorePropertyBag storePropertyBag in this.StorePropertyBags)
     {
         if (itemId.Equals(ConversationTreeNode.RetrieveStoreObjectId(storePropertyBag)))
         {
             bag = storePropertyBag;
             return(true);
         }
     }
     return(false);
 }
Пример #20
0
        public bool IsSearchInProgress(StoreObjectId folderId)
        {
            bool result = false;

            if (!this.userContext.LockedByCurrentThread())
            {
                throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
            }
            lock (this)
            {
                if (this.searchFolderIdCurrent != null && folderId.Equals(this.searchFolderIdCurrent.StoreObjectId) && !this.isTopPageSearchComplete)
                {
                    result = true;
                }
            }
            return(result);
        }
Пример #21
0
        // Token: 0x0600029D RID: 669 RVA: 0x00017554 File Offset: 0x00015754
        private void RenderFolder(StoreObjectId folderId, string folderDisplayName, int count, ContentCountDisplay contentCountDisplay, SecondaryNavigationArea secondaryNavigationArea, TextWriter writer)
        {
            UserContext userContext = this.owaContext.UserContext;

            writer.Write("<tr><td nowrap class=\"fld");
            if (this.selectedUsing == secondaryNavigationArea && folderId.Equals(this.selectedFolderId))
            {
                writer.Write(" sl");
            }
            if (count > 0)
            {
                writer.Write(" bld");
            }
            writer.Write("\"><a name=\"lnkFldr\" href=\"?ae=Folder&t=IPF.Note&id=");
            writer.Write(Utilities.UrlEncode(folderId.ToBase64String()));
            writer.Write("&slUsng=");
            writer.Write((int)secondaryNavigationArea);
            if (secondaryNavigationArea == SecondaryNavigationArea.Mru)
            {
                writer.Write("&mru=1");
            }
            writer.Write("\" title=\"");
            Utilities.HtmlEncode(folderDisplayName, writer);
            writer.Write("\">");
            writer.Write("<img src=\"");
            RenderingUtilities.RenderSpecialFolderIcon(writer, userContext, "IPF.Note", folderId);
            writer.Write("\" alt=\"\">");
            Utilities.CropAndRenderText(writer, folderDisplayName, 24);
            writer.Write(" </a>");
            if (count > 0)
            {
                if (contentCountDisplay == ContentCountDisplay.ItemCount)
                {
                    writer.Write("<span class=\"itm\">[");
                    writer.Write(count);
                    writer.Write("]</span>");
                }
                else if (contentCountDisplay == ContentCountDisplay.UnreadCount)
                {
                    writer.Write("<span class=\"unrd\">(");
                    writer.Write(count);
                    writer.Write(")</span>");
                }
            }
            writer.Write("</td></tr>");
        }
Пример #22
0
        // Token: 0x060002CD RID: 717 RVA: 0x00010E44 File Offset: 0x0000F044
        internal string GetFolderPathFromId(StoreObjectId folderId)
        {
            string result = null;

            foreach (object[] array in this.entireFolderList)
            {
                if (ElcMailboxHelper.Exists(array[0]))
                {
                    StoreObjectId objectId = ((VersionedId)array[0]).ObjectId;
                    if (objectId.Equals(folderId))
                    {
                        result = (ElcMailboxHelper.Exists(array[7]) ? ((string)array[7]) : null);
                        break;
                    }
                }
            }
            return(result);
        }
        // Token: 0x06000783 RID: 1923 RVA: 0x0003546C File Offset: 0x0003366C
        private static bool ShouldIgnoreMessage(MailboxSession itemStore, StoreObjectId folderId, MeetingMessage mtgMessage)
        {
            foreach (DefaultFolderType defaultFolderType in CalendarAssistant.FoldersToIgnore)
            {
                StoreObjectId defaultFolderId = itemStore.GetDefaultFolderId(defaultFolderType);
                if (defaultFolderId != null && defaultFolderId.Equals(folderId))
                {
                    return(true);
                }
            }
            StoreObjectId defaultFolderId2 = itemStore.GetDefaultFolderId(DefaultFolderType.DeletedItems);

            if (defaultFolderId2 != null && defaultFolderId2.Equals(folderId) && mtgMessage != null && mtgMessage is MeetingRequest)
            {
                return(!OldMessageDeletion.IsSelfForwardedEvent(mtgMessage, itemStore));
            }
            return(CalendarAssistant.IsDumpsterFolder(itemStore, folderId));
        }
 private UserMoveActionHandler(MailboxSession mailboxSession, StoreObjectId sourceFolderId, StoreObjectId destinationFolderId, IList <StoreObjectId> itemIds, bool isUserInitiatedMove)
 {
     ArgumentValidator.ThrowIfNull("mailboxSession", mailboxSession);
     ArgumentValidator.ThrowIfNull("sourceFolderId", sourceFolderId);
     ArgumentValidator.ThrowIfNull("destinationFolderId", destinationFolderId);
     ArgumentValidator.ThrowIfNull("itemIds", itemIds);
     if (sourceFolderId.Equals(destinationFolderId))
     {
         throw new ArgumentException("sourceFolderId should not equal destinationFolderId");
     }
     this.mailboxSession      = mailboxSession;
     this.sourceFolderId      = sourceFolderId;
     this.destinationFolderId = destinationFolderId;
     this.itemIds             = (from id in itemIds
                                 where id != null
                                 select id).Distinct <StoreObjectId>().ToList <StoreObjectId>();
     this.isUserInitiatedMove      = isUserInitiatedMove;
     this.interpretedClutterAction = this.InterpretClutterAction();
 }
Пример #25
0
        public static bool IsDefaultFolderId(StoreSession session, StoreObjectId folderId, DefaultFolderType defaultFolderType)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            if (folderId == null)
            {
                throw new ArgumentNullException("folderId");
            }
            MailboxSession mailboxSession = session as MailboxSession;

            if (mailboxSession == null)
            {
                return(false);
            }
            StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(defaultFolderType);

            return(defaultFolderId != null && folderId.Equals(defaultFolderId));
        }
Пример #26
0
        private void Initialize(MailboxSession session, bool isMyMailbox, StoreObjectId folderId, object recordKey, ExtendedFolderFlags flags, Guid groupClassId, string groupName)
        {
            StoreObjectId storeObjectId = Utilities.TryGetDefaultFolderId(session, DefaultFolderType.Root);

            if (storeObjectId != null && storeObjectId.Equals(folderId))
            {
                throw new NotSupportedException("We don't support adding root folder to favorites.");
            }
            if (!session.IsRemote)
            {
                this.NavigationNodeStoreEntryId = StoreEntryId.ToProviderStoreEntryId(session.MailboxOwner);
            }
            this.NavigationNodeEntryId = folderId.ProviderLevelItemId;
            if (recordKey is byte[])
            {
                this.NavigationNodeRecordKey = (byte[])recordKey;
            }
            StoreObjectId storeObjectId2 = Utilities.TryGetDefaultFolderId(session, DefaultFolderType.ToDoSearch);

            if (storeObjectId2 != null && storeObjectId2.Equals(folderId))
            {
                base.NavigationNodeFlags |= NavigationNodeFlags.TodoFolder;
            }
            foreach (KeyValuePair <ExtendedFolderFlags, NavigationNodeFlags> keyValuePair in NavigationNodeFolder.mappingFromFolderFlagToNodeFlag)
            {
                if (Utilities.IsFlagSet((int)flags, (int)keyValuePair.Key))
                {
                    base.NavigationNodeFlags |= keyValuePair.Value;
                }
            }
            if (isMyMailbox)
            {
                base.NavigationNodeFlags |= NavigationNodeFlags.IsDefaultStore;
            }
            if (!base.IsFavorites)
            {
                this.NavigationNodeParentGroupClassId = groupClassId;
                this.NavigationNodeGroupName          = groupName;
            }
        }
Пример #27
0
        // Token: 0x06001F8D RID: 8077 RVA: 0x000B5D14 File Offset: 0x000B3F14
        private void RenderConversationPartMetaDataExpandos(TextWriter writer, IConversationTreeNode current, Folder dataFolder, StoreObjectId currentFolderId, ExDateTime?lastDeliveryTime)
        {
            base.RenderMessageViewItemMetaDataExpandos(writer);
            if (lastDeliveryTime != null && this.DataSource.GetItemProperty <ExDateTime>(ItemSchema.ReceivedTime, ExDateTime.MinValue) == lastDeliveryTime)
            {
                writer.Write(" ");
                writer.Write("fLR");
                writer.Write("=");
                writer.Write(1);
            }
            if (current.ParentNode != null && current.ParentNode.ParentNode != null)
            {
                VersionedId versionedId = (VersionedId)current.ParentNode.StorePropertyBags[0].TryGetProperty(ItemSchema.Id);
                if (versionedId != null)
                {
                    writer.Write(" ");
                    writer.Write("pId");
                    writer.Write("=");
                    Utilities.HtmlEncode(Utilities.GetItemIdString(versionedId.ObjectId, dataFolder), writer);
                }
            }
            writer.Write(" ");
            writer.Write("fId");
            writer.Write("=");
            Utilities.HtmlEncode(currentFolderId.ToBase64String(), writer);
            StoreObjectId storeObjectId = base.UserContext.GetDeletedItemsFolderId((MailboxSession)dataFolder.Session).StoreObjectId;

            writer.Write(" ");
            writer.Write("fInDelItms");
            writer.Write("=");
            Utilities.HtmlEncode(currentFolderId.Equals(storeObjectId) ? "1" : "0", writer);
            bool flag = Utilities.IsDefaultFolderId(base.UserContext.MailboxSession, currentFolderId, DefaultFolderType.JunkEmail);

            writer.Write(" ");
            writer.Write("fJnk");
            writer.Write("=");
            writer.Write(flag ? "1" : "0");
        }
        // Token: 0x0600077A RID: 1914 RVA: 0x00034F74 File Offset: 0x00033174
        private void HandlePermissionChange(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item, List <KeyValuePair <string, object> > customDataToLog)
        {
            if (mapiEvent.ItemEntryId == null || itemStore.IsGroupMailbox())
            {
                return;
            }
            StoreObjectId storeObjectId   = StoreObjectId.FromProviderSpecificId(mapiEvent.ItemEntryId, StoreObjectType.Folder);
            StoreObjectId defaultFolderId = itemStore.GetDefaultFolderId(DefaultFolderType.Root);

            if (storeObjectId != null && defaultFolderId != null)
            {
                if (!storeObjectId.Equals(defaultFolderId) && !ObjectClass.IsCalendarFolder(mapiEvent.ObjectClass))
                {
                    return;
                }
                using (Folder folder = Folder.Bind(itemStore, storeObjectId))
                {
                    string text = CalendarLoggingHelper.GetCalendarPermissionsLog(itemStore, folder);
                    if (!string.IsNullOrEmpty(text))
                    {
                        text = string.Format("Client Type: {0} New Permission Table:\n{1}", mapiEvent.ClientType, text);
                    }
                    else
                    {
                        text = string.Format("Client Type: {0} Mailbox session or folder was null", mapiEvent.ClientType);
                    }
                    CalendarPermissionsLog.LogEntry(itemStore, text, new object[0]);
                    return;
                }
            }
            if (storeObjectId == null)
            {
                CalendarAssistant.GeneralTracer.TraceError <object, byte[]>((long)this.GetHashCode(), "{0}: Unable to bind to a calendar folder with FolderId {1}", TraceContext.Get(), mapiEvent.ItemEntryId);
                return;
            }
            CalendarAssistant.GeneralTracer.TraceError <object, Guid>((long)this.GetHashCode(), "{0}: Unable to bind to the root folder for Mailbox {1}", TraceContext.Get(), mapiEvent.MailboxGuid);
        }
Пример #29
0
        internal bool HandleSearchNotification(StoreObjectId folderId, int itemCount, ref bool isFirstPageSearchNotification, ref OwaStoreObjectId owaFolderId)
        {
            bool result = false;

            if (this.searchFolderIdCurrent != null && folderId.Equals(this.searchFolderIdCurrent.StoreObjectId))
            {
                if (itemCount != -1 && itemCount >= 50 && !this.isTopPageSearchComplete)
                {
                    if (this.searchPerformanceData != null)
                    {
                        this.searchPerformanceData.FirstPage(itemCount);
                    }
                    this.isTopPageSearchComplete  = true;
                    isFirstPageSearchNotification = true;
                    owaFolderId = this.searchFolderIdCurrent;
                }
                result = true;
            }
            else if (this.searchFolderDeleteList != null && this.searchFolderDeleteList.Contains(folderId))
            {
                result = true;
            }
            return(result);
        }
 // Token: 0x060002F4 RID: 756 RVA: 0x00012894 File Offset: 0x00010A94
 private void CheckIfSourceEqualsDestination(StoreObjectId originalDestFolderId, string originalDestinationFolderName)
 {
     if (!originalDestFolderId.Equals(this.sourceFolder.Folder.Id.ObjectId))
     {
         return;
     }
     if (this.sourceFolder.InheritedPolicy)
     {
         MovePolicyItems.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Policy: '{1}' on folder: '{2}'. The destination folder '{3}' is same as the current source folder '{4}'. Since this policy was inherited from a parent, skip this folder.", new object[]
         {
             this,
             this.elcPolicy.Name,
             this.elcPolicy.ManagedFolderName,
             originalDestinationFolderName,
             this.sourceFolder.DisplayName
         });
         throw new SkipFolderException(Strings.descExpiryDestSameAsSource(this.sourceFolder.DisplayName, this.mailboxData.MailboxSmtpAddress, this.elcPolicy.Name));
     }
     MovePolicyItems.Tracer.TraceError((long)this.GetHashCode(), "{0}: Invalid policy: '{1}' on folder: '{2}'. The destination folder '{3}' is same as the current source folder '{4}'.", new object[]
     {
         this,
         this.elcPolicy.Name,
         this.elcPolicy.ManagedFolderName,
         originalDestinationFolderName,
         this.sourceFolder.DisplayName
     });
     Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_DestinationFolderSameAsSource, null, new object[]
     {
         this.sourceFolder.DisplayName,
         this.mailboxData.MailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(),
         this.elcPolicy.Name,
         this.elcPolicy.ManagedFolderName,
         originalDestinationFolderName
     });
     throw new InvalidExpiryDestinationException(Strings.descExpiryDestSameAsSource(this.sourceFolder.DisplayName, this.mailboxData.MailboxSmtpAddress, this.elcPolicy.Name));
 }