CreateItemType class

The CreateItemType class represents a request to create an item or response object.

Namespace:  ExchangeWebServices
Assembly:  EWS (in EWS.dll)

public class CreateItemType : BaseRequestType

The CreateItemType is used to create response objects and items in the Exchange database. The following table describes the items and response objects that can be created by using CreateItemType.




Represents a generic item to be created in the Exchange database.


Represents an e-mail message to be created in the Exchange database.


Represents a task to be created in the Exchange database.


Represents a contact item to be created in the Exchange database.


Represents a calendar entry to be created in the Exchange database.


Represents a response object for accepting meeting invitations.


Represents a response object for canceling a calendar item.


Represents a response object for declining meeting invitations.


Represents a response object for forwarding an item to other users.


Represents a response object for removing a canceled meeting from a calendar.


Represents a response object for replying to all recipients of an item.


Represents a response object for replying to the sender of an item.


Represents a response object for tentatively accepting a meeting invitation.


Represents a response object that is used to suppress read receipts.


CreateItemType cannot be used to create distribution lists, meeting messages, meeting request messages, meeting response messages, and meeting cancellation messages.

The following code example shows a CreateItem request that creates a single e-mail, sends it to several recipients, and saves a copy of it in the Sent Items default folder.

static void CreateEmail()
    // Create the CreateItem request.
    CreateItemType createEmailRequest = new CreateItemType();

    // Specifiy how the e-mail will be handled.
    createEmailRequest.MessageDisposition = MessageDispositionType.SendAndSaveCopy;
    createEmailRequest.MessageDispositionSpecified = true;

    // Specify the location of sent items.
    createEmailRequest.SavedItemFolderId = new TargetFolderIdType();
    DistinguishedFolderIdType sentitems = new DistinguishedFolderIdType();
    sentitems.Id = DistinguishedFolderIdNameType.sentitems;
    createEmailRequest.SavedItemFolderId.Item = sentitems;

    // Create the array of items.
    createEmailRequest.Items = new NonEmptyArrayOfAllItemsType();

    // Create a single e-mail message.
    MessageType message = new MessageType();
    message.Subject = "Daily Report";
    message.Body = new BodyType();
    message.Body.BodyType1 = BodyTypeType.Text;
    message.Body.Value = "(1) Handled customer issues, (2) Saved the world.";
    message.ItemClass = "IPM.Note";
    message.Sender = new SingleRecipientType();
    message.Sender.Item = new EmailAddressType();
    message.Sender.Item.EmailAddress = "";
    message.ToRecipients = new EmailAddressType[1];
    message.ToRecipients[0] = new EmailAddressType();
    message.ToRecipients[0].EmailAddress = "";
    message.Sensitivity = SensitivityChoicesType.Normal;
    message.SensitivitySpecified = true;
    message.Importance = ImportanceChoicesType.High;
    message.ImportanceSpecified = true;

    // Add the message to the array of items to be created.
    createEmailRequest.Items.Items = new ItemType[1];
    createEmailRequest.Items.Items[0] = message;

        // Create the service binding.
        // Identify the service and the user.
        ExchangeServiceBinding esb = new ExchangeServiceBinding();
        esb.Credentials = new NetworkCredential("username", "password", "domain");
        esb.Url = @"";

        // Send a CreateItem request and get the CreateItem response.
        CreateItemResponseType createItemResponse = esb.CreateItem(createEmailRequest);
        ArrayOfResponseMessagesType responseMessages = createItemResponse.ResponseMessages;
        // Access the response message.
        ResponseMessageType responseMessage = responseMessages.Items[0];
        // Determine whether the request was a success.
        if (responseMessages.Items[0].ResponseClass == ResponseClassType.Error)
            throw new Exception(responseMessages.Items[0].MessageText);
        if (responseMessage is ItemInfoResponseMessageType)
            ItemInfoResponseMessageType createItemResp = (responseMessage as ItemInfoResponseMessageType);
            ArrayOfRealItemsType aorit = createItemResp.Items;

            // Determine whether there are items in response.
            if (aorit.Items != null)
                foreach (ItemType item in aorit.Items)
                    if (item is ItemType)
                        ItemType myItem = (item as ItemType);
                    if (item is MessageType)
                        MessageType myMessage = (item as MessageType);
                    // TODO: Add logic to check and cast for all other types.
            Console.WriteLine("Item(s) created");
    catch (Exception e)

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.