The method uploads attachments from the email service to the file storage and returns their IDs.
The method generates the following errors:
If the email’s ID (__id) in the MailMessageItem is invalid, or an email with this ID is not found, the “Not found” error message will be returned.
The method deletes duplicates in fields that store arrays of links to system objects (users, files, app items, or documents).
For example, you can call this method after bulk editing a lot of data within an object.
const app1 = await Context.data.app1.fetch();
const app2 = await Context.data.app2.fetch();
app1.data.executors.push(app2.data. executors);
app1.normalize();
// Now we need to go over the elements in the new array
app1.data.executors.forEach( ... );
Email
The object is used to work with emails.
Type parameters
I: Item<ItemData>
Hierarchy
Properties
Readonly code
App code of the URL’s target (the app’s code).
Readonly data
Values of object’s fields.
Readonly fields
Description of the object’s fields.
Readonly id
ID of the URL’s target.
Readonly namespace
Link target namespace (the code of the app's workspace).
Methods
fetch
Request complete data of a reference object.
Returns Promise<MailMessageItem>
getAttachments
The method uploads attachments from the email service to the file storage and returns their IDs.
The method generates the following errors: If the email’s ID (
__id) in theMailMessageItemis invalid, or an email with this ID is not found,the “Not found” error message will be returned.
const attachments = await message.getAttachments();Returns Promise<FileItemRef[]>
normalize
Delete duplicate data in arrays.
The method deletes duplicates in fields that store arrays of links to system objects (users, files, app items, or documents). For example, you can call this method after bulk editing a lot of data within an object.
const app1 = await Context.data.app1.fetch(); const app2 = await Context.data.app2.fetch(); app1.data.executors.push(app2.data. executors); app1.normalize(); // Now we need to go over the elements in the new array app1.data.executors.forEach( ... );Returns void
Feedback sent successfully
Thank you for your input