gd-sprest 8.0.9 → 8.1.0

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.
@@ -54,6 +54,25 @@ exports.SPConfig = function (cfg, webUrl) {
54
54
  resolve();
55
55
  return;
56
56
  }
57
+ // Method to add an existing content type
58
+ var addParentCT = function (cfg, parentInfo) {
59
+ // Return a promise
60
+ return new Promise(function (resolve, reject) {
61
+ // Add the content type
62
+ var contentTypes = list ? lib_1.Web(webUrl).Lists(list.Title).ContentTypes() : lib_1.Web(webUrl).ContentTypes();
63
+ contentTypes.add({
64
+ Description: cfg.Description,
65
+ Group: cfg.Group,
66
+ Name: cfg.Name,
67
+ Id: {
68
+ __metadata: {
69
+ type: "SP.ContentTypeId"
70
+ },
71
+ StringValue: parentInfo.Id + lib_1.ContextInfo.generateGUID().replace(/-/g, "")
72
+ }
73
+ }).execute(resolve, reject);
74
+ });
75
+ };
57
76
  // Method to get the parent content type
58
77
  var getParentCT = function (ctName, url) {
59
78
  // Return a promise
@@ -108,11 +127,7 @@ exports.SPConfig = function (cfg, webUrl) {
108
127
  // Success
109
128
  function (parentInfo) {
110
129
  // Add the content type
111
- _1.createContentType({
112
- Description: cfg.Description,
113
- Group: cfg.Group,
114
- Name: cfg.Name
115
- }, parentInfo, webUrl, list ? list.Title : null).then(
130
+ addParentCT(cfg, parentInfo).then(
116
131
  // Success
117
132
  function (ct) {
118
133
  // Log
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: 8.09,
12
+ __ver: 8.10,
13
13
  AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
14
14
  Apps: Lib.Apps,
15
15
  ContextInfo: Lib.ContextInfo,