Compartir a través de


CreateItem (Task)

Last modified: March 16, 2009

Applies to: Exchange Server 2007 | Exchange Server 2010

The CreateItem operation creates task items in the Exchange store.

Task CreateItem Request

Description

The following example of a CreateItem request shows how to create a task item in a mailbox.

Code

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Body>
    <CreateItem xmlns="https://schemas.microsoft.com/exchange/services/2006/messages"
                xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
                MessageDisposition="SaveOnly">
      <Items>
        <t:Task>
          <t:Subject>My task</t:Subject>
          <t:DueDate>2006-10-26T21:32:52</t:DueDate>
          <t:Status>NotStarted</t:Status>
        </t:Task>
      </Items>
    </CreateItem>
  </soap:Body>
</soap:Envelope>

Comments

Requests for recurring tasks are altered when they are received by the computer that is running Microsoft Exchange Server 2007 that has the Client Access server role installed. The following changes occur:

  • Only the date is saved for the StartDate (Recurrence) property of the recurrence range of the task. The time part is truncated.

  • The StartDate (Recurrence) property may be adjusted, depending on the recurrence pattern. For example, if the recurrence pattern is specified as every Monday and the StartDate is set to October 26, 2006, which is a Thursday, StartDate is adjusted to October 30, 2006, which is the next Monday.

  • If the StartDate (Task) property of the task is set, it is updated to match the StartDate (Recurrence) of the recurrence range. The DueDate property of the task is also updated based on the new StartDate (Task).

  • If the StartDate (Task) is not set, only the DueDate property is updated to match the StartDate (Recurrence) of the recurrence range.

The following table shows the changes that the Client Access server makes to a recurring task that has a Task.Recurrence.Pattern of every Monday.

Changes to a recurring task

Property

Original Value

Updated Value

Task.StartDate

January 1, 2006

October 30, 2006

Task.DueDate

January 3, 2006

November 1, 2006

Task.Recurrence.Range.StartDate

October 26, 2006

October 30, 2006

By default, if a destination folder is not specified, task items are created in the Tasks folder.

Request Elements

The following elements are used in the request:

Successful Task CreateItem Response

Description

The following example shows a successful response to the CreateItem request.

Code

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <t:ServerVersionInfo MajorVersion="8" MinorVersion="0" MajorBuildNumber="653" MinorBuildNumber="0" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"/>
  </soap:Header>
  <soap:Body>
    <CreateItemResponse xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
                        xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
                        xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <m:ResponseMessages>
        <m:CreateItemResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Items>
            <t:Task>
              <t:ItemId Id="AAAtAE=" ChangeKey="EwAAABYA"/>
            </t:Task>
          </m:Items>
        </m:CreateItemResponseMessage>
      </m:ResponseMessages>
    </CreateItemResponse>
  </soap:Body>
</soap:Envelope>

Successful Response Elements