Outlook

1.6.2

The Glue42 Outlook Connector allows applications to use Outlook for creating emails, tasks, meetings and appointments, so that the user may view and edit these in a familiar environment. Once the items are sent or saved by the user, they can then be transmitted back to the application for processing, auditing and/or long-term storage.

The Glue42 Outlook Connector API lets your application interact with Outlook, and enables it to:

  • Initiate new emails with rich HTML body and attachments and get notified when the email has been sent.
  • Monitor certain folders in Outlook and get notified when an email has been received.
  • Save complete email messages with attachments in your web application.
  • Show a saved email in Outlook.
  • Initiate the creation of new tasks and get notified when a task is created.
  • Save complete tasks with attachments in your web application.
  • Show a saved task in Outlook.

See also the Outlook Connector documentation for more details.

object

methodshow
() => Promise<T42Id[]>

Description

Shows email in Outlook

Returns

Promise<T42Id[]>

Example

outlook
  .newEmail(
    {
      to: "emailAddress@mail.com",
      subject: "Sample subject",
      body: "Sample body"
    },
    {
      onSent: email => {
        email
          .show()
          .then(ids => console.log(ids))
          .catch(console.error);
      }
    }
  )
  .then(console.log)
  .catch(console.error);
methodsaveToFile
() => Promise<string>

Description

Saves email as .msg file

Returns

Promise<string>

Example

outlook
  .newEmail(
    {
      to: "emailAddress@mail.com",
      subject: "Sample subject",
      body: "Sample body"
    },
    {
      onSent: email => {
        email
          .saveToFile()
          .then(uri => console.log(uri))
          .catch(console.error);
      }
    }
  )
  .then(console.log)
  .catch(console.error);
methodgetAsMsg
() => Promise<string>

Description

Returns email, saved as .msg as base64

Returns

Promise<string>

Example

outlook
  .newEmail(
    {
      to: "emailAddress@mail.com",
      subject: "Sample subject",
      body: "Sample body"
    },
    {
      onSent: email => {
        email
          .getAsMsg()
          .then(data => console.log(data))
          .catch(console.error);
      }
    }
  )
  .then(console.log)
  .catch(console.error);
methodtrack
(conversationId: T42Id) => Promise<{ conversationIds: T42Id[]; emailIds: T42Id[]; }>

Description

Tracks email

Parameters

Name
Type
Required
Description

conversationId

no

Returns

Promise<{ conversationIds: T42Id[]; emailIds: T42Id[]; }>

Example

outlook
  .onTrackEmail(({ conversationIds, email }) => {
    email
      .track()
      .then(({ conversationIds, emailIds }) =>
        console.log(conversationIds, emailIds)
      )
      .catch(console.error);
  })
  .then(console.log)
  .catch(console.error);
methoduntrack
() => Promise<{ conversationIds: T42Id[]; emailIds: T42Id[]; }>

Description

Untracks email

Returns

Promise<{ conversationIds: T42Id[]; emailIds: T42Id[]; }>

Example

outlook
  .onTrackEmail(({ conversationIds, email }) => {
    email
      .track()
      .then(() => {
        email
          .untrack()
          .then(({ conversationIds, emailIds }) =>
            console.log(conversationIds, emailIds)
          )
          .catch(console.error);
      })
      .catch(console.error);
  })
  .then(console.log)
  .catch(console.error);

Properties

An array of identifiers for the attachments to the email

The blind co-recipient(s) of the email. If this parameter is missing then there are no blind co-recipients

string

The body text of the email, formatted as a plain string

string

The body of the email, formatted as an HTML string. If the email was not sent in HTML format, then the Helper must convert the plain-text body into a valid HTML string by wrapping it in the standard tags

The co-recipient(s) of the email. If this parameter is missing then there are no co-recipients

Date

The time at which the email was sent, using local time for the sender

Identifiers for the email; globally unique to the system

The originator of the email. This might be only the email address, if the T42Contact has not yet been resolved

string

The subject field of the email

The primary recipient(s) of the email

number

object

Description

The entry points of outlook API - accessible from g4o.outlook or g4oe.outlook

methodready
() => Promise<API>

Returns

Promise<API>

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

Description

Creates new email window

Parameters

Name
Type
Required
Description

emailParams

no

options

no

Returns

Promise<void>

Example

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")
    }
  )
  .then(console.log)
  .catch(console.error);
(event: T42Appointment | T42Meeting, conversationId: T42Id) => Promise<{ event: T42Appointment | T42Meeting; conversationIds: T42Id[]; }>

Description

Tracks appointment or meeting

Parameters

Name
Type
Required
Description

event

yes

conversationId

no

Returns

Promise<{ event: T42Appointment | T42Meeting; conversationIds: T42Id[]; }>

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

Description

Untracks appointment or meeting

Parameters

Name
Type
Required
Description

event

yes

Returns

Promise<{ event: T42Appointment | T42Meeting; }>

(localEmailParams: LocalEmailParams) => Promise<Email>

Description

Creates new local email

Parameters

Name
Type
Required
Description

localEmailParams

yes

Returns

Promise<Email>

Example

outlook
  .createLocalEmail({
    sender: "emailAddress@mail.com",
    to: "emailAddress@mail.com",
    subject: "Sample body",
    location: "$Inbox"
  })
  .then(console.log)
  .catch(console.error);
methodnewTask
(taskParams: TaskParams, options: NewTaskOptions) => Promise<void>

Description

Creates new task window

Parameters

Name
Type
Required
Description

taskParams

no

options

no

Returns

Promise<void>

Example

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")
    }
  )
  .then(console.log)
  .catch(console.error);
(email: T42Email) => Email

Parameters

Name
Type
Required
Description

email

yes

Returns

Email

(task: T42Task) => Task

Description

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

Parameters

Name
Type
Required
Description

task

yes

Returns

Task

Description

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

Parameters

Name
Type
Required
Description

attachment

yes

Returns

Attachment

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

Description

Shows email in Outlook

Parameters

Name
Type
Required
Description

ids

T42Id[]

yes

Returns

Promise<T42Id[]>

Example

outlook
  .newEmail(
    {
      to: "emailAddress@mail.com",
      subject: "Sample subject",
      body: "Sample body"
    },
    {
      onSent: email => {
        g4o.outlook
          .showEmail(email.ids)
          .then(console.log)
          .catch(console.error);
      }
    }
  )
  .then(console.log)
  .catch(console.error);
methodshowTask
(ids: T42Id[]) => Promise<T42Id[]>

Description

Shows task in Outlook

Parameters

Name
Type
Required
Description

ids

T42Id[]

yes

Returns

Promise<T42Id[]>

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

Description

Notifies when the connection status has changed

Parameters

Name
Type
Required
Description

callback

(args: { connected: boolean; }) => any

yes

Returns

() => void

Example

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

Description

Notifies when an email is received in GlueHandleEmail folder

Parameters

Name
Type
Required
Description

callback

(email: Email) => any

yes

Returns

void

Example

outlook.onEmailReceived(email => console.log("An email was received.", email));
(callback: (task: Task) => any) => void

Description

Notifies when an email is received in GlueHandleEmail folder

Parameters

Name
Type
Required
Description

callback

(task: Task) => any

yes

Returns

void

Example

outlook.onTaskCreated(task => console.log("A task was created.", task));
(callback: (args: { conversationIds: T42Id[]; email: Email; }) => any) => void

Description

Notifies when an email gets tracked

Parameters

Name
Type
Required
Description

callback

(args: { conversationIds: T42Id[]; email: Email; }) => any

yes

Returns

void

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

Description

Notifies when an email gets untracked

Parameters

Name
Type
Required
Description

callback

(args: { conversationIds: T42Id[]; emailIds: T42Id[]; }) => any

yes

Returns

void

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

Description

Notifies when an appointment or meeting gets tracked

Parameters

Name
Type
Required
Description

callback

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

yes

Returns

void

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

Description

Notifies when an appointment or meeting gets untracked

Parameters

Name
Type
Required
Description

callback

(args: { conversationIds: T42Id[]; eventIds: T42Id[]; }) => any

yes

Returns

void

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

Description

Notifies on secure reply to local email

Parameters

Name
Type
Required
Description

callback

(email: Email) => any

yes

Returns

void

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

Description

Notifies on request for local email to be displayed

Parameters

Name
Type
Required
Description

callback

(email: Email) => any

yes

Returns

void

Properties

boolean

Outlook addin status

object

Properties

(email: Email) => any

Callback which will be executed on send

() => any

Callback which will be executed on cancel

object

Description

This composite type describes the parameters to be populated on creating a new email

Properties

string

The subject field of the email

string | string[]

The primary recipient(s) of the email

string[] | AttachmentParams[]

An array of the full paths to existing files to be attached OR an array of objects with the name and data of each attachment to be dynamically created and attached

string | string[]

The blind co-recipient(s) of the email

string

The body text of the email, formatted as a plain string

string

The body of the email, formatted as an HTML string

string | string[]

The co-recipient(s) of the email

string

object

Description

This composite type describes the parameters to be populated on creating a new local email

Properties

object

Additional properties

string

The subject field of the email

string | string[]

The primary recipient(s) of the email

string

The sender of the email

The location where the local email will be created

string[] | AttachmentParams[]

An array of the full paths to existing files to be attached OR an array of objects with the name and data of each attachment to be dynamically created and attached

string | string[]

The blind co-recipient(s) of the email

string

The body text of the email, formatted as a plain string

string

The body of the email, formatted as an HTML string

string | string[]

The co-recipient(s) of the email

string

object

Properties

number

number

object

Description

This composite type describes the parameters to be populated on creating a new task

Properties

string[] | AttachmentParams[]

An array of the full paths to existing files to be attached OR an array of objects with the name and data of each attachment to be dynamically created and attached

string

The body text of the task, formatted as a plain string

string

string | number | Date

The start date of the task which is Date object, string Date or Unix timpestamp number

string | number | Date

The due time of the task which is Date object, string Date or Unix timpestamp number

"normal" | "low" | "high"

The priority of the task - “low”, “normal” or “high”

string | number | Date

The reminder time of the task which is Date object, string Date or Unix timpestamp number

string

The subject field of the task

object

Properties

(task: Task) => any

Callback which will be executed on save & close

() => any

Callback which will be executed on cancel

object

Description

This composite type describes the attachment file, created dynamically

Properties

string

Attachment file data

string

Attachment file name

boolean

string

object

Properties

An array of identifiers for the attachments to the email

The blind co-recipient(s) of the email. If this parameter is missing then there are no blind co-recipients

string

The body text of the email, formatted as a plain string

string

The body of the email, formatted as an HTML string. If the email was not sent in HTML format, then the Helper must convert the plain-text body into a valid HTML string by wrapping it in the standard tags

The co-recipient(s) of the email. If this parameter is missing then there are no co-recipients

Date

The time at which the email was sent, using local time for the sender

Identifiers for the email; globally unique to the system

The originator of the email. This might be only the email address, if the T42Contact has not yet been resolved

string

The subject field of the email

The primary recipient(s) of the email

number

object

Properties

string[] | AttachmentParams[]

An array of the full paths to existing files to be attached OR an array of objects with the name and data of each attachment to be dynamically created and attached

string | string[]

The blind co-recipient(s) of the email

string

The body text of the email, formatted as a plain string

string

The body of the email, formatted as an HTML string

string | string[]

The co-recipient(s) of the email

string

object

Properties

number

An array of identifiers for the attachments to the task

string

The body text of the task, formatted as a plain string

string

Date

The time at which the task was created, using local time for the sender.

Date

The time at which the task is due to be completed

Date

The due time of the task

The originator of the task

number

string

The priority of the task

Date

The reminder time of the task

Date

The start date time of the task

string

The subject field of the task

number

object

methodshow
() => Promise<T42Id[]>

Description

Shows task in Outlook

Returns

Promise<T42Id[]>

Example

outlook
  .newTask(
    {
      subject: "Sample subject",
      body: "Sample body",
      priority: "high",
      dueDate: new Date("2017-07-01")
    },
    {
      onSaved: task => {
        task
          .show()
          .then(ids => console.log(ids))
          .catch(console.error);
      }
    }
  )
  .then(console.log)
  .catch(console.error);
methodsaveToFile
() => Promise<string>

Description

Saves task as .msg file

Returns

Promise<string>

Example

outlook
  .newTask(
    {
      subject: "Sample subject",
      body: "Sample body",
      priority: "high",
      dueDate: new Date("2017-07-01")
    },
    {
      onSaved: task => {
        task
          .saveToFile()
          .then(uri => console.log(uri))
          .catch(console.error);
      }
    }
  )
  .then(console.log)
  .catch(console.error);

Properties

number

An array of identifiers for the attachments to the task

string

The body text of the task, formatted as a plain string

string

Date

The time at which the task was created, using local time for the sender.

Date

The time at which the task is due to be completed

Date

The due time of the task

The originator of the task

number

string

The priority of the task

Date

The reminder time of the task

Date

The start date time of the task

string

The subject field of the task

number

object

methodgetData
(callback: (percent: number) => number) => Promise<string>

Description

Returns attachment data as base64

Parameters

Name
Type
Required
Description

callback

(percent: number) => number

no

  • A callback which will be called multiple times with the percent of progress

Returns

Promise<string>

Properties

Returns the parent of the attachment

string

Optional id of the email owning the attachment. This field is only required when a T42Attachment value is used outside the context of the email that owns it

string

string

Identifiers for the attachment, which is unique within a single email

boolean

string

Display name for the attachment; typically a filename without a path. Therefore, neither the Helper nor the CRM should rely on identifying the attachment using this field

number

An estimate of the size of the attachment. This is an estimate of the size that the attachment would have if it were saved to disk. It is not the size of the encoded string (e.g. MIME) and it is an advisory-value only, to help with storage optimisations. Neither the Helper nor the CRM should rely on this field being present and 100% accurate in all cases (especially when the attachment may be encoded or encrypted In some way)

boolean

number

number

object

Description

This is a Glue composite value that describes a single contact within the system

Properties

Identifier for the contact; globally unique to the system

string

Advisory only. A user-friendly name for this object to use in debug logs etc.

object

The name of the contact. Optional in case the name has not yet been resolved from the email, or id etc.

string

The status of the contact, e.g. “client”, “prospect”, “lead”

boolean

Is the contact a single person?

object[]

The account allocated to this contact

string[]

Each T42Address includes a description saying the type of address, e.g. “home”, “office”

object[]

An array of phone numbers for this contact

string[]

An array of email addresses for this contact

object

A dictionary of CRM specific fields

object

Description

This composite type describes a file attachment to an email or a task

Properties

string

Optional id of the email owning the attachment. This field is only required when a T42Attachment value is used outside the context of the email that owns it

string

string

Identifiers for the attachment, which is unique within a single email

boolean

string

Display name for the attachment; typically a filename without a path. Therefore, neither the Helper nor the CRM should rely on identifying the attachment using this field

number

An estimate of the size of the attachment. This is an estimate of the size that the attachment would have if it were saved to disk. It is not the size of the encoded string (e.g. MIME) and it is an advisory-value only, to help with storage optimisations. Neither the Helper nor the CRM should rely on this field being present and 100% accurate in all cases (especially when the attachment may be encoded or encrypted In some way)

boolean

number

number

object

Properties

string

The cookie of the email

string

The email data in base64 format

string

Error message

boolean

Set to true if the data has been chunked and there are more chunks to be received

number

number

boolean

True if the data is returned successfully

number

object

Description

This is the universal identifier class for an object in the CRM-Helper system. It consists of two elements: An optional user-friendly display name, that has no meaning to the CRM or the Helper but may be useful for displaying to the user; an array of application-specific name-value pairs that identify the object to each window in the system.

Properties

string

Identifies the creator of the id

string

The opaque value that identifies the object to the named system

object

Description

This is a Glue composite value that describes an appointment

Properties

The originator of the appointment

An array of identifiers for the attachments to the appointment

string

The subject field of the appointment

string

The body text of the appointment, formatted as a plain string

string

The body of the appointment, formatted as an HTML string

string

The location of the appointment

Date

The start date time of the appointment

Date

The end date time of the appointment

boolean

Is the appointment all day long

The primary recipient(s) of the appointment

The co-recipient(s) of the appointment

The blind co-recipient(s) of the appointment

boolean

number

object

Description

This is a Glue composite value that describes an meeting

Properties

The originator of the meeting

An array of identifiers for the attachments to the meeting

string

The subject field of the meeting

string

The body text of the meeting, formatted as a plain string

The primary recipient(s) of the meeting

The co-recipient(s) of the meeting

The blind co-recipient(s) of the meeting

The sender of the meeting

Date

The reminder time of the meeting

number