Represents an e-mail message. Properties available on e-mail messages are defined in the EmailMessageSchema class.
var EmailMessage = (function (_super) {
__extends(EmailMessage, _super);
function EmailMessage(serviceOrParentAttachment) {
_super.call(this, serviceOrParentAttachment);
}
Object.defineProperty(EmailMessage.prototype, "ToRecipients", {
Gets the list of To recipients for the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.ToRecipients);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "BccRecipients", {
Gets the list of Bcc recipients for the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.BccRecipients);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "CcRecipients", {
Gets the list of Cc recipients for the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.CcRecipients);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "ConversationTopic", {
Gets the conversation topic of the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.ConversationTopic);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "ConversationIndex", {
Gets the conversation index of the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.ConversationIndex);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "From", {
Gets or sets the "on behalf" sender of the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.From);
},
set: function (value) {
this.PropertyBag._setItem(EmailMessageSchema_1.EmailMessageSchema.From, value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "IsAssociated", {
Gets or sets a value indicating whether this is an associated message.
get: function () {
return this.IsAssociated;
},
set: function (value) {
this.PropertyBag._setItem(ItemSchema_1.ItemSchema.IsAssociated, value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "IsDeliveryReceiptRequested", {
Gets or sets a value indicating whether a read receipt is requested for the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.IsDeliveryReceiptRequested);
},
set: function (value) {
this.PropertyBag._setItem(EmailMessageSchema_1.EmailMessageSchema.IsDeliveryReceiptRequested, value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "IsRead", {
Gets or sets a value indicating whether the e-mail message is read.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.IsRead);
},
set: function (value) {
this.PropertyBag._setItem(EmailMessageSchema_1.EmailMessageSchema.IsRead, value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "IsReadReceiptRequested", {
Gets or sets a value indicating whether a read receipt is requested for the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.IsReadReceiptRequested);
},
set: function (value) {
this.PropertyBag._setItem(EmailMessageSchema_1.EmailMessageSchema.IsReadReceiptRequested, value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "IsResponseRequested", {
Gets or sets a value indicating whether a response is requested for the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.IsResponseRequested);
},
set: function (value) {
this.PropertyBag._setItem(EmailMessageSchema_1.EmailMessageSchema.IsResponseRequested, value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "InternetMessageId", {
Gets the Internat Message Id of the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.InternetMessageId);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "References", {
Gets or sets the references of the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.References);
},
set: function (value) {
this.PropertyBag._setItem(EmailMessageSchema_1.EmailMessageSchema.References, value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "ReplyTo", {
Gets a list of e-mail addresses to which replies should be addressed.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.ReplyTo);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "Sender", {
Gets or sets the sender of the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.Sender);
},
set: function (value) {
this.PropertyBag._setItem(EmailMessageSchema_1.EmailMessageSchema.Sender, value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "ReceivedBy", {
Gets the ReceivedBy property of the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.ReceivedBy);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "ReceivedRepresenting", {
Gets the ReceivedRepresenting property of the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.ReceivedRepresenting);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "ApprovalRequestData", {
Gets the ApprovalRequestData property of the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.ApprovalRequestData);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EmailMessage.prototype, "VotingInformation", {
Gets the VotingInformation property of the e-mail message.
get: function () {
return this.PropertyBag._getItem(EmailMessageSchema_1.EmailMessageSchema.VotingInformation);
},
enumerable: true,
configurable: true
});
EmailMessage.Bind = function (service, id, propertySet) {
if (propertySet === void 0) { propertySet = PropertySet_1.PropertySet.FirstClassProperties; }
return service.BindToItem(id, propertySet, EmailMessage);
};
Creates a forward response to the message.
EmailMessage.prototype.CreateForward = function () {
this.ThrowIfThisIsNew();
return new ResponseMessage_1.ResponseMessage(this, ResponseMessageType_1.ResponseMessageType.Forward);
};
Option name | Type | Description |
---|---|---|
replyAll | boolean | Indicates whether the reply should go to all of the original recipients of the message. |
return | ResponseMessage | A ResponseMessage representing the reply response that can subsequently be modified and sent. |
Creates a reply response to the message.
EmailMessage.prototype.CreateReply = function (replyAll) {
this.ThrowIfThisIsNew();
return new ResponseMessage_1.ResponseMessage(this, replyAll ? ResponseMessageType_1.ResponseMessageType.ReplyAll : ResponseMessageType_1.ResponseMessageType.Reply);
};
//Forward(bodyPrefix: MessageBody, toRecipients: EmailAddress[]): IPromise<void> { throw new Error("EmailMessage.ts - Forward : Not implemented."); }
//Forward(bodyPrefix: MessageBody, toRecipients: System.Collections.Generic.IEnumerable<T>): IPromise<void> { throw new Error("EmailMessage.ts - Forward : Not implemented."); }
Option name | Type | Description |
---|---|---|
bodyPrefix | MessageBody | The prefix to prepend to the original body of the message. |
toRecipients | Array.<EmailAddress> | The recipients to forward the message to. |
Forwards the message. Calling this method results in a call to EWS.
EmailMessage.prototype.Forward = function (bodyPrefix, toRecipients) {
var responseMessage = this.CreateForward();
responseMessage.BodyPrefix = bodyPrefix;
responseMessage.ToRecipients.AddRange(toRecipients);
return responseMessage.SendAndSaveCopy();
};
Gets the minimum required server version.
EmailMessage.prototype.GetMinimumRequiredServerVersion = function () { return ExchangeVersion_1.ExchangeVersion.Exchange2007_SP1; };
Internal method to return the schema associated with this type of object.
EmailMessage.prototype.GetSchema = function () { return EmailMessageSchema_1.EmailMessageSchema.Instance; };
Get XML Element Name - workaround for c# attributes
EmailMessage.prototype.GetXmlElementName = function () { return XmlElementNames_1.XmlElementNames.Message; };
Option name | Type | Description |
---|---|---|
parentFolderId | FolderId | The parent folder id. |
messageDisposition | MessageDisposition | The message disposition. |
Send message.
EmailMessage.prototype.InternalSend = function (parentFolderId, messageDisposition) {
var _this = this;
this.ThrowIfThisIsAttachment();
if (this.IsNew) {
if ((this.Attachments.Count == 0) || (messageDisposition == MessageDisposition_1.MessageDisposition.SaveOnly)) {
return this.InternalCreate(parentFolderId, messageDisposition, null);
}
else {
// If the message has attachments, save as a draft (and add attachments) before sending.
this.InternalCreate(null, MessageDisposition_1.MessageDisposition.SaveOnly, null).then(function (results) {
return _this.Service.SendItem(_this, parentFolderId);
});
}
}
else {
// Regardless of whether item is dirty or not, if it has unprocessed
// attachment changes, process them now.
debugger; //todo: check - check for attachment save() promise.
// Validate and save attachments before sending.
if (this.HasUnprocessedAttachmentChanges()) {
this.Attachments.Validate();
this.Attachments.Save();
}
debugger; //todo: check - check for attachment save() promise.
if (this.PropertyBag.GetIsUpdateCallNecessary()) {
this.InternalUpdate(parentFolderId, ConflictResolutionMode_1.ConflictResolutionMode.AutoResolve, messageDisposition, null);
}
else {
return this.Service.SendItem(this, parentFolderId);
}
}
};
Option name | Type | Description |
---|---|---|
bodyPrefix | MessageBody | The prefix to prepend to the original body of the message. |
replyAll | boolean | Indicates whether the reply should be sent to all of the original recipients of the message. |
Replies to the message. Calling this method results in a call to EWS.
EmailMessage.prototype.Reply = function (bodyPrefix, replyAll) {
var responseMessage = this.CreateReply(replyAll);
responseMessage.BodyPrefix = bodyPrefix;
return responseMessage.SendAndSaveCopy();
};
Sends this e-mail message. Calling this method results in at least one call to EWS.
EmailMessage.prototype.Send = function () { return this.InternalSend(null, MessageDisposition_1.MessageDisposition.SendOnly); };
EmailMessage.prototype.SendAndSaveCopy = function (destinationFolderIdOrName) {
var destinationFolderId = new FolderId_1.FolderId(WellKnownFolderName_1.WellKnownFolderName.SentItems);
if (arguments.length === 1) {
if (typeof destinationFolderIdOrName === "number") {
destinationFolderId = new FolderId_1.FolderId(destinationFolderIdOrName);
}
else {
//EwsUtilities.ValidateParam(destinationFolderIdOrName, "destinationFolderId");
destinationFolderId = destinationFolderIdOrName;
}
}
return this.InternalSend(destinationFolderId, MessageDisposition_1.MessageDisposition.SendAndSaveCopy);
};
Suppresses the read receipt on the message. Calling this method results in a call to EWS.
EmailMessage.prototype.SuppressReadReceipt = function () {
this.ThrowIfThisIsNew();
return (new SuppressReadReceipt_1.SuppressReadReceipt(this)).InternalCreate(null, null);
};
return EmailMessage;
})(Item_1.Item);
exports.EmailMessage = EmailMessage;