-
Notifications
You must be signed in to change notification settings - Fork 5.3k
/
Copy pathcreate-contact.mjs
60 lines (59 loc) · 1.48 KB
/
create-contact.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import microsoftOutlook from "../../microsoft_outlook.app.mjs";
export default {
type: "action",
key: "microsoft_outlook-create-contact",
version: "0.0.13",
name: "Create Contact",
description: "Add a contact to the root Contacts folder, [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-post-contacts)",
props: {
microsoftOutlook,
givenName: {
propDefinition: [
microsoftOutlook,
"givenName",
],
},
surname: {
propDefinition: [
microsoftOutlook,
"surname",
],
},
emailAddresses: {
propDefinition: [
microsoftOutlook,
"emailAddresses",
],
},
businessPhones: {
propDefinition: [
microsoftOutlook,
"businessPhones",
],
},
expand: {
propDefinition: [
microsoftOutlook,
"expand",
],
description: "Additional contact details, [See object definition](https://docs.microsoft.com/en-us/graph/api/resources/contact)",
},
},
async run({ $ }) {
const response = await this.microsoftOutlook.createContact({
$,
data: {
givenName: this.givenName,
surname: this.surname,
emailAddresses: this.emailAddresses.map((a, i) => ({
address: a,
name: `Email #${i + 1}`,
})),
businessPhones: this.businessPhones,
...this.expand,
},
});
$.export("$summary", "Contact has been created.");
return response;
},
};