예제 #1
0
        private void UpdateAssociatedSearchFolderLastUsedTime()
        {
            VersionedId versionedId = OutlookSearchFolder.FindAssociatedMessageId((MailboxSession)base.Session, (Guid)this[InternalSchema.OutlookSearchFolderClsId]);

            if (versionedId != null)
            {
                using (MessageItem messageItem = MessageItem.Bind(base.Session, versionedId))
                {
                    int num = OutlookSearchFolder.ConvertUtcDateTimeToRTime(ExDateTime.UtcNow);
                    messageItem[MessageItemSchema.AssociatedSearchFolderLastUsedTime] = num;
                    messageItem.Save(SaveMode.NoConflictResolution);
                    return;
                }
            }
            ExTraceGlobals.StorageTracer.Information <string>((long)this.GetHashCode(), "OutlookSearchFolder::UpdateAssociatedSearchFolderLastUsedTime. Failed to update the last used time of the search folder in its associated message. Associated message not found. SearchFolder DisplayName = {0}.", base.DisplayName);
        }
예제 #2
0
        private void CreateOrHijackAssociatedMessage(VersionedId associatedMessageId, SearchFolderCriteria criteria)
        {
            MailboxSession mailboxSession = (MailboxSession)base.Session;
            MessageItem    messageItem    = null;

            try
            {
                if (associatedMessageId == null)
                {
                    messageItem = MessageItem.CreateAssociated(base.Session, mailboxSession.SafeGetDefaultFolderId(DefaultFolderType.CommonViews));
                }
                else
                {
                    messageItem = MessageItem.Bind(base.Session, associatedMessageId);
                }
                messageItem[InternalSchema.ItemClass] = "IPM.Microsoft.WunderBar.SFInfo";
                messageItem[InternalSchema.AssociatedSearchFolderId] = ((Guid)this[InternalSchema.OutlookSearchFolderClsId]).ToByteArray();
                messageItem[InternalSchema.DisplayName] = this[FolderSchema.DisplayName];
                messageItem[ItemSchema.Subject]         = this[FolderSchema.DisplayName];
                ExtendedFolderFlags?valueAsNullable = base.GetValueAsNullable <ExtendedFolderFlags>(FolderSchema.ExtendedFolderFlags);
                if (valueAsNullable != null)
                {
                    messageItem[InternalSchema.AssociatedSearchFolderFlags] = valueAsNullable.Value;
                }
                int num = OutlookSearchFolder.ConvertUtcDateTimeToRTime(ExDateTime.UtcNow);
                messageItem[InternalSchema.AssociatedSearchFolderLastUsedTime] = num;
                messageItem[InternalSchema.AssociatedSearchFolderExpiration]   = num;
                messageItem[InternalSchema.AssociatedSearchFolderTemplateId]   = 1;
                messageItem[InternalSchema.AssociatedSearchFolderTag]          = 0;
                this.WriteOutlookSearchFolderDefinitionBlob(messageItem, criteria);
                messageItem[InternalSchema.AssociatedSearchFolderStorageType] = 72;
                messageItem.Save(SaveMode.FailOnAnyConflict);
            }
            finally
            {
                if (messageItem != null)
                {
                    messageItem.Dispose();
                    messageItem = null;
                }
            }
        }