gd-sprest 9.8.3 → 9.8.5
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/build/helper/methods/createDocSet.js +54 -24
- package/build/mapper/v2.js +3 -0
- package/build/rest.js +1 -1
- package/dist/gd-sprest.js +1 -1
- package/dist/gd-sprest.min.js +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Web } from "../../lib";
|
|
2
|
-
import { request } from "./request";
|
|
1
|
+
import { ContextInfo, Web } from "../../lib";
|
|
3
2
|
/**
|
|
4
3
|
* Creates a document set item.
|
|
5
4
|
* @param name - The name of the document set folder to create.
|
|
@@ -21,30 +20,61 @@ export const createDocSet = (name, listName, webUrl) => {
|
|
|
21
20
|
break;
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
23
|
+
// Method to get the web information
|
|
24
|
+
(() => {
|
|
25
|
+
// Return a promise
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
if (webUrl) {
|
|
28
|
+
// Get the web context information
|
|
29
|
+
ContextInfo.getWeb(webUrl).execute(webInfo => {
|
|
30
|
+
resolve(webInfo.GetContextWebInformation.FormDigestValue);
|
|
31
|
+
}, reject);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
// Resolve the promise
|
|
35
|
+
resolve(null);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
})().then(value => {
|
|
39
|
+
// Create the document set item
|
|
40
|
+
Web(webUrl, { requestDigest: value }).Lists(listName).addValidateUpdateItem({
|
|
41
|
+
FolderUrl: list.RootFolder.ServerRelativeUrl,
|
|
42
|
+
UnderlyingObjectType: 1
|
|
43
|
+
}, [
|
|
44
|
+
{
|
|
45
|
+
FieldName: "HTML_x0020_File_x0020_Type",
|
|
46
|
+
FieldValue: "SharePoint.DocumentSet"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
FieldName: "ContentTypeId",
|
|
50
|
+
FieldValue: ctId
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
FieldName: "FileLeafRef",
|
|
54
|
+
FieldValue: name
|
|
55
|
+
}
|
|
56
|
+
], false, "", true).execute(resp => {
|
|
57
|
+
// Parse the results
|
|
58
|
+
let itemId = 0;
|
|
59
|
+
for (let i = 0; i < resp.results.length; i++) {
|
|
60
|
+
// See if this is the item id
|
|
61
|
+
if (resp.results[i].FieldName == "Id") {
|
|
62
|
+
itemId = parseInt(resp.results[i].FieldValue);
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
41
66
|
// Get the document set item and resolve the promise
|
|
42
|
-
Web(webUrl).Lists(listName).Items(
|
|
43
|
-
}
|
|
44
|
-
|
|
67
|
+
Web(webUrl).Lists(listName).Items(itemId).execute(resolve);
|
|
68
|
+
}, (request) => {
|
|
69
|
+
let errorMessage = request.response;
|
|
70
|
+
// Try to determine the error message
|
|
71
|
+
try {
|
|
72
|
+
errorMessage = (JSON.parse(errorMessage)).error.message.value;
|
|
73
|
+
}
|
|
74
|
+
catch (_a) { }
|
|
45
75
|
// Reject the promise
|
|
46
|
-
reject(
|
|
47
|
-
}
|
|
76
|
+
reject(errorMessage);
|
|
77
|
+
});
|
|
48
78
|
});
|
|
49
79
|
}, reject);
|
|
50
80
|
});
|
package/build/mapper/v2.js
CHANGED
|
@@ -3550,6 +3550,9 @@ export const MapperV2 = {
|
|
|
3550
3550
|
name: "",
|
|
3551
3551
|
requestType: RequestType.GraphDelete
|
|
3552
3552
|
},
|
|
3553
|
+
content: {
|
|
3554
|
+
requestType: RequestType.GetBuffer
|
|
3555
|
+
},
|
|
3553
3556
|
query: { argNames: ["oData"], requestType: RequestType.OData },
|
|
3554
3557
|
workbook: {
|
|
3555
3558
|
returnType: "workbook"
|
package/build/rest.js
CHANGED