Skip to main content
Access via:io.outlook

Outlook API.

Properties (1)

Property Type Default Required Description
addinStatus⚓︎ boolean x

Flag indicating the status of the Outlook Adapter. If true, the Outlook Adapter is available and you can use the Outlook API.

20 Methods

attachmentFromJSON()⚓︎

(attachment: T42Attachment) => Attachment

Converts attachment object to Attachment with method getData() but without the parent property.

Parameters (1)

Name Type Required Description
attachment⚓︎ T42Attachment

The raw attachment object to convert.

createLocalEmail()⚓︎

(localEmailParams: LocalEmailParams) => Promise<Email>

Creates new local email.

Parameters (1)

Name Type Required Description
localEmailParams⚓︎ LocalEmailParams

Parameters for the local email.

Example

const email = await outlook.createLocalEmail({
    sender: "emailAddress@mail.com",
    to: "emailAddress@mail.com",
    subject: "Sample body",
    location: "$Inbox",
});

console.log(email);

emailFromJSON()⚓︎

(email: T42Email) => Email

Converts email object to Email with methods: getAsMsg(), saveToFile(), show(), track() and untrack().

Parameters (1)

Name Type Required Description
email⚓︎ T42Email

The raw email object to convert.

newEmail()⚓︎

(emailParams?: EmailParams, options?: NewEmailOptions) => Promise<void>

Creates new email window.

Parameters (2)

Name Type Required Description
emailParams⚓︎ EmailParams x

Optional email parameters (recipients, subject, body, attachments, etc.).

options⚓︎ NewEmailOptions x

Optional callbacks and display settings.

Example

await outlook.newEmail(
    {
        to: "emailAddress@mail.com",
        subject: "Sample subject",
        body: "Sample body",
        attachments: [
            {
                fileName: "attachmentFileName.txt",
                data: "Sample text",
            },
        ],
    },
    {
        onSent: (email) => console.log(email),
        onCanceled: () => console.log("canceled"),
    },
);

newTask()⚓︎

(taskParams?: TaskParams, options?: NewTaskOptions) => Promise<void>

Creates new task window.

Parameters (2)

Name Type Required Description
taskParams⚓︎ TaskParams x

Optional task parameters (subject, body, priority, etc.).

options⚓︎ NewTaskOptions x

Optional callbacks and display settings.

Example

await outlook.newTask(
    {
        subject: "Sample subject",
        body: "Sample body",
        priority: "high",
        dueDate: new Date("2017-07-01"),
    },
    {
        onSaved: (task) => console.log(task),
        onCanceled: () => console.log("canceled"),
    },
);

onAddinStatusChanged()⚓︎

(callback: (args: { connected: boolean }) => any) => () => void

Notifies when the Outlook Adapter status has changed. Immediately invokes the callback with the current status. Returns an unsubscribe function.

Parameters (1)

Name Type Required Description
callback⚓︎ (args: { connected: boolean }) => any

Callback function for handling the event. Receives as an argument an object with a connected Boolean property indicating the status of the Outlook Adapter.

Example

outlook.onAddinStatusChanged(({ connected }) => {
    console.log(`Outlook is ${connected ? "available" : "unavailable"}.`);
});

onDisplaySecureEmail()⚓︎

(callback: (email: Email) => any) => void

Notifies on a request for a local email to be displayed. Returns an unsubscribe function.

Parameters (1)

Name Type Required Description
callback⚓︎ (email: Email) => any

Callback function for handling the event. Receives the email as an argument.

onEmailReceived()⚓︎

(callback: (email: Email) => any) => void

Notifies when an email is received in the HandleEmail folder. Returns an unsubscribe function.

Parameters (1)

Name Type Required Description
callback⚓︎ (email: Email) => any

Callback function for handling the event. Receives the received email as an argument.

Example

outlook.onEmailReceived((email) =>
    console.log("An email was received.", email),
);

onSecureReply()⚓︎

(callback: (email: Email) => any) => void

Notifies on secure reply to a local email. Returns an unsubscribe function.

Parameters (1)

Name Type Required Description
callback⚓︎ (email: Email) => any

Callback function for handling the event. Receives the email as an argument.

onTaskCreated()⚓︎

(callback: (task: Task) => any) => void

Notifies when a task is created. Returns an unsubscribe function.

Parameters (1)

Name Type Required Description
callback⚓︎ (task: Task) => any

Callback function for handling the event. Receives the created task as an argument.

Example

outlook.onTaskCreated((task) => console.log("A task was created.", task));

onTrackCalendarEvent()⚓︎

(callback: (args: { conversationIds: T42Id[], event: T42Appointment | T42Meeting }) => any) => void

Notifies when an appointment or meeting gets tracked. Returns an unsubscribe function. Only one subscriber is allowed at a time.

Parameters (1)

Name Type Required Description
callback⚓︎ (args: { conversationIds: T42Id[], event: T42Appointment | T42Meeting }) => any

Callback function for handling the event. Receives an object with conversationIds and event as an argument.

onTrackEmail()⚓︎

(callback: (args: { conversationIds: T42Id[], email: Email }) => any) => void

Notifies when an email gets tracked. Returns an unsubscribe function. Only one subscriber is allowed at a time.

Parameters (1)

Name Type Required Description
callback⚓︎ (args: { conversationIds: T42Id[], email: Email }) => any

Callback function for handling the event. Receives an object with conversationIds and email as an argument.

onUntrackCalendarEvent()⚓︎

(callback: (args: { conversationIds: T42Id[], eventIds: T42Id[] }) => any) => void

Notifies when an appointment or meeting gets untracked. Returns an unsubscribe function. Only one subscriber is allowed at a time.

Parameters (1)

Name Type Required Description
callback⚓︎ (args: { conversationIds: T42Id[], eventIds: T42Id[] }) => any

Callback function for handling the event. Receives an object with conversationIds and eventIds as an argument.

onUntrackEmail()⚓︎

(callback: (args: { conversationIds: T42Id[], emailIds: T42Id[] }) => any) => void

Notifies when an email gets untracked. Returns an unsubscribe function. Only one subscriber is allowed at a time.

Parameters (1)

Name Type Required Description
callback⚓︎ (args: { conversationIds: T42Id[], emailIds: T42Id[] }) => any

Callback function for handling the event. Receives an object with conversationIds and emailIds as an argument.

ready()⚓︎

() => Promise<API>

Resolves immediately with the Outlook API object.

showEmail()⚓︎

(ids: T42Id[]) => Promise<T42Id[]>

Shows email in Outlook.

Parameters (1)

Name Type Required Description
ids⚓︎ T42Id[]

The identifiers of the email to show.

Example

await outlook.newEmail(
    {
        to: "emailAddress@mail.com",
        subject: "Sample subject",
        body: "Sample body",
    },
    {
        onSent: async (email) => {
            const ids = await outlook.showEmail(email.ids);
            console.log(ids);
        },
    },
);

showTask()⚓︎

(ids: T42Id[]) => Promise<T42Id[]>

Shows task in Outlook.

Parameters (1)

Name Type Required Description
ids⚓︎ T42Id[]

The identifiers of the task to show.

taskFromJSON()⚓︎

(task: T42Task) => Task

Converts task object to Task with methods saveToFile() and show().

Parameters (1)

Name Type Required Description
task⚓︎ T42Task

The raw task object to convert.

trackCalendarEvent()⚓︎

(event: T42Appointment | T42Meeting, conversationId?: T42Id) => Promise<{ event: T42Appointment | T42Meeting, conversationIds: T42Id[], }>

Tracks appointment or meeting.

Parameters (2)

Name Type Required Description
event⚓︎ T42Appointment | T42Meeting

The appointment or meeting to track.

conversationId⚓︎ T42Id x

Optional conversation identifier.

untrackCalendarEvent()⚓︎

(event: T42Appointment | T42Meeting) => Promise<{ event: T42Appointment | T42Meeting }>

Untracks appointment or meeting.

Parameters (1)

Name Type Required Description
event⚓︎ T42Appointment | T42Meeting

The appointment or meeting to untrack.