Click here to Skip to main content
15,888,302 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am developing a window 8 metro app where i have to use the ExchaneWebServices to create tasks and display all tasks back into my app. Athough I have done it through webservice Now I have to make the task editable for which I am using the Task UniqueId to search the task and then edit it contents but I am facing a problem in this the Task all fields get updated except the Taskstart date any help why it is not changing will be highly appreciated.

This works fine when I edit the tasks through the office365.

My Code is Like this

C#
public void GetTaskEdited(EWSTask EWSTaskObject, string TaskUniqueid)
        { 

		//Code to connect to the Exchange

            ExchangeService service;
            service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
            service.Credentials = new WebCredentials(Authentication.UserName, Authentication.Password);
            service.AutodiscoverUrl(Authentication.UserName, RedirectionUrlValidationCallback);

//Filter the task according to the TaskUniqueId

FindItemsResults<item> foundItems=service.FindItems(WellKnownFolderName.Tasks,
                 new SearchFilter.IsEqualTo(TaskSchema.Id, TaskUniqueid),
                 new ItemView(5));

              Item foundItem = foundItems.FirstOrDefault();
            if (foundItem != null && foundItem is Task)
            {
                Task foundTask = (Task)foundItem;

                foundTask.Subject = EWSTaskObject.Subject;
                foundTask.Body = EWSTaskObject.Body;
                foundTask.StartDate = EWSTaskObject.TaskStartDate;
                foundTask.IsReminderSet = EWSTaskObject.ReminderSet;
                foundTask.ReminderMinutesBeforeStart = EWSTaskObject.ReminderMinutes;
                foundTask.Importance = EWSTaskObject.TaskImportance;
                foundTask.Status = EWSTaskObject.TaskStatus;
                foundTask.DueDate = EWSTaskObject.TaskDueDate;
                foundTask.ReminderDueBy = EWSTaskObject.TaskDueDate.AddHours(2);
                DayOfTheWeek[] days = new DayOfTheWeek[EWSTaskObject.TaskRecurrenceDay.Count];
                for (int i = 0; i < EWSTaskObject.TaskRecurrenceDay.Count; i++)
                {
                    days[i] = EWSTaskObject.TaskRecurrenceDay[i];
                }
                if (EWSTaskObject.ReminderSet == true)
                {
                    foundTask.Recurrence = new Recurrence.WeeklyPattern(startDate: foundTask.StartDate.Value, interval: 1, daysOfTheWeek: days);
                }

               // foundTask.Save();                
                foundTask.Update(ConflictResolutionMode.AutoResolve);

            }

        }


The entire fields are updated except the task startdate
Posted
Updated 27-Jun-13 2:56am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900