Ejemplo n.º 1
0
        public static OwaStoreObjectId CreateFromStoreObjectId(StoreObjectId storeObjectId, OwaStoreObjectId relatedStoreObjectId)
        {
            if (storeObjectId == null)
            {
                throw new ArgumentNullException("storeObjectId");
            }
            StoreObjectId        storeObjectId2       = null;
            OwaStoreObjectIdType owaStoreObjectIdType = OwaStoreObjectIdType.MailBoxObject;

            if (IdConverter.IsFromPublicStore(storeObjectId))
            {
                if (IdConverter.IsMessageId(storeObjectId))
                {
                    owaStoreObjectIdType = OwaStoreObjectIdType.PublicStoreItem;
                    storeObjectId2       = IdConverter.GetParentIdFromMessageId(storeObjectId);
                }
                else
                {
                    owaStoreObjectIdType = OwaStoreObjectIdType.PublicStoreFolder;
                }
            }
            else if (relatedStoreObjectId != null)
            {
                if (!relatedStoreObjectId.IsConversationId)
                {
                    owaStoreObjectIdType = relatedStoreObjectId.OwaStoreObjectIdType;
                }
                else if (relatedStoreObjectId.OwaStoreObjectIdType == OwaStoreObjectIdType.ArchiveConversation)
                {
                    owaStoreObjectIdType = OwaStoreObjectIdType.ArchiveMailboxObject;
                }
            }
            return(new OwaStoreObjectId(owaStoreObjectIdType, storeObjectId, storeObjectId2, (relatedStoreObjectId == null) ? null : relatedStoreObjectId.MailboxOwnerLegacyDN));
        }
Ejemplo n.º 2
0
        private ReplayAction TryConvertToAction(Activity activity, IActionWatermark watermark)
        {
            ActivityId id = activity.Id;

            switch (id)
            {
            case ActivityId.Move:
                if (IdConverter.IsMessageId(activity.ItemId))
                {
                    byte[] array;
                    byte[] itemAndFolderId = StorageActionsSource.GetItemAndFolderId(activity.ItemId, out array);
                    byte[] prevFolderId;
                    StorageActionsSource.GetItemAndFolderId(activity.PreviousItemId, out prevFolderId);
                    DefaultFolderType defaultFolderType = this.mailboxSession.IsDefaultFolderType(StoreObjectId.FromProviderSpecificId(array, StoreObjectType.Folder));
                    if (defaultFolderType == DefaultFolderType.RecoverableItemsDeletions || defaultFolderType == DefaultFolderType.RecoverableItemsPurges)
                    {
                        return(new DeleteAction(itemAndFolderId, array, prevFolderId, watermark.SerializeToString()));
                    }
                    return(new MoveAction(itemAndFolderId, array, prevFolderId, watermark.SerializeToString()));
                }
                break;

            case ActivityId.Flag:
            {
                byte[] array;
                byte[] itemAndFolderId = StorageActionsSource.GetItemAndFolderId(activity.ItemId, out array);
                return(new FlagAction(itemAndFolderId, array, watermark.SerializeToString()));
            }

            case ActivityId.FlagComplete:
            {
                byte[] array;
                byte[] itemAndFolderId = StorageActionsSource.GetItemAndFolderId(activity.ItemId, out array);
                return(new FlagCompleteAction(itemAndFolderId, array, watermark.SerializeToString()));
            }

            case ActivityId.FlagCleared:
            {
                byte[] array;
                byte[] itemAndFolderId = StorageActionsSource.GetItemAndFolderId(activity.ItemId, out array);
                return(new FlagClearAction(itemAndFolderId, array, watermark.SerializeToString()));
            }

            case ActivityId.Categorize:
            case ActivityId.InspectorDisplayStart:
            case ActivityId.InspectorDisplayEnd:
                break;

            case ActivityId.MarkAsRead:
            {
                byte[] array;
                byte[] itemAndFolderId = StorageActionsSource.GetItemAndFolderId(activity.ItemId, out array);
                return(new MarkAsReadAction(itemAndFolderId, array, watermark.SerializeToString()));
            }

            case ActivityId.MarkAsUnread:
            {
                byte[] array;
                byte[] itemAndFolderId = StorageActionsSource.GetItemAndFolderId(activity.ItemId, out array);
                return(new MarkAsUnReadAction(itemAndFolderId, array, watermark.SerializeToString()));
            }

            default:
                switch (id)
                {
                case ActivityId.RemoteSend:
                {
                    string[] recipients;
                    byte[]   mimeData = this.GetMimeData(activity.ItemId, out recipients);
                    byte[]   array;
                    byte[]   itemAndFolderId = StorageActionsSource.GetItemAndFolderId(activity.ItemId, out array);
                    return(new SendAction(itemAndFolderId, array, watermark.SerializeToString())
                        {
                            Data = mimeData,
                            Recipients = recipients
                        });
                }

                case ActivityId.CreateCalendarEvent:
                {
                    byte[]         array;
                    byte[]         itemAndFolderId = StorageActionsSource.GetItemAndFolderId(activity.ItemId, out array);
                    IList <Event>  exceptionalOccurrences;
                    IList <string> deletedOccurrences;
                    Event          calendarEventData = this.GetCalendarEventData(activity, out exceptionalOccurrences, out deletedOccurrences);
                    if (calendarEventData == null)
                    {
                        return(null);
                    }
                    return(new CreateCalendarEventAction(itemAndFolderId, array, watermark.SerializeToString(), calendarEventData, exceptionalOccurrences, deletedOccurrences));
                }

                case ActivityId.UpdateCalendarEvent:
                {
                    byte[]         array;
                    byte[]         itemAndFolderId = StorageActionsSource.GetItemAndFolderId(activity.ItemId, out array);
                    IList <Event>  exceptionalOccurrences2;
                    IList <string> deletedOccurrences2;
                    Event          calendarEventData2 = this.GetCalendarEventData(activity, out exceptionalOccurrences2, out deletedOccurrences2);
                    if (calendarEventData2 == null)
                    {
                        return(null);
                    }
                    return(new UpdateCalendarEventAction(itemAndFolderId, array, watermark.SerializeToString(), calendarEventData2, exceptionalOccurrences2, deletedOccurrences2));
                }
                }
                break;
            }
            return(null);
        }