Outlook
1.6.5The 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.
APIobject
Description
The entry points of outlook API - accessible from g4o.outlook or g4oe.outlook
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
addinStatus | boolean | Outlook addin status |
Methods
attachmentFromJSONmethod
Signature
(attachment: T42Attachment) => Attachment
Description
Converts attachment object to Attachment with method getData() but without the parent property
Parameters
Name | Type | Required | Description |
---|---|---|---|
attachment | T42Attachment |
createLocalEmailmethod
Signature
(localEmailParams: LocalEmailParams) => Promise<Email>
Description
Creates new local email
Parameters
Name | Type | Required | Description |
---|---|---|---|
localEmailParams | LocalEmailParams |
Example
outlook
.createLocalEmail({
sender: "emailAddress@mail.com",
to: "emailAddress@mail.com",
subject: "Sample body",
location: "$Inbox"
})
.then(console.log)
.catch(console.error);
emailFromJSONmethod
newEmailmethod
Signature
(emailParams?: EmailParams, options?: NewEmailOptions) => Promise<void>
Description
Creates new email window
Parameters
Name | Type | Required | Description |
---|---|---|---|
emailParams | EmailParams | ||
options | NewEmailOptions |
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);
newTaskmethod
Signature
(taskParams?: TaskParams, options?: NewTaskOptions) => Promise<void>
Description
Creates new task window
Parameters
Name | Type | Required | Description |
---|---|---|---|
taskParams | TaskParams | ||
options | NewTaskOptions |
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);
onAddinStatusChangedmethod
Signature
(callback: (args: { connected: boolean; }) => any) => () => void
Description
Notifies when the connection status has changed
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (args: { connected: boolean; }) => any |
Example
outlook.onAddinStatusChanged(({ connected }) => {
console.log(`Outlook is ${connected ? "available" : "unavailable"}.`);
});
onDisplaySecureEmailmethod
onEmailReceivedmethod
onSecureReplymethod
onTaskCreatedmethod
onTrackCalendarEventmethod
Signature
(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 |
onTrackEmailmethod
onUntrackCalendarEventmethod
onUntrackEmailmethod
readymethod
Signature
() => Promise<API>
showEmailmethod
Signature
(ids: T42Id[]) => Promise<T42Id[]>
Description
Shows email in Outlook
Parameters
Name | Type | Required | Description |
---|---|---|---|
ids | 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);
showTaskmethod
taskFromJSONmethod
trackCalendarEventmethod
Signature
(event: T42Appointment | T42Meeting, conversationId?: T42Id) => Promise<{ event: T42Appointment | T42Meeting; conversationIds: T42Id[]; }>
Description
Tracks appointment or meeting
Parameters
Name | Type | Required | Description |
---|---|---|---|
event | T42Appointment | T42Meeting | ||
conversationId | T42Id |
untrackCalendarEventmethod
Signature
(event: T42Appointment | T42Meeting) => Promise<{ event: T42Appointment | T42Meeting; }>
Description
Untracks appointment or meeting
Parameters
Name | Type | Required | Description |
---|---|---|---|
event | T42Appointment | T42Meeting |
Attachmentobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
cookie | string | |||
data | string | |||
emailIds | T42Id[] | 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 |
||
errorMessage | string | |||
ids | T42Id[] | Identifiers for the attachment, which is unique within a single email |
||
length | number | |||
more | boolean | |||
name | 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 |
||
parent | Email | Task | Returns the parent of the attachment |
||
sizeHint | 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) |
||
success | boolean | |||
totalLength | number |
Methods
getDatamethod
Signature
(callback?: (percent: number) => number) => Promise<string>
Description
Returns attachment data as base64
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (percent: number) => number |
|
AttachmentParamsobject
Description
This composite type describes the attachment file, created dynamically
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
data | string | Attachment file data |
||
encoding | string | |||
fileName | string | Attachment file name |
||
truncate | boolean |
CommonEmailParamsobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
attachments | 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 |
||
bcc | string | string[] | The blind co-recipient(s) of the email |
||
body | string | The body text of the email, formatted as a plain string |
||
bodyHtml | string | The body of the email, formatted as an HTML string |
||
cc | string | string[] | The co-recipient(s) of the email |
||
cookie | string |
CommonOutlookFolderobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
$Inbox | number | |||
$SentMail | number |
Emailobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
attachments | Attachment[] | An array of identifiers for the attachments to the email |
||
bcc | T42Contact | T42Contact[] | The blind co-recipient(s) of the email. If this parameter is missing then there are no blind co-recipients |
||
body | string | The body text of the email, formatted as a plain string |
||
bodyHtml | 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 |
||
cc | T42Contact | T42Contact[] | The co-recipient(s) of the email. If this parameter is missing then there are no co-recipients |
||
date | Date | The time at which the email was sent, using local time for the sender |
||
entityType | number | |||
ids | T42Id[] | Identifiers for the email; globally unique to the system |
||
sender | T42Contact | The originator of the email. This might be only the email address, if the T42Contact has not yet been resolved |
||
subject | string | The subject field of the email |
||
to | T42Contact | T42Contact[] | The primary recipient(s) of the email |
Methods
getAsMsgmethod
Signature
() => Promise<string>
Description
Returns email, saved as .msg as base64
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);
saveToFilemethod
Signature
() => Promise<string>
Description
Saves email as .msg file
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);
showmethod
Signature
() => Promise<T42Id[]>
Description
Shows email in Outlook
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);
trackmethod
Signature
(conversationId?: T42Id) => Promise<{ conversationIds: T42Id[]; emailIds: T42Id[]; }>
Description
Tracks email
Parameters
Name | Type | Required | Description |
---|---|---|---|
conversationId | T42Id |
Example
outlook
.onTrackEmail(({ conversationIds, email }) => {
email
.track()
.then(({ conversationIds, emailIds }) =>
console.log(conversationIds, emailIds)
)
.catch(console.error);
})
.then(console.log)
.catch(console.error);
untrackmethod
Signature
() => Promise<{ conversationIds: T42Id[]; emailIds: T42Id[]; }>
Description
Untracks email
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);
EmailParamsobject
Description
This composite type describes the parameters to be populated on creating a new email
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
attachments | 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 |
||
bcc | string | string[] | The blind co-recipient(s) of the email |
||
body | string | The body text of the email, formatted as a plain string |
||
bodyHtml | string | The body of the email, formatted as an HTML string |
||
cc | string | string[] | The co-recipient(s) of the email |
||
cookie | string | |||
subject | string | The subject field of the email |
||
to | string | string[] | The primary recipient(s) of the email |
GetEmailAsMsgCallbackParamsobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
cookie | string | The cookie of the email |
||
data | string | The email data in base64 format |
||
errorMessage | string | Error message |
||
length | number | |||
more | boolean | Set to true if the data has been chunked and there are more chunks to be received |
||
offset | number | |||
success | boolean | True if the data is returned successfully |
||
totalLength | number |
LocalEmailParamsobject
Description
This composite type describes the parameters to be populated on creating a new local email
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
additionalProps | object | Additional properties |
||
attachments | 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 |
||
bcc | string | string[] | The blind co-recipient(s) of the email |
||
body | string | The body text of the email, formatted as a plain string |
||
bodyHtml | string | The body of the email, formatted as an HTML string |
||
cc | string | string[] | The co-recipient(s) of the email |
||
cookie | string | |||
location | string | Email | CommonOutlookFolder | The location where the local email will be created |
||
sender | string | The sender of the email |
||
subject | string | The subject field of the email |
||
to | string | string[] | The primary recipient(s) of the email |
NewEmailOptionsobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
onCanceled | () => any | Callback which will be executed on cancel |
||
onSent | (email: Email) => any | Callback which will be executed on send |
NewTaskOptionsobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
onCanceled | () => any | Callback which will be executed on cancel |
||
onSaved | (task: Task) => any | Callback which will be executed on save & close |
T42Appointmentobject
Description
This is a Glue composite value that describes an appointment
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
allDayEvent | boolean | Is the appointment all day long |
||
attachments | T42Attachment[] | An array of identifiers for the attachments to the appointment |
||
bcc | T42Contact | T42Contact[] | The blind co-recipient(s) of the appointment |
||
body | string | The body text of the appointment, formatted as a plain string |
||
bodyHtml | string | The body of the appointment, formatted as an HTML string |
||
busyStatus | boolean | |||
cc | T42Contact | T42Contact[] | The co-recipient(s) of the appointment |
||
endTime | Date | The end date time of the appointment |
||
entityType | number | |||
ids | T42Id[] | The originator of the appointment |
||
location | string | The location of the appointment |
||
startTime | Date | The start date time of the appointment |
||
subject | string | The subject field of the appointment |
||
to | T42Contact | T42Contact[] | The primary recipient(s) of the appointment |
T42Attachmentobject
Description
This composite type describes a file attachment to an email or a task
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
cookie | string | |||
data | string | |||
emailIds | T42Id[] | 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 |
||
errorMessage | string | |||
ids | T42Id[] | Identifiers for the attachment, which is unique within a single email |
||
length | number | |||
more | boolean | |||
name | 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 |
||
sizeHint | 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) |
||
success | boolean | |||
totalLength | number |
T42Contactobject
Description
This is a Glue composite value that describes a single contact within the system
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
account | object[] | The account allocated to this contact |
||
addresses | string[] | Each T42Address includes a description saying the type of address, e.g. “home”, “office” |
||
context | object | A dictionary of CRM specific fields |
||
displayName | string | Advisory only. A user-friendly name for this object to use in debug logs etc. |
||
emails | string[] | An array of email addresses for this contact |
||
ids | T42Id[] | Identifier for the contact; globally unique to the system |
||
isPerson | boolean | Is the contact a single person? |
||
name | object | The name of the contact. Optional in case the name has not yet been resolved from the email, or id etc. |
||
phones | object[] | An array of phone numbers for this contact |
||
status | string | The status of the contact, e.g. “client”, “prospect”, “lead” |
T42Emailobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
attachments | Attachment[] | An array of identifiers for the attachments to the email |
||
bcc | T42Contact | T42Contact[] | The blind co-recipient(s) of the email. If this parameter is missing then there are no blind co-recipients |
||
body | string | The body text of the email, formatted as a plain string |
||
bodyHtml | 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 |
||
cc | T42Contact | T42Contact[] | The co-recipient(s) of the email. If this parameter is missing then there are no co-recipients |
||
date | Date | The time at which the email was sent, using local time for the sender |
||
entityType | number | |||
ids | T42Id[] | Identifiers for the email; globally unique to the system |
||
sender | T42Contact | The originator of the email. This might be only the email address, if the T42Contact has not yet been resolved |
||
subject | string | The subject field of the email |
||
to | T42Contact | T42Contact[] | The primary recipient(s) of the email |
T42Idobject
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
Property | Type | Default | Required | Description |
---|---|---|---|---|
nativeId | string | The opaque value that identifies the object to the named system |
||
systemName | string | Identifies the creator of the id |
T42Meetingobject
Description
This is a Glue composite value that describes an meeting
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
attachments | T42Attachment[] | An array of identifiers for the attachments to the meeting |
||
bcc | T42Contact | T42Contact[] | The blind co-recipient(s) of the meeting |
||
body | string | The body text of the meeting, formatted as a plain string |
||
cc | T42Contact | T42Contact[] | The co-recipient(s) of the meeting |
||
entityType | number | |||
ids | T42Id[] | The originator of the meeting |
||
reminderTime | Date | The reminder time of the meeting |
||
sender | T42Contact | The sender of the meeting |
||
subject | string | The subject field of the meeting |
||
to | T42Contact | T42Contact[] | The primary recipient(s) of the meeting |
T42Taskobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
actualWork | number | |||
attachments | Attachment[] | An array of identifiers for the attachments to the task |
||
body | string | The body text of the task, formatted as a plain string |
||
cookie | string | |||
creationTime | Date | The time at which the task was created, using local time for the sender. |
||
dateCompleted | Date | The time at which the task is due to be completed |
||
dueDate | Date | The due time of the task |
||
entityType | number | |||
ids | T42Id[] | The originator of the task |
||
importance | number | |||
priority | string | The priority of the task |
||
reminderTime | Date | The reminder time of the task |
||
startDate | Date | The start date time of the task |
||
subject | string | The subject field of the task |
Taskobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
actualWork | number | |||
attachments | Attachment[] | An array of identifiers for the attachments to the task |
||
body | string | The body text of the task, formatted as a plain string |
||
cookie | string | |||
creationTime | Date | The time at which the task was created, using local time for the sender. |
||
dateCompleted | Date | The time at which the task is due to be completed |
||
dueDate | Date | The due time of the task |
||
entityType | number | |||
ids | T42Id[] | The originator of the task |
||
importance | number | |||
priority | string | The priority of the task |
||
reminderTime | Date | The reminder time of the task |
||
startDate | Date | The start date time of the task |
||
subject | string | The subject field of the task |
Methods
saveToFilemethod
Signature
() => Promise<string>
Description
Saves task as .msg file
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);
showmethod
Signature
() => Promise<T42Id[]>
Description
Shows task in Outlook
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);
TaskParamsobject
Description
This composite type describes the parameters to be populated on creating a new task
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
attachments | 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 |
||
body | string | The body text of the task, formatted as a plain string |
||
cookie | string | |||
dueDate | string | number | Date | The due time of the task which is Date object, string Date or Unix timpestamp number |
||
priority | "normal" | "low" | "high" | The priority of the task - "low", "normal" or "high" |
||
reminderTime | string | number | Date | The reminder time of the task which is Date object, string Date or Unix timpestamp number |
||
startDate | string | number | Date | The start date of the task which is Date object, string Date or Unix timpestamp number |
||
subject | string | The subject field of the task |