public void MSOXWSCORE_S08_TC05_UpdateTypesOfItemsFailed()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(19241, this.Site), "Exchange 2007 doesn't support MS-OXWSDLIST");

            #region Step 1: Create Items.
            ItemIdType[] createdItemIds = CreateAllTypesItems();
            #endregion

            #region Step 2: Update items.
            // Initialize the change item to update.
            UpdateItemType   updateRequest = new UpdateItemType();
            ItemChangeType[] itemChanges   = new ItemChangeType[createdItemIds.Length];

            // Set two properties (Subject and ReminderMinutesBeforeStart) to update, in order to return an error "ErrorIncorrectUpdatePropertyCount".
            for (int i = 0; i < createdItemIds.Length; i++)
            {
                itemChanges[i]         = new ItemChangeType();
                itemChanges[i].Item    = createdItemIds[i];
                itemChanges[i].Updates = new ItemChangeDescriptionType[1];
                SetItemFieldType setItem1 = new SetItemFieldType();
                setItem1.Item = new PathToUnindexedFieldType()
                {
                    FieldURI = UnindexedFieldURIType.itemSubject
                };
                setItem1.Item1 = new ContactItemType()
                {
                    Subject = Common.GenerateResourceName(
                        this.Site,
                        TestSuiteHelper.SubjectForUpdateItem),
                    ReminderMinutesBeforeStart = TestSuiteHelper.ReminderMinutesBeforeStart
                };
                itemChanges[i].Updates[0] = setItem1;
            }

            updateRequest.ItemChanges = itemChanges;
            updateRequest.MessageDispositionSpecified                    = true;
            updateRequest.MessageDisposition                             = MessageDispositionType.SaveOnly;
            updateRequest.SendMeetingInvitationsOrCancellations          = CalendarItemUpdateOperationType.SendToAllAndSaveCopy;
            updateRequest.SendMeetingInvitationsOrCancellationsSpecified = true;

            // Call UpdateItem to update the Subject and the ReminderMinutesBeforeStart of the created item simultaneously.
            UpdateItemResponseType updateItemResponse = this.COREAdapter.UpdateItem(updateRequest);

            foreach (ResponseMessageType responseMessage in updateItemResponse.ResponseMessages.Items)
            {
                // Verify ResponseCode is ErrorIncorrectUpdatePropertyCount.
                this.VerifyErrorIncorrectUpdatePropertyCount(responseMessage.ResponseCode);
            }
            #endregion
        }
Esempio n. 2
0
        private static SetItemFieldType GetSubjectUpdate(Appointment apt)
        {
            SetItemFieldType subjectUpdate = new SetItemFieldType();

            PathToUnindexedFieldType subjectPath = new PathToUnindexedFieldType();

            subjectPath.FieldURI = UnindexedFieldURIType.itemSubject;

            CalendarItemType subjectData = new CalendarItemType();

            subjectData.Subject = apt.Subject;

            subjectUpdate.Item  = subjectPath;
            subjectUpdate.Item1 = subjectData;
            return(subjectUpdate);
        }
Esempio n. 3
0
        private static SetItemFieldType GetEndUpdate(Appointment apt)
        {
            SetItemFieldType endUpdate = new SetItemFieldType();

            PathToUnindexedFieldType endPath = new PathToUnindexedFieldType();

            endPath.FieldURI = UnindexedFieldURIType.calendarEnd;

            CalendarItemType endData = new CalendarItemType();

            endData.End          = apt.End;
            endData.EndSpecified = true;

            endUpdate.Item  = endPath;
            endUpdate.Item1 = endData;
            return(endUpdate);
        }
Esempio n. 4
0
        private static SetItemFieldType GetStartUpdate(Appointment apt)
        {
            SetItemFieldType startUpdate = new SetItemFieldType();

            PathToUnindexedFieldType startPath = new PathToUnindexedFieldType();

            startPath.FieldURI = UnindexedFieldURIType.calendarStart;

            CalendarItemType startData = new CalendarItemType();

            startData.Start          = apt.Start;
            startData.StartSpecified = true;

            startUpdate.Item  = startPath;
            startUpdate.Item1 = startData;
            return(startUpdate);
        }
Esempio n. 5
0
        private static SetItemFieldType GetRecurrenceUpdate(Appointment apt)
        {
            SetItemFieldType recurrenceUpdate = new SetItemFieldType();

            PathToUnindexedFieldType recurrencePath = new PathToUnindexedFieldType();

            recurrencePath.FieldURI = UnindexedFieldURIType.calendarRecurrence;

            CalendarItemType recurrenceData = new CalendarItemType();
            RecurrenceRule   rrule;

            RecurrenceRule.TryParse(apt.RecurrenceRule, out rrule);
            if (rrule != null && rrule.Pattern.Frequency != RecurrenceFrequency.Hourly)
            {
                recurrenceData.Recurrence = CreateRecurrence(rrule, apt.Owner);
            }

            recurrenceUpdate.Item  = recurrencePath;
            recurrenceUpdate.Item1 = recurrenceData;
            return(recurrenceUpdate);
        }
        /// <summary>
        /// Sets the message importance flag.
        /// </summary>
        public void SetMessageImportance(ItemIdType messageId, bool isStarred)
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

            var setField = new SetItemFieldType
            {
                Item1 = new MessageType {
                    Importance = isStarred ? ImportanceChoicesType.High : ImportanceChoicesType.Normal, ImportanceSpecified = true
                },
                Item = new PathToUnindexedFieldType {
                    FieldURI = UnindexedFieldURIType.itemImportance
                }
            };

            var updatedItems = new[]
            {
                new ItemChangeType
                {
                    Updates = new ItemChangeDescriptionType[] { setField },
                    Item    = messageId
                }
            };

            var request = new UpdateItemType
            {
                ItemChanges                 = updatedItems,
                ConflictResolution          = ConflictResolutionType.AutoResolve,
                MessageDisposition          = MessageDispositionType.SaveOnly,
                MessageDispositionSpecified = true
            };

            UpdateItemResponseType updateItemResponse = binding.UpdateItem(request);

            if (updateItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
            {
                throw new Exception(updateItemResponse.ResponseMessages.Items[0].MessageText);
            }
        }
        /// <summary>
        /// Generate UpdateItemRequest.
        /// </summary>
        /// <param name="createItemIds">The created item id.</param>
        /// <returns>Generated GetItemRequest.</returns>
        public static UpdateItemType GenerateUpdateItemRequest(params ItemIdType[] createItemIds)
        {
            // Specify needed to update value for the task item.
            TaskType taskUpdate = new TaskType
            {
                Companies = new string[] { "Company3", "Company4" }
            };

            // Define the ItemChangeType element for updating the task item's companies.
            PathToUnindexedFieldType pathTo = new PathToUnindexedFieldType()
            {
                FieldURI = UnindexedFieldURIType.taskCompanies
            };

            SetItemFieldType setItemField = new SetItemFieldType()
            {
                Item  = pathTo,
                Item1 = taskUpdate
            };

            ItemChangeType[] itemChanges = new ItemChangeType[createItemIds.Length];
            for (int i = 0; i < createItemIds.Length; i++)
            {
                ItemChangeType itemChange = new ItemChangeType()
                {
                    Item    = createItemIds[i],
                    Updates = new ItemChangeDescriptionType[] { setItemField }
                };
                itemChanges[i] = itemChange;
            }

            // Return the UpdateItemType request to update the task item.
            return(new UpdateItemType()
            {
                ItemChanges = itemChanges,
                ConflictResolution = ConflictResolutionType.AlwaysOverwrite
            });
        }