// Token: 0x06001AD4 RID: 6868 RVA: 0x00065E44 File Offset: 0x00064044
        internal static AttachmentIdType GetEwsAttachmentIdType(CallContext callContext, VersionedId itemId, string ewsAttachmentId)
        {
            IdAndSession idAndSession = GetWacAttachmentInfo.GetIdAndSession(callContext, ewsAttachmentId, true);
            ConcatenatedIdAndChangeKey concatenatedId = IdConverter.GetConcatenatedId(itemId, idAndSession, null);

            return(new AttachmentIdType
            {
                Id = ewsAttachmentId,
                RootItemId = concatenatedId.Id
            });
        }
Ejemplo n.º 2
0
            public static ItemId GetItemId(IdAndSession idAndSession, StoreId storeId)
            {
                ConcatenatedIdAndChangeKey concatenatedIdAndChangeKey;

                if (idAndSession.Session is PublicFolderSession)
                {
                    concatenatedIdAndChangeKey = IdConverter.GetConcatenatedIdForPublicFolderItem(storeId, StoreId.GetStoreObjectId(idAndSession.ParentFolderId), null);
                }
                else
                {
                    concatenatedIdAndChangeKey = IdConverter.GetConcatenatedId(storeId, idAndSession, null);
                }
                return(new ItemId(concatenatedIdAndChangeKey.Id, concatenatedIdAndChangeKey.ChangeKey));
            }
Ejemplo n.º 3
0
        // Token: 0x0600199B RID: 6555 RVA: 0x0005A370 File Offset: 0x00058570
        internal static CreateAttachmentResponse CreateAttachmentResponse(AttachmentHierarchy attachmentHierarchy, Attachment attachment, AttachmentType attachmentType, IdAndSession parentIdAndSession, ServiceError warning)
        {
            IdAndSession idAndSession = parentIdAndSession.Clone();

            attachment.Load();
            idAndSession.AttachmentIds.Add(attachment.Id);
            AttachmentType attachmentType2;

            if (attachment is StreamAttachment)
            {
                attachmentType2 = new FileAttachmentType();
            }
            else if (attachment is ReferenceAttachment)
            {
                attachmentType2 = new ReferenceAttachmentType();
                ((ReferenceAttachmentType)attachmentType2).AttachLongPathName  = (string)attachment.TryGetProperty(AttachmentSchema.AttachLongPathName);
                ((ReferenceAttachmentType)attachmentType2).ProviderType        = (string)attachment.TryGetProperty(AttachmentSchema.AttachmentProviderType);
                ((ReferenceAttachmentType)attachmentType2).ProviderEndpointUrl = (string)attachment.TryGetProperty(AttachmentSchema.AttachmentProviderEndpointUrl);
                object obj = attachment.TryGetProperty(AttachmentSchema.AttachContentId);
                if (!(obj is PropertyError))
                {
                    ((ReferenceAttachmentType)attachmentType2).ContentId = (string)obj;
                }
                attachmentType2.Name = attachmentType.Name;
            }
            else
            {
                attachmentType2 = new ItemAttachmentType();
            }
            attachmentType2.AttachmentId = new AttachmentIdType(idAndSession.GetConcatenatedId().Id);
            if (attachmentType is ItemIdAttachmentType || attachmentType is ReferenceAttachmentType)
            {
                attachmentType2.Size = ((attachment.Size > 2147483647L) ? int.MaxValue : ((int)attachment.Size));
            }
            CreateAttachmentResponse       createAttachmentResponse = new CreateAttachmentResponse();
            ServiceResult <AttachmentType> serviceResult            = (warning == null) ? new ServiceResult <AttachmentType>(attachmentType2) : new ServiceResult <AttachmentType>(attachmentType2, warning);

            attachmentHierarchy.RootItem.Load();
            if (serviceResult.Value != null)
            {
                ConcatenatedIdAndChangeKey concatenatedId = IdConverter.GetConcatenatedId(attachmentHierarchy.RootItem.Id, parentIdAndSession, null);
                serviceResult.Value.AttachmentId.RootItemId        = concatenatedId.Id;
                serviceResult.Value.AttachmentId.RootItemChangeKey = concatenatedId.ChangeKey;
            }
            createAttachmentResponse.AddResponses(new ServiceResult <AttachmentType>[]
            {
                serviceResult
            });
            return(createAttachmentResponse);
        }
Ejemplo n.º 4
0
        protected override ContactFolderResponse InternalExecute()
        {
            ExchangeVersion.Current = ExchangeVersion.Latest;
            MailboxSession mailboxIdentityMailboxSession = base.MailboxIdentityMailboxSession;
            IdAndSession   idAndSession = base.IdConverter.ConvertFolderIdToIdAndSession(this.parentFolderId, IdConverter.ConvertOption.IgnoreChangeKey);
            StoreId        id;

            try
            {
                using (Folder folder = ContactsFolder.Create(mailboxIdentityMailboxSession, idAndSession.Id, StoreObjectType.ContactsFolder, this.displayName, CreateMode.CreateNew))
                {
                    PeopleFilterGroupPriorityManager.SetSortGroupPriorityOnFolder(folder, this.priority);
                    folder.Save();
                    folder.Load(new PropertyDefinition[]
                    {
                        FolderSchema.Id
                    });
                    id = folder.Id;
                }
            }
            catch (ObjectExistedException)
            {
                return(new ContactFolderResponse
                {
                    ResponseCode = ResponseCodeType.ErrorFolderExists.ToString()
                });
            }
            PeopleFilterGroupPriorityManager peopleFilterGroupPriorityManager = new PeopleFilterGroupPriorityManager(mailboxIdentityMailboxSession, new XSOFactory());

            mailboxIdentityMailboxSession.ContactFolders.MyContactFolders.Set(peopleFilterGroupPriorityManager.GetMyContactFolderIds());
            ConcatenatedIdAndChangeKey concatenatedId = IdConverter.GetConcatenatedId(id, new MailboxId(mailboxIdentityMailboxSession), null);

            return(new ContactFolderResponse
            {
                ResponseCode = ResponseCodeType.NoError.ToString(),
                FolderId = new FolderId
                {
                    Id = concatenatedId.Id,
                    ChangeKey = concatenatedId.ChangeKey
                }
            });
        }
        // Token: 0x06001A9A RID: 6810 RVA: 0x00063C00 File Offset: 0x00061E00
        private PeopleFilter MakePeopleFilter(StoreId folderId, StoreId parentId, MailboxId mailboxId, string displayName, int sortGroupPriority, bool isReadOnly)
        {
            ConcatenatedIdAndChangeKey concatenatedId = IdConverter.GetConcatenatedId(folderId, mailboxId, null);
            FolderId parentFolderId = null;

            if (parentId != null)
            {
                parentFolderId = IdConverter.GetFolderIdFromStoreId(parentId, mailboxId);
            }
            return(new PeopleFilter
            {
                DisplayName = displayName,
                FolderId = new FolderId
                {
                    Id = concatenatedId.Id
                },
                ParentFolderId = parentFolderId,
                SortGroupPriority = sortGroupPriority,
                IsReadOnly = isReadOnly
            });
        }
Ejemplo n.º 6
0
        // Token: 0x060019C1 RID: 6593 RVA: 0x0005B6AC File Offset: 0x000598AC
        protected override OnlineMeetingType ProcessOnlineMeetingResult(UserContext userContext, OnlineMeetingResult result)
        {
            OnlineMeetingType result2;

            using (this.CalendarItem)
            {
                if (this.CalendarItem == null)
                {
                    result2 = OnlineMeetingType.CreateFailedOnlineMeetingType("Unable to find existing item corresponding to id: " + this.itemId.Id);
                }
                else
                {
                    this.CalendarItem.OpenAsReadWrite();
                    this.CalendarItem.OnlineMeetingConfLink     = result.OnlineMeeting.MeetingUri;
                    this.CalendarItem.OnlineMeetingExternalLink = result.OnlineMeeting.WebUrl;
                    this.CalendarItem.OnlineMeetingInternalLink = string.Empty;
                    this.CalendarItem.UCOpenedConferenceID      = Guid.NewGuid().ToString("B");
                    this.CalendarItem.ConferenceTelURI          = OutlookAddinAdapter.GetConferenceTelUri(result);
                    Capabilities ucCapabilities = OutlookAddinAdapter.GetUcCapabilities(result, userContext.UserCulture);
                    try
                    {
                        this.CalendarItem.UCCapabilities = OutlookAddinAdapter.Serialize(ucCapabilities);
                    }
                    catch (InvalidOperationException ex)
                    {
                        base.LogAndTraceError("An error occured while serializing UCCapabilities: " + UcwaConfigurationUtilities.BuildFailureLogString(ex));
                        return(OnlineMeetingType.CreateFailedOnlineMeetingType("An error occured while serializing UCCapabilities"));
                    }
                    try
                    {
                        this.CalendarItem.UCInband = OutlookAddinAdapter.Serialize(OutlookAddinAdapter.GetUCInband(result));
                    }
                    catch (InvalidOperationException ex2)
                    {
                        base.LogAndTraceError("An error occured while serializing UCInband: " + UcwaConfigurationUtilities.BuildFailureLogString(ex2));
                        return(OnlineMeetingType.CreateFailedOnlineMeetingType("An error occured while serializing UCInband"));
                    }
                    try
                    {
                        this.CalendarItem.UCMeetingSetting = OutlookAddinAdapter.Serialize(OutlookAddinAdapter.GetUCMeetingSetting(result));
                    }
                    catch (InvalidOperationException ex3)
                    {
                        base.LogAndTraceError("An error occured while serializing UCMeetingSetting: " + UcwaConfigurationUtilities.BuildFailureLogString(ex3));
                        return(OnlineMeetingType.CreateFailedOnlineMeetingType("An error occured while serializing UCMeetingSetting"));
                    }
                    try
                    {
                        PropertyDefinitionStream updatedOutlookUserPropsPropDefStream = OutlookAddinAdapter.GetUpdatedOutlookUserPropsPropDefStream(this.CalendarItem.OutlookUserPropsPropDefStream);
                        this.CalendarItem.OutlookUserPropsPropDefStream = updatedOutlookUserPropsPropDefStream.GetByteArray();
                    }
                    catch (EndOfStreamException ex4)
                    {
                        base.LogAndTraceError("[ProcessOnlineMeetingResult] A read error occurred when parsing OutlookUserPropsPropDefStream: " + UcwaConfigurationUtilities.BuildFailureLogString(ex4));
                        return(OnlineMeetingType.CreateFailedOnlineMeetingType("A read error occured when parsing OutlookUserPropsPropDefStream"));
                    }
                    OnlineMeetingType          onlineMeetingType = CreateOnlineMeeting.CreateOnlineMeetingTypeFromOnlineMeetingResult(result, ucCapabilities, base.CallContext.ProtocolLog);
                    ConcatenatedIdAndChangeKey concatenatedId    = IdConverter.GetConcatenatedId(this.CalendarItem.Id, new MailboxId(this.MailboxSession), null);
                    onlineMeetingType.ItemId = new ItemId(concatenatedId.Id, concatenatedId.ChangeKey);
                    this.CalendarItem.Save(SaveMode.NoConflictResolutionForceSave);
                    result2 = onlineMeetingType;
                }
            }
            return(result2);
        }
        protected static ItemId StoreIdToEwsItemId(StoreId storeId, MailboxId mailboxId)
        {
            ConcatenatedIdAndChangeKey concatenatedId = IdConverter.GetConcatenatedId(storeId, mailboxId, null);

            return(new ItemId(concatenatedId.Id, concatenatedId.ChangeKey));
        }
        // Token: 0x06000D28 RID: 3368 RVA: 0x0003165C File Offset: 0x0002F85C
        protected override NotificationPayloadBase GetPayloadFromNotification(StoreObjectId folderId, QueryNotification notification)
        {
            CalendarItemNotificationPayload calendarItemNotificationPayload = new CalendarItemNotificationPayload();

            calendarItemNotificationPayload.FolderId       = StoreId.StoreIdToEwsId(base.MailboxGuid, folderId);
            calendarItemNotificationPayload.SubscriptionId = base.SubscriptionId;
            calendarItemNotificationPayload.EventType      = notification.EventType;
            calendarItemNotificationPayload.Source         = new MailboxLocation(base.MailboxGuid);
            EwsCalendarItemType ewsCalendarItemType = new EwsCalendarItemType();

            ewsCalendarItemType.InstanceKey      = notification.Index;
            calendarItemNotificationPayload.Item = ewsCalendarItemType;
            if (notification.EventType != QueryNotificationType.RowDeleted)
            {
                VersionedId itemProperty = RowNotificationHandler.GetItemProperty <VersionedId>(notification, 0);
                if (itemProperty == null)
                {
                    ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "Invalid StoreId for calendar item notification.");
                    calendarItemNotificationPayload.Reload = true;
                    return(calendarItemNotificationPayload);
                }
                ConcatenatedIdAndChangeKey concatenatedId = IdConverter.GetConcatenatedId(itemProperty, new MailboxId(base.MailboxGuid), null);
                ewsCalendarItemType.ItemId  = new ItemId(concatenatedId.Id, concatenatedId.ChangeKey);
                ewsCalendarItemType.Start   = base.GetDateTimeProperty(notification, 2);
                ewsCalendarItemType.End     = base.GetDateTimeProperty(notification, 3);
                ewsCalendarItemType.Subject = RowNotificationHandler.GetItemProperty <string>(notification, 4);
                ewsCalendarItemType.LegacyFreeBusyStatusString = BusyTypeConverter.ToString((BusyType)RowNotificationHandler.GetItemProperty <int>(notification, 5));
                ewsCalendarItemType.IsAllDayEvent = RowNotificationHandler.GetItemProperty <bool?>(notification, 6);
                ewsCalendarItemType.IsRecurring   = new bool?(RowNotificationHandler.GetItemProperty <byte[]>(notification, 7) != null);
                if (RowNotificationHandler.IsPropertyDefined(notification, 8))
                {
                    ewsCalendarItemType.Organizer = RowNotificationHandler.CreateRecipientFromParticipant((Participant)notification.Row[8]);
                }
                ewsCalendarItemType.IsMeeting            = RowNotificationHandler.GetItemProperty <bool?>(notification, 9);
                ewsCalendarItemType.MyResponseTypeString = ResponseTypeConverter.ToString((ResponseType)RowNotificationHandler.GetItemProperty <int>(notification, 10));
                ewsCalendarItemType.SensitivityString    = SensitivityConverter.ToString(RowNotificationHandler.GetItemProperty <Sensitivity>(notification, 11));
                ewsCalendarItemType.HasAttachments       = RowNotificationHandler.GetItemProperty <bool?>(notification, 12);
                LocationSourceType itemProperty2 = (LocationSourceType)RowNotificationHandler.GetItemProperty <int>(notification, 26);
                ewsCalendarItemType.EnhancedLocation = ((itemProperty2 == LocationSourceType.None) ? new EnhancedLocationType
                {
                    DisplayName = RowNotificationHandler.GetItemProperty <string>(notification, 13),
                    PostalAddress = new Microsoft.Exchange.Services.Core.Types.PostalAddress()
                } : new EnhancedLocationType
                {
                    DisplayName = RowNotificationHandler.GetItemProperty <string>(notification, 24),
                    Annotation = RowNotificationHandler.GetItemProperty <string>(notification, 25),
                    PostalAddress = new Microsoft.Exchange.Services.Core.Types.PostalAddress
                    {
                        LocationSource = itemProperty2,
                        LocationUri = RowNotificationHandler.GetItemProperty <string>(notification, 27),
                        Latitude = this.GetLocationPropertyValue(notification, 28),
                        Longitude = this.GetLocationPropertyValue(notification, 29),
                        Accuracy = this.GetLocationPropertyValue(notification, 30),
                        Altitude = this.GetLocationPropertyValue(notification, 31),
                        AltitudeAccuracy = this.GetLocationPropertyValue(notification, 32),
                        Street = RowNotificationHandler.GetItemProperty <string>(notification, 33),
                        City = RowNotificationHandler.GetItemProperty <string>(notification, 34),
                        State = RowNotificationHandler.GetItemProperty <string>(notification, 35),
                        Country = RowNotificationHandler.GetItemProperty <string>(notification, 36),
                        PostalCode = RowNotificationHandler.GetItemProperty <string>(notification, 37)
                    }
                });
                StoreId itemProperty3 = RowNotificationHandler.GetItemProperty <StoreId>(notification, 14);
                ewsCalendarItemType.ParentFolderId = IdConverter.GetFolderIdFromStoreId(itemProperty3, new MailboxId(base.MailboxGuid));
                byte[] itemProperty4 = RowNotificationHandler.GetItemProperty <byte[]>(notification, 15);
                if (itemProperty4 != null)
                {
                    try
                    {
                        GlobalObjectId globalObjectId = new GlobalObjectId(itemProperty4);
                        ewsCalendarItemType.UID = globalObjectId.Uid;
                    }
                    catch (CorruptDataException ex)
                    {
                        ExTraceGlobals.NotificationsCallTracer.TraceError <string>((long)this.GetHashCode(), "Exception setting the UID in CalendarItemNotificationHandler:GetPayloadFromNotification. Exception: {1}", ex.Message);
                    }
                }
                ewsCalendarItemType.AppointmentState       = new int?(RowNotificationHandler.GetItemProperty <int>(notification, 16));
                ewsCalendarItemType.IsCancelled            = new bool?((ewsCalendarItemType.AppointmentState.Value & 4) == 4);
                ewsCalendarItemType.CalendarItemTypeString = CalendarItemTypeConverter.ToString(RowNotificationHandler.GetItemProperty <CalendarItemType>(notification, 17));
                ewsCalendarItemType.AppointmentReplyTime   = base.GetDateTimeProperty(notification, 18);
                if (RowNotificationHandler.IsPropertyDefined(notification, 19))
                {
                    ewsCalendarItemType.JoinOnlineMeetingUrl = RowNotificationHandler.GetItemProperty <string>(notification, 19);
                }
                ewsCalendarItemType.Categories  = RowNotificationHandler.GetItemProperty <string[]>(notification, 20);
                ewsCalendarItemType.IsOrganizer = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, 23));
                ConversationId itemProperty5 = RowNotificationHandler.GetItemProperty <ConversationId>(notification, 21);
                string         id            = IdConverter.ConversationIdToEwsId(base.MailboxGuid, itemProperty5);
                ewsCalendarItemType.ConversationId      = new ItemId(id, null);
                ewsCalendarItemType.IsResponseRequested = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, 22));
                try
                {
                    base.UserContext.LockAndReconnectMailboxSession(3000);
                    ewsCalendarItemType.EffectiveRights = EffectiveRightsProperty.GetFromEffectiveRights(EffectiveRights.Modify | EffectiveRights.Read | EffectiveRights.Delete, base.UserContext.MailboxSession);
                }
                finally
                {
                    if (base.UserContext.MailboxSessionLockedByCurrentThread())
                    {
                        base.UserContext.UnlockAndDisconnectMailboxSession();
                    }
                }
            }
            return(calendarItemNotificationPayload);
        }
        private ItemId StoreIdToEwsItemId(StoreId storeId)
        {
            ConcatenatedIdAndChangeKey concatenatedId = IdConverter.GetConcatenatedId(storeId, this.mailboxId, null);

            return(new ItemId(concatenatedId.Id, concatenatedId.ChangeKey));
        }