CreateItem method

Future<void> CreateItem(
  1. Item item,
  2. FolderId? parentFolderId,
  3. MessageDisposition? messageDisposition,
  4. SendInvitationsMode? sendInvitationsMode,
)
Creates multiple items in a single EWS call. Supported item classes are EmailMessage, Appointment, Contact, PostItem, Task and Item. CreateItems does not support items that have unsaved attachments. The items to create. The Id of the folder in which to place the newly created items. If null, items are created in their default folders. Indicates the disposition mode for items of type EmailMessage. Required if items contains at least one EmailMessage instance. Indicates if and how invitations should be sent for items of type Appointment. Required if items contains at least one Appointment instance. Creates an item. Calling this method results in a call to EWS. The item to create. The Id of the folder in which to place the newly created item. If null, the item is created in its default folders. Indicates the disposition mode for items of type EmailMessage. Required if item is an EmailMessage instance. Indicates if and how invitations should be sent for item of type Appointment. Required if item is an Appointment instance.

Implementation

//ServiceResponseCollection<ServiceResponse> CreateItems(
//            Iterable<Item> items,
//            FolderId parentFolderId,
//            MessageDisposition? messageDisposition,
//            SendInvitationsMode? sendInvitationsMode)
//        {
//            // All items have to be new.
//            if (!items.TrueForAll((item) => item.IsNew))
//            {
//                throw new ServiceValidationException(Strings.CreateItemsDoesNotHandleExistingItems);
//            }
//
//            // Make sure that all items do *not* have unprocessed attachments.
//            if (!items.TrueForAll((item) => !item.HasUnprocessedAttachmentChanges()))
//            {
//                throw new ServiceValidationException(Strings.CreateItemsDoesNotAllowAttachments);
//            }
//
//            return this.InternalCreateItems(
//                items,
//                parentFolderId,
//                messageDisposition,
//                sendInvitationsMode,
//                ServiceErrorHandling.ReturnErrors);
//        }

/// <summary>
/// Creates an item. Calling this method results in a call to EWS.
/// </summary>
/// <param name="item">The item to create.</param>
/// <param name="parentFolderId">The Id of the folder in which to place the newly created item. If null, the item is created in its default folders.</param>
/// <param name="messageDisposition">Indicates the disposition mode for items of type EmailMessage. Required if item is an EmailMessage instance.</param>
/// <param name="sendInvitationsMode">Indicates if and how invitations should be sent for item of type Appointment. Required if item is an Appointment instance.</param>
Future<void> CreateItem(
    Item item,
    FolderId? parentFolderId,
    MessageDisposition? messageDisposition,
    SendInvitationsMode? sendInvitationsMode) {
  return this.InternalCreateItems([item], parentFolderId, messageDisposition,
      sendInvitationsMode, ServiceErrorHandling.ThrowOnError);
}