@pipedream/sharepoint 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/create-folder/create-folder.mjs +1 -1
- package/actions/create-item/create-item.mjs +1 -1
- package/actions/create-link/create-link.mjs +1 -1
- package/actions/create-list/create-list.mjs +1 -1
- package/actions/download-file/download-file.mjs +1 -1
- package/actions/find-file-by-name/find-file-by-name.mjs +1 -1
- package/actions/find-files-with-metadata/find-files-with-metadata.mjs +132 -0
- package/actions/get-excel-table/get-excel-table.mjs +2 -1
- package/actions/get-file-by-id/get-file-by-id.mjs +1 -1
- package/actions/get-site/get-site.mjs +1 -1
- package/actions/list-files-in-folder/list-files-in-folder.mjs +1 -1
- package/actions/list-sites/list-sites.mjs +1 -1
- package/actions/search-and-filter-files/search-and-filter-files.mjs +155 -0
- package/actions/search-files/search-files.mjs +1 -1
- package/actions/search-sites/search-sites.mjs +1 -1
- package/actions/select-files/select-files.mjs +1 -1
- package/actions/update-item/update-item.mjs +1 -1
- package/actions/upload-file/upload-file.mjs +1 -1
- package/package.json +1 -1
- package/sharepoint.app.mjs +31 -10
- package/sources/new-file-created/new-file-created.mjs +1 -1
- package/sources/new-folder-created/new-folder-created.mjs +1 -1
- package/sources/new-list-item/new-list-item.mjs +1 -1
- package/sources/updated-list-item/updated-list-item.mjs +1 -1
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-create-folder",
|
|
5
5
|
name: "Create Folder",
|
|
6
6
|
description: "Create a new folder in SharePoint. [See the documentation](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_post_children?view=odsp-graph-online)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.4",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-create-item",
|
|
5
5
|
name: "Create Item",
|
|
6
6
|
description: "Create a new item in Microsoft Sharepoint. [See the documentation](https://learn.microsoft.com/en-us/graph/api/listitem-create?view=graph-rest-1.0&tabs=http)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.10",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: false,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "sharepoint-create-link",
|
|
6
6
|
name: "Create Link",
|
|
7
7
|
description: "Create a sharing link for a DriveItem. [See the documentation](https://docs.microsoft.com/en-us/graph/api/driveitem-createlink?view=graph-rest-1.0&tabs=http)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.5",
|
|
9
9
|
type: "action",
|
|
10
10
|
annotations: {
|
|
11
11
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-create-list",
|
|
5
5
|
name: "Create List",
|
|
6
6
|
description: "Create a new list in Microsoft Sharepoint. [See the documentation](https://learn.microsoft.com/en-us/graph/api/list-create?view=graph-rest-1.0&tabs=http)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.10",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: false,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "sharepoint-download-file",
|
|
6
6
|
name: "Download File",
|
|
7
7
|
description: "Download a Microsoft Sharepoint file to the /tmp directory. [See the documentation](https://learn.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.10",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "sharepoint-find-file-by-name",
|
|
7
7
|
name: "Find File by Name",
|
|
8
8
|
description: "Search for a file or folder by name. [See the documentation](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_search)",
|
|
9
|
-
version: "0.1.
|
|
9
|
+
version: "0.1.2",
|
|
10
10
|
type: "action",
|
|
11
11
|
annotations: {
|
|
12
12
|
destructiveHint: false,
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import sharepoint from "../../sharepoint.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "sharepoint-find-files-with-metadata",
|
|
5
|
+
name: "Find Files in List with Metadata",
|
|
6
|
+
description:
|
|
7
|
+
"Search and filter items in a SharePoint list based on metadata and custom columns. [See docs here](https://learn.microsoft.com/en-us/graph/api/listitem-list)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
annotations: {
|
|
11
|
+
destructiveHint: false,
|
|
12
|
+
openWorldHint: true,
|
|
13
|
+
readOnlyHint: true,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
sharepoint,
|
|
17
|
+
siteId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
sharepoint,
|
|
20
|
+
"siteId",
|
|
21
|
+
],
|
|
22
|
+
description: "Select the SharePoint site.",
|
|
23
|
+
},
|
|
24
|
+
listId: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
sharepoint,
|
|
27
|
+
"listId",
|
|
28
|
+
(c) => ({
|
|
29
|
+
siteId: c.siteId,
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
description: "Select the list or document library to search within.",
|
|
33
|
+
},
|
|
34
|
+
returnFields: {
|
|
35
|
+
propDefinition: [
|
|
36
|
+
sharepoint,
|
|
37
|
+
"columnNames",
|
|
38
|
+
(c) => ({
|
|
39
|
+
siteId: c.siteId,
|
|
40
|
+
listId: c.listId,
|
|
41
|
+
mapper: ({
|
|
42
|
+
name, displayName,
|
|
43
|
+
}) => ({
|
|
44
|
+
label: displayName,
|
|
45
|
+
value: name,
|
|
46
|
+
}),
|
|
47
|
+
}),
|
|
48
|
+
],
|
|
49
|
+
label: "Fields to Return",
|
|
50
|
+
description:
|
|
51
|
+
"Select which custom fields to return. If left empty, all custom fields are returned.",
|
|
52
|
+
optional: true,
|
|
53
|
+
},
|
|
54
|
+
filter: {
|
|
55
|
+
type: "string",
|
|
56
|
+
label: "Filter Query",
|
|
57
|
+
description:
|
|
58
|
+
"OData filter query. To filter by a custom column, use the format `fields/InternalName eq 'Value'`. The field picker for 'Fields to Return' shows the `InternalName` in parentheses.",
|
|
59
|
+
optional: true,
|
|
60
|
+
},
|
|
61
|
+
orderby: {
|
|
62
|
+
type: "string",
|
|
63
|
+
label: "Order By",
|
|
64
|
+
description:
|
|
65
|
+
"OData order by query (e.g., `lastModifiedDateTime desc`). To sort by a custom field, use `fields/InternalName asc`.",
|
|
66
|
+
optional: true,
|
|
67
|
+
},
|
|
68
|
+
select: {
|
|
69
|
+
type: "string[]",
|
|
70
|
+
label: "Top-level Properties",
|
|
71
|
+
description:
|
|
72
|
+
"Select which top-level item properties to return. If not specified, a default set is returned. `id` and `webUrl` are always returned.",
|
|
73
|
+
optional: true,
|
|
74
|
+
options: [
|
|
75
|
+
"id",
|
|
76
|
+
"name",
|
|
77
|
+
"createdDateTime",
|
|
78
|
+
"lastModifiedDateTime",
|
|
79
|
+
"webUrl",
|
|
80
|
+
"size",
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
async run({ $ }) {
|
|
85
|
+
const {
|
|
86
|
+
siteId, listId, returnFields, filter, orderby, select,
|
|
87
|
+
} = this;
|
|
88
|
+
|
|
89
|
+
const params = {
|
|
90
|
+
$filter: filter,
|
|
91
|
+
$orderby: orderby,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
let expandValue = "fields";
|
|
95
|
+
if (returnFields?.length > 0) {
|
|
96
|
+
expandValue = `fields($select=${returnFields.join(",")})`;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (select?.length > 0) {
|
|
100
|
+
const selectSet = new Set(select);
|
|
101
|
+
selectSet.add("id");
|
|
102
|
+
selectSet.add("webUrl");
|
|
103
|
+
params.$select = Array.from(selectSet).join(",");
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
params.$expand = expandValue;
|
|
107
|
+
|
|
108
|
+
const results = [];
|
|
109
|
+
const iterator = this.sharepoint.paginate({
|
|
110
|
+
fn: this.sharepoint.listItems,
|
|
111
|
+
args: {
|
|
112
|
+
siteId,
|
|
113
|
+
listId,
|
|
114
|
+
params,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
for await (const item of iterator) {
|
|
119
|
+
results.push(item);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
$.export(
|
|
123
|
+
"$summary",
|
|
124
|
+
`Successfully found ${results.length} item${
|
|
125
|
+
results.length === 1
|
|
126
|
+
? ""
|
|
127
|
+
: "s"
|
|
128
|
+
}.`,
|
|
129
|
+
);
|
|
130
|
+
return results;
|
|
131
|
+
},
|
|
132
|
+
};
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-get-excel-table",
|
|
5
5
|
name: "Get Excel Table",
|
|
6
6
|
description: "Retrieve a table from an Excel spreadsheet stored in Sharepoint [See the documentation](https://learn.microsoft.com/en-us/graph/api/table-range?view=graph-rest-1.0&tabs=http)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.5",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -13,6 +13,7 @@ export default {
|
|
|
13
13
|
},
|
|
14
14
|
props: {
|
|
15
15
|
sharepoint,
|
|
16
|
+
// eslint-disable-next-line pipedream/props-label, pipedream/props-description
|
|
16
17
|
alert: {
|
|
17
18
|
type: "alert",
|
|
18
19
|
alertType: "info",
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-get-file-by-id",
|
|
5
5
|
name: "Get File by ID",
|
|
6
6
|
description: "Retrieves a file by ID. [See the documentation](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_get)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.4",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-get-site",
|
|
5
5
|
name: "Get Site",
|
|
6
6
|
description: "Get a site in Microsoft Sharepoint. [See the documentation](https://learn.microsoft.com/en-us/graph/api/site-get?view=graph-rest-1.0&tabs=http)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.2",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-list-files-in-folder",
|
|
5
5
|
name: "List Files in Folder",
|
|
6
6
|
description: "Retrieves a list of the files and/or folders directly within a folder. [See the documentation](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_list_children)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.4",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-list-sites",
|
|
5
5
|
name: "List Sites",
|
|
6
6
|
description: "List all sites in Microsoft Sharepoint. [See the documentation](https://learn.microsoft.com/en-us/graph/api/site-list?view=graph-rest-1.0&tabs=http)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.2",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import sharepoint from "../../sharepoint.app.mjs";
|
|
2
|
+
import utils from "../../common/utils.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "sharepoint-search-and-filter-files",
|
|
6
|
+
name: "Search and Filter Files",
|
|
7
|
+
description:
|
|
8
|
+
"Search and filter SharePoint files based on metadata and custom columns. This action allows you to query files using SharePoint's custom properties, managed metadata, and other column values. [See the documentation](https://learn.microsoft.com/en-us/graph/api/listitem-list)",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "action",
|
|
11
|
+
annotations: {
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
readOnlyHint: true,
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
sharepoint,
|
|
18
|
+
siteId: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
sharepoint,
|
|
21
|
+
"siteId",
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
listId: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
sharepoint,
|
|
27
|
+
"listId",
|
|
28
|
+
(c) => ({
|
|
29
|
+
siteId: c.siteId,
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
label: "List / Document Library",
|
|
33
|
+
description: "Select the document library or list to search in",
|
|
34
|
+
},
|
|
35
|
+
filter: {
|
|
36
|
+
type: "string",
|
|
37
|
+
label: "Filter",
|
|
38
|
+
description:
|
|
39
|
+
"Filter items using OData syntax. To filter by custom columns, use `fields/ColumnInternalName`. Example: `fields/Title eq 'My File'` or `fields/Status eq 'Approved'`. [See OData filter documentation](https://learn.microsoft.com/en-us/graph/query-parameters#filter-parameter)",
|
|
40
|
+
optional: true,
|
|
41
|
+
},
|
|
42
|
+
select: {
|
|
43
|
+
propDefinition: [
|
|
44
|
+
sharepoint,
|
|
45
|
+
"columnNames",
|
|
46
|
+
(c) => ({
|
|
47
|
+
siteId: c.siteId,
|
|
48
|
+
listId: c.listId,
|
|
49
|
+
mapper: ({
|
|
50
|
+
name, displayName,
|
|
51
|
+
}) => ({
|
|
52
|
+
label: displayName,
|
|
53
|
+
value: name,
|
|
54
|
+
}),
|
|
55
|
+
}),
|
|
56
|
+
],
|
|
57
|
+
label: "Select Fields",
|
|
58
|
+
description:
|
|
59
|
+
"Select the specific metadata fields to return in the response. If none are selected, all fields will be returned.",
|
|
60
|
+
optional: true,
|
|
61
|
+
},
|
|
62
|
+
orderBy: {
|
|
63
|
+
type: "string",
|
|
64
|
+
label: "Order By",
|
|
65
|
+
description:
|
|
66
|
+
"Specify the sort order of the results using OData syntax. Example: `fields/Created desc` or `fields/Title asc`.",
|
|
67
|
+
optional: true,
|
|
68
|
+
},
|
|
69
|
+
expandFields: {
|
|
70
|
+
type: "boolean",
|
|
71
|
+
label: "Expand Fields?",
|
|
72
|
+
description:
|
|
73
|
+
"Set to `true` to retrieve custom metadata and column values. Defaults to `true`.",
|
|
74
|
+
optional: true,
|
|
75
|
+
default: true,
|
|
76
|
+
},
|
|
77
|
+
maxResults: {
|
|
78
|
+
type: "integer",
|
|
79
|
+
label: "Max Results",
|
|
80
|
+
description: "The maximum number of results to return. Defaults to 100.",
|
|
81
|
+
optional: true,
|
|
82
|
+
default: 100,
|
|
83
|
+
min: 1,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
async run({ $ }) {
|
|
87
|
+
const {
|
|
88
|
+
siteId,
|
|
89
|
+
listId,
|
|
90
|
+
filter,
|
|
91
|
+
select,
|
|
92
|
+
orderBy,
|
|
93
|
+
expandFields,
|
|
94
|
+
maxResults,
|
|
95
|
+
} = this;
|
|
96
|
+
|
|
97
|
+
const expand = expandFields
|
|
98
|
+
? "fields"
|
|
99
|
+
: undefined;
|
|
100
|
+
|
|
101
|
+
// Construct select parameter
|
|
102
|
+
// If fields are selected, we need to select them within the expanded fields
|
|
103
|
+
// Graph API supports $expand=fields($select=Title,Color)
|
|
104
|
+
let expandParam = expand;
|
|
105
|
+
if (expandFields && select?.length > 0) {
|
|
106
|
+
expandParam = `fields($select=${select.join(",")})`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const params = utils.cleanObject({
|
|
110
|
+
$filter: filter,
|
|
111
|
+
$expand: expandParam,
|
|
112
|
+
$orderby: orderBy,
|
|
113
|
+
$top: Math.max(1, maxResults),
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const items = [];
|
|
117
|
+
const iterator = this.sharepoint.paginate({
|
|
118
|
+
fn: this.sharepoint.listItems,
|
|
119
|
+
args: {
|
|
120
|
+
$,
|
|
121
|
+
siteId,
|
|
122
|
+
listId,
|
|
123
|
+
params,
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
for await (const item of iterator) {
|
|
128
|
+
items.push({
|
|
129
|
+
id: item.id,
|
|
130
|
+
name:
|
|
131
|
+
item.fields?.FileLeafRef ||
|
|
132
|
+
item.fields?.Title ||
|
|
133
|
+
item.name ||
|
|
134
|
+
item.displayName,
|
|
135
|
+
fileType: item.fields?.File_x0020_Type,
|
|
136
|
+
createdDateTime: item.createdDateTime,
|
|
137
|
+
lastModifiedDateTime: item.lastModifiedDateTime,
|
|
138
|
+
webUrl: item.webUrl,
|
|
139
|
+
fields: item.fields,
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
if (items.length >= maxResults) {
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
$.export(
|
|
148
|
+
"$summary",
|
|
149
|
+
`Found ${items.length} matching item${items.length === 1
|
|
150
|
+
? ""
|
|
151
|
+
: "s"}`,
|
|
152
|
+
);
|
|
153
|
+
return items;
|
|
154
|
+
},
|
|
155
|
+
};
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-search-files",
|
|
5
5
|
name: "Search Files",
|
|
6
6
|
description: "Search for files in Microsoft Sharepoint. [See the documentation](https://learn.microsoft.com/en-us/graph/api/search-query?view=graph-rest-1.0&tabs=http)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.2",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-search-sites",
|
|
5
5
|
name: "Search Sites",
|
|
6
6
|
description: "Search for sites in Microsoft Sharepoint. [See the documentation](https://learn.microsoft.com/en-us/graph/api/site-search?view=graph-rest-1.0&tabs=http)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.2",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-select-files",
|
|
5
5
|
name: "Select Files",
|
|
6
6
|
description: "A file picker action that allows browsing and selecting one or more files from SharePoint. Returns the selected files' metadata including pre-authenticated download URLs. [See the documentation](https://learn.microsoft.com/en-us/graph/api/driveitem-get)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "sharepoint-update-item",
|
|
6
6
|
name: "Update Item",
|
|
7
7
|
description: "Updates an existing item in Microsoft Sharepoint. [See the documentation](https://learn.microsoft.com/en-us/graph/api/listitem-update?view=graph-rest-1.0&tabs=http)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.10",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: true,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "sharepoint-upload-file",
|
|
6
6
|
name: "Upload File",
|
|
7
7
|
description: "Upload a file to OneDrive. [See the documentation](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_put_content?view=odsp-graph-online)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.4",
|
|
9
9
|
type: "action",
|
|
10
10
|
annotations: {
|
|
11
11
|
destructiveHint: false,
|
package/package.json
CHANGED
package/sharepoint.app.mjs
CHANGED
|
@@ -74,6 +74,7 @@ export default {
|
|
|
74
74
|
description: "Array of column names",
|
|
75
75
|
async options({
|
|
76
76
|
prevContext, siteId, listId,
|
|
77
|
+
mapper = ({ name }) => name,
|
|
77
78
|
}) {
|
|
78
79
|
if (!siteId || !listId) {
|
|
79
80
|
return [];
|
|
@@ -86,7 +87,7 @@ export default {
|
|
|
86
87
|
args.url = prevContext.nextLink;
|
|
87
88
|
}
|
|
88
89
|
const response = await this.listColumns(args);
|
|
89
|
-
const options = response.value?.map(
|
|
90
|
+
const options = response.value?.map(mapper) || [];
|
|
90
91
|
return {
|
|
91
92
|
options,
|
|
92
93
|
context: {
|
|
@@ -102,7 +103,7 @@ export default {
|
|
|
102
103
|
async options({
|
|
103
104
|
prevContext, siteId, listId,
|
|
104
105
|
}) {
|
|
105
|
-
if (!siteId) {
|
|
106
|
+
if (!siteId || !listId) {
|
|
106
107
|
return [];
|
|
107
108
|
}
|
|
108
109
|
const args = {
|
|
@@ -203,17 +204,24 @@ export default {
|
|
|
203
204
|
async options({
|
|
204
205
|
query, siteId, driveId, excludeFolders = true,
|
|
205
206
|
}) {
|
|
207
|
+
const resolvedSiteId = this.resolveWrappedValue(siteId);
|
|
208
|
+
const resolvedDriveId = this.resolveWrappedValue(driveId);
|
|
209
|
+
|
|
210
|
+
if (!resolvedSiteId || !resolvedDriveId) {
|
|
211
|
+
return [];
|
|
212
|
+
}
|
|
213
|
+
|
|
206
214
|
const response = query
|
|
207
215
|
? await this.searchDriveItems({
|
|
208
|
-
siteId,
|
|
216
|
+
siteId: resolvedSiteId,
|
|
209
217
|
query,
|
|
210
218
|
params: {
|
|
211
219
|
select: "folder,name,id",
|
|
212
220
|
},
|
|
213
221
|
})
|
|
214
222
|
: await this.listDriveItems({
|
|
215
|
-
siteId,
|
|
216
|
-
driveId,
|
|
223
|
+
siteId: resolvedSiteId,
|
|
224
|
+
driveId: resolvedDriveId,
|
|
217
225
|
});
|
|
218
226
|
const values = excludeFolders
|
|
219
227
|
? response.value.filter(({ folder }) => !folder)
|
|
@@ -331,12 +339,15 @@ export default {
|
|
|
331
339
|
resolveWrappedValue(value) {
|
|
332
340
|
return value?.__lv?.value || value;
|
|
333
341
|
},
|
|
342
|
+
_getAccessToken() {
|
|
343
|
+
return this.$auth.oauth_access_token;
|
|
344
|
+
},
|
|
334
345
|
_baseUrl() {
|
|
335
346
|
return "https://graph.microsoft.com/v1.0";
|
|
336
347
|
},
|
|
337
348
|
_headers(headers) {
|
|
338
349
|
return {
|
|
339
|
-
Authorization: `Bearer ${this
|
|
350
|
+
Authorization: `Bearer ${this._getAccessToken()}`,
|
|
340
351
|
...headers,
|
|
341
352
|
};
|
|
342
353
|
},
|
|
@@ -402,6 +413,14 @@ export default {
|
|
|
402
413
|
...args,
|
|
403
414
|
});
|
|
404
415
|
},
|
|
416
|
+
getListItem({
|
|
417
|
+
siteId, listId, itemId, ...args
|
|
418
|
+
}) {
|
|
419
|
+
return this._makeRequest({
|
|
420
|
+
path: `/sites/${siteId}/lists/${listId}/items/${itemId}`,
|
|
421
|
+
...args,
|
|
422
|
+
});
|
|
423
|
+
},
|
|
405
424
|
listSiteDrives({
|
|
406
425
|
siteId, ...args
|
|
407
426
|
}) {
|
|
@@ -414,7 +433,7 @@ export default {
|
|
|
414
433
|
siteId, driveId, ...args
|
|
415
434
|
}) {
|
|
416
435
|
return this._makeRequest({
|
|
417
|
-
path: `/sites/${siteId}/drives/${driveId}/
|
|
436
|
+
path: `/sites/${siteId}/drives/${driveId}/root/children`,
|
|
418
437
|
...args,
|
|
419
438
|
});
|
|
420
439
|
},
|
|
@@ -430,7 +449,7 @@ export default {
|
|
|
430
449
|
siteId, driveId, ...args
|
|
431
450
|
}) {
|
|
432
451
|
return this._makeRequest({
|
|
433
|
-
path: `/sites/${siteId}/drives/${driveId}/
|
|
452
|
+
path: `/sites/${siteId}/drives/${driveId}/root/children`,
|
|
434
453
|
method: "POST",
|
|
435
454
|
...args,
|
|
436
455
|
});
|
|
@@ -478,7 +497,7 @@ export default {
|
|
|
478
497
|
: `/sites/${siteId}/drives/${driveId}/root:/${encodeURI(name)}:/content`,
|
|
479
498
|
method: "PUT",
|
|
480
499
|
headers: {
|
|
481
|
-
"
|
|
500
|
+
"Authorization": `Bearer ${this._getAccessToken()}`,
|
|
482
501
|
},
|
|
483
502
|
...args,
|
|
484
503
|
});
|
|
@@ -499,7 +518,9 @@ export default {
|
|
|
499
518
|
siteId, query, ...args
|
|
500
519
|
}) {
|
|
501
520
|
return this._makeRequest({
|
|
502
|
-
path: `/sites/${siteId}/drive/root/search(q='${
|
|
521
|
+
path: `/sites/${siteId}/drive/root/search(q='${encodeURIComponent(
|
|
522
|
+
query,
|
|
523
|
+
)}')`,
|
|
503
524
|
...args,
|
|
504
525
|
});
|
|
505
526
|
},
|