feature/outlook shared mailbox (#1323)

*  Add shared mailbox support

* 🐛 Add filter field to folderMessage:getAll

*  Small changes to descriptions (#1322)

Co-authored-by: Mika Luhta <12100880+mluhta@users.noreply.github.com>
This commit is contained in:
Ricardo Espinoza
2021-01-10 18:09:58 -05:00
committed by GitHub
parent 76cee5577b
commit d78aaa2d64
5 changed files with 36 additions and 4 deletions

View File

@@ -14,6 +14,14 @@ import {
} from 'n8n-workflow';
export async function microsoftApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, headers: IDataObject = {}, option: IDataObject = { json: true }): Promise<any> { // tslint:disable-line:no-any
const credentials = this.getCredentials('microsoftOutlookOAuth2Api');
let apiUrl = `https://graph.microsoft.com/v1.0/me${resource}`;
// If accessing shared mailbox
if (credentials!.useShared && credentials!.userPrincipalName) {
apiUrl = `https://graph.microsoft.com/v1.0/users/${credentials!.userPrincipalName}${resource}`;
}
const options: OptionsWithUri = {
headers: {
'Content-Type': 'application/json',
@@ -21,7 +29,7 @@ export async function microsoftApiRequest(this: IExecuteFunctions | IExecuteSing
method,
body,
qs,
uri: uri || `https://graph.microsoft.com/v1.0/me${resource}`,
uri: uri || apiUrl,
};
try {
Object.assign(options, option);