gd-sprest 9.6.7 → 9.6.8

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.
@@ -55,6 +55,12 @@ export interface ISite {
55
55
  */
56
56
  getAppContext(siteUrl: string): IBaseExecution;
57
57
 
58
+ /**
59
+ * Method to return the web of the current user's OneDrive.
60
+ * @param targetInfo - (Optional) The target information.
61
+ */
62
+ getOneDrive(targetInfo?: ITargetInfoProps): SP.IWeb;
63
+
58
64
  /**
59
65
  * Method to get the url of a site, by its id.
60
66
  * @param id - The site id.
package/build/lib/site.js CHANGED
@@ -1,7 +1,20 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.Site = void 0;
4
15
  var utils_1 = require("../utils");
16
+ var contextInfo_1 = require("./contextInfo");
17
+ var graph_1 = require("./graph");
5
18
  /**
6
19
  * Site
7
20
  */
@@ -40,6 +53,21 @@ exports.Site.getAppContext = (function (siteUrl) {
40
53
  method: "POST"
41
54
  });
42
55
  });
56
+ // Method to get the onedive web for the current user
57
+ exports.Site.getOneDrive = function (targetInfo) {
58
+ if (targetInfo === void 0) { targetInfo = {}; }
59
+ // Set the url of the drive
60
+ var host = document.location.host.split('.');
61
+ var url = "https://".concat(host[0], "-my.").concat(host[1], ".").concat(host[2], "/personal/").concat(contextInfo_1.ContextInfo.userPrincipalName.replace(/[@,.]/g, '_'));
62
+ // Return the web for the user's onedrive
63
+ return (0, exports.Site)(url, __assign(__assign({}, targetInfo), {
64
+ requestHeader: {
65
+ Authorization: "Bearer " + graph_1.Graph.Token,
66
+ Accept: "application/json",
67
+ "Content-Type": "application/json"
68
+ }
69
+ }));
70
+ };
43
71
  // Method to get the url by id
44
72
  exports.Site.getUrlById = (function (id) {
45
73
  // Return the base object
package/build/lib/web.js CHANGED
@@ -12,8 +12,8 @@ var __assign = (this && this.__assign) || function () {
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.Web = void 0;
15
- var contextInfo_1 = require("./contextInfo");
16
15
  var utils_1 = require("../utils");
16
+ var contextInfo_1 = require("./contextInfo");
17
17
  var graph_1 = require("./graph");
18
18
  exports.Web = (function (url, targetInfo) {
19
19
  var web = new utils_1.Base(targetInfo);
package/build/rest.js CHANGED
@@ -9,7 +9,7 @@ var sptypes_1 = require("./sptypes");
9
9
  * SharePoint REST Library
10
10
  */
11
11
  exports.$REST = {
12
- __ver: 9.67,
12
+ __ver: 9.68,
13
13
  AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
14
14
  Apps: Lib.Apps,
15
15
  ContextInfo: Lib.ContextInfo,
@@ -4256,6 +4256,12 @@ declare module 'gd-sprest/lib/site' {
4256
4256
  */
4257
4257
  getAppContext(siteUrl: string): IBaseExecution;
4258
4258
 
4259
+ /**
4260
+ * Method to return the web of the current user's OneDrive.
4261
+ * @param targetInfo - (Optional) The target information.
4262
+ */
4263
+ getOneDrive(targetInfo?: ITargetInfoProps): SP.IWeb;
4264
+
4259
4265
  /**
4260
4266
  * Method to get the url of a site, by its id.
4261
4267
  * @param id - The site id.