CreateItemFromItemClass static method

Item CreateItemFromItemClass(
  1. ItemAttachment itemAttachment,
  2. Type? itemClass,
  3. bool isNew
)
Creates Item from Item class. The item attachment. The item class. If true, item attachment is new.

Implementation

static Item CreateItemFromItemClass(
    ItemAttachment itemAttachment, Type? itemClass, bool isNew) {
  if (EwsUtilities
      .serviceObjectInfo.Member!.ServiceObjectConstructorsWithAttachmentParam
      .containsKey(itemClass)) {
    CreateServiceObjectWithAttachmentParam creationDelegate = EwsUtilities
        .serviceObjectInfo
        .Member!
        .ServiceObjectConstructorsWithAttachmentParam[itemClass!]!;
    return creationDelegate(itemAttachment, isNew) as Item;
  } else {
    throw new ArgumentException(
        "Strings.NoAppropriateConstructorForItemClass");
  }
}