MS Graph - cron configuration

The basic steps for setting up a mailbox can be found here .

MS Graph cron configuration MsGraphCreateProcessesFromMailCron.js :

In the email box, I need to allow MS Graph access to the boxes I want to access.
If necessary, to access multiple mailboxes within cron, just create another object with the configuration in "items" .
{
"amountOfEmailByRun": 10, /// Maximální počet stažených emailů na jeden běh cronu
"items": [
{
"auth": {
"emailAddress": "your_mailbox@mail.com",
"tenantId": "xxx",
"clientId": "xxx",
"clientSecret": "xxx",
"type": "secret"
},
"folders": {
"in": { /// Vstupní složka, odkud cron čte maily
"id": "AQMkADg0MjYzNGRjLTRlNWEtNDM1Zi05ZTNiLWIyMGM0MDk4M2MzMgAuAAAEUtvwUxN2T57o_amJWiFMAQBlyfKJ66aURpYiUSTGCCnfAAR7Pb2oXXXX"
},
"out": { /// Výstupní složka, odkud cron čte maily
"id": "AQMkADg0MjYzNGRjLTRlNWEtNDM1Zi05ZTNiLWIyMGM0MDk4M2MzMgAuAAAEUtvwUxN2T57o_amJWiFMAQBlyfKJ66aURpYiUSTGCCnfAAR7Pb2pXXXY"
}
},
"process": {
"user_id": 1, /// User pod, kterým jsou případy v TASu zakládány
"tproc_id": 132, /// ID šablony, ze které jsou případy zakládány
"header_id": 199, /// Hlavička případu
"tproc_version": 1 /// Verze šablony, vždy 1 zatím
},
"config": {
"setEmailProcessedOnError": true, /// Odesílat email v případě chybného zpracování
"errorEmailAddress": "your_admin@mail.group" /// Adresa, kam je případně odeslán email s chybou ve zpracování
},
"ignoreAttachmentErrors": true, /// Pokud je true, ignoruje případné chyby u příloh (encrypted zip file, nefunkčni dms...) pouze zaloguje error, ale zpracování proběhne.

"ignoreVariablesUpdateAndUseDataHolder": false,
"useEmailObjectInDataHolder": false,
"mapping": {
"emailBody": "body.content",
"dmAnnotation": {
"value": "subject",
"option": "optional"
},
"sender": {
"value": "from.emailAddress.address",
"option": "optional"
},
"emailRecipients": {
"value": "toRecipients[0].emailAddress.address",
"option": "optional"
},
"emailRecipientsCopy": {
"value": "ccRecipients[0].emailAddress.address",
"option": "optional"
},
"emailDeliveryDate": "receivedDateTime",
"_distributionRequired": {
"value": "yes",
"isConstant": true
},
"mailSource": {
"value": "Email",
"isConstant": true
}
}
}
]
}

Within the service console in TAS ( https://your_tas.app/administration/service-console ), you can use folder listings and work with emails, similar to EWS:

  • sys.msGraphGetMailDetails(itemIndex, mailId);

itemIndex | Number | item (mailbox) index from cron parameter

mailId | String | Id of the email you want to retrieve

  • sys.msGraphListMailsFromFolder(itemIndex, folderId)

itemIndex | Number | item (mailbox) index from cron parameter

folderId | String | Id of the folder from which you want to list emails

selectedFields | String | Which elements should be listed from the email?

pageSize | Number | The number of items to return. The default value is 20.

offset | Number | A number that specifies where to start loading data in a numbered set. Basically, it shows a list of the first 10 items. The default value is 0. To display the next 10, I can use offset.

  • sys.msGraphMoveMail(itemIndex, mailId, toFolderId);

itemIndex | Number | item (mailbox) index from cron parameter

mailId | String | Id of the email you want to move

toFolderId | String | Id of the folder you want to move to

  • sys.msGraphSetEmailAsRead(itemIndex, mailId);

itemIndex | Number | item (mailbox) index from cron parameter

mailId | String | Id of the email you want to mark as read

  • sys.msGraphSetEmailAsUnread(itemIndex, mailId);

itemIndex | Number | item (mailbox) index from cron parameter

mailId | String | Id of the email you want to mark as unread

  • sys.msGraphListChildFoldersFromFolder(itemIndex, folderId, offset);

itemIndex | Number | item (mailbox) index from cron parameter (0 mostly)

folderId | String | Folder ID

offset | Number | A number that specifies where to start loading data in the listing. Basically, the listing shows the first 10 items. The default value is 0. To display the next 10, I can use offset.

  • sys.msGraphListFolders(itemIndex,offset);

itemIndex | Number | item (mailbox) index from cron parameter (0 mostly)

offset | Number | A number that specifies where to start loading data in the listing. Basically, the listing shows the first 10 items. The default value is 0. To display the next 10, I can use offset.

Frantisek Brych Updated by Frantisek Brych

MS Graph - cron configuration

Contact

Syca (opens in a new tab)

Powered by HelpDocs (opens in a new tab)