isUpdateOperation
) {
return true;
}
}
}
return _super.prototype.GetIsTimeZoneHeaderRequired.call(this, isUpdateOperation);
};
Item.prototype.GetMinimumRequiredServerVersion = function () { return ExchangeVersion_1.ExchangeVersion.Exchange2007_SP1; };
Item.prototype.GetSchema = function () { return ItemSchema_1.ItemSchema.Instance; };
Item.prototype.GetXmlElementName = function () { return XmlElementNames_1.XmlElementNames.Item; };
Item.prototype.HasUnprocessedAttachmentChanges = function () { return this.Attachments.HasUnprocessedChanges(); };
Item.prototype.InternalCreate = function (parentFolderId, messageDisposition, sendInvitationsMode) {
var _this = this;
this.ThrowIfThisIsNotNew();
this.ThrowIfThisIsAttachment();
if (this.IsNew || this.IsDirty) {
return this.Service.CreateItem(this, parentFolderId, messageDisposition, sendInvitationsMode !== null ? sendInvitationsMode : this.DefaultSendInvitationsMode)
.then(function (response) {
return _this.Attachments.Save();
});
}
return;
};
Item.prototype.InternalDelete = function (deleteMode, sendCancellationsMode, affectedTaskOccurrences, suppressReadReceipts) {
if (sendCancellationsMode === void 0) { sendCancellationsMode = this.DefaultSendCancellationsMode; }
if (affectedTaskOccurrences === void 0) { affectedTaskOccurrences = this.DefaultAffectedTaskOccurrences; }
if (suppressReadReceipts === void 0) { suppressReadReceipts = false; }
this.ThrowIfThisIsNew();
this.ThrowIfThisIsAttachment();
// If sendCancellationsMode is null, use the default value that's appropriate for item type.
// if (!sendCancellationsMode)
// {
// sendCancellationsMode = this.DefaultSendCancellationsMode;
// }
// If affectedTaskOccurrences is null, use the default value that's appropriate for item type.
// if (!affectedTaskOccurrences)
// {
// affectedTaskOccurrences = this.DefaultAffectedTaskOccurrences;
// }
return this.Service.DeleteItem(this.Id, deleteMode, sendCancellationsMode, affectedTaskOccurrences, suppressReadReceipts);
};
Item.prototype.InternalLoad = function (propertySet) {
this.ThrowIfThisIsNew();
this.ThrowIfThisIsAttachment();
return this.Service.InternalLoadPropertiesForItems([this], propertySet, ServiceErrorHandling_1.ServiceErrorHandling.ThrowOnError);
};
Item.prototype.InternalUpdate = function (parentFolderId, conflictResolutionMode, messageDisposition, sendInvitationsOrCancellationsMode, suppressReadReceipts) {
if (suppressReadReceipts === void 0) { suppressReadReceipts = false; }
this.ThrowIfThisIsNew();
this.ThrowIfThisIsAttachment();
var returnedItem = null;
// Regardless of whether item is dirty or not, if it has unprocessed
// attachment changes, validate them and process now.
if (this.HasUnprocessedAttachmentChanges()) {
this.Attachments.Validate();
this.Attachments.Save();
}
if (this.IsDirty && this.PropertyBag.GetIsUpdateCallNecessary()) {
return this.Service.UpdateItem(this, parentFolderId, conflictResolutionMode, messageDisposition, sendInvitationsOrCancellationsMode !== null ? sendInvitationsOrCancellationsMode : this.DefaultSendInvitationsOrCancellationsMode, suppressReadReceipts);
}
return PromiseFactory_1.PromiseFactory.wrap(returnedItem);
};
Item.prototype.Move = function (destinationFolderIdOrName) {
this.ThrowIfThisIsNew();
this.ThrowIfThisIsAttachment();
var folderId = null;
if (destinationFolderIdOrName instanceof FolderId_1.FolderId) {
folderId = destinationFolderIdOrName;
}
else {
folderId = new FolderId_1.FolderId(destinationFolderIdOrName);
}
//EwsUtilities.ValidateParam(destinationFolderId, "destinationFolderId");
return this.Service.MoveItem(this.Id, folderId);
};
Item.prototype.RemoveExtendedProperty = function (extendedPropertyDefinition) { return this.ExtendedProperties.RemoveExtendedProperty(extendedPropertyDefinition); };
Item.prototype.Save = function (parentFolderIdOrName) {
if (parentFolderIdOrName === void 0) { parentFolderIdOrName = null; }
var parentFolderId = null;
if (parentFolderIdOrName !== null) {
parentFolderId = parentFolderIdOrName;
if (typeof parentFolderIdOrName === 'number') {
parentFolderId = new FolderId_1.FolderId(parentFolderIdOrName);
}
}
return this.InternalCreate(parentFolderId, MessageDisposition_1.MessageDisposition.SaveOnly, null);
};
Item.prototype.SetExtendedProperty = function (extendedPropertyDefinition, value) { this.ExtendedProperties.SetExtendedProperty(extendedPropertyDefinition, value); };
Item.prototype.SetSubject = function (subject) { this.PropertyBag._setItem(ItemSchema_1.ItemSchema.Subject, subject); };
Item.prototype.ThrowIfThisIsAttachment = function () {
if (this.IsAttachment) {
throw new Error(Strings_1.Strings.OperationDoesNotSupportAttachments); //InvalidOperationException
}
};
Item.prototype.Update = function (conflictResolutionMode, suppressReadReceipts) {
if (suppressReadReceipts === void 0) { suppressReadReceipts = false; }
return this.InternalUpdate(null
parentFolder
conflictResolutionMode, MessageDisposition_1.MessageDisposition.SaveOnly, null, suppressReadReceipts);
};
Item.prototype.Validate = function () {
_super.prototype.Validate.call(this);
this.Attachments.Validate();
// Flag parameter is only valid for Exchange2013 or higher
//
var flag = { outValue: null };
if (this.TryGetProperty(ItemSchema_1.ItemSchema.Flag, flag) && flag.outValue != null) {
if (this.Service.RequestedServerVersion < ExchangeVersion_1.ExchangeVersion.Exchange2013) {
throw new ServiceVersionException_1.ServiceVersionException(ExtensionMethods_1.StringHelper.Format(Strings_1.Strings.ParameterIncompatibleWithRequestVersion, "Flag", ExchangeVersion_1.ExchangeVersion.Exchange2013));
}
flag.outValue.Validate();
}
};
Object.defineProperty(Item.prototype, "InstanceType", {
//created this to help find serviceobject type, ServiceObjectInstance instanceof Item fails by creating circular dependency in javascript/typescript
get: function () { return XmlElementNames_1.XmlElementNames.Item; },
enumerable: true,
configurable: true
});
return Item;
})(ServiceObject_1.ServiceObject);
exports.Item = Item;