@mikezimm/npmfunctions
Version:
Functions used in my SPFx webparts
38 lines • 1.37 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEmbedInfo = void 0;
var sp_http_1 = require("@microsoft/sp-http");
/**
*
* Credit due to for the tip:
* https://www.facebook.com/groups/2268502550044442/user/610953312/
*
* Source info:
* https://joshmccarty.com/sharepoint-online-embedservice-api/?fbclid=IwAR1r9JHiWuCRrF1l3w1qJ-Iolhe44QmtC8HbSxN3Kb-v9kHDzui96iRqOBc
*
* API Info:
* https://s-kainet.github.io/sp-rest-explorer/?fbclid=IwAR1r9JHiWuCRrF1l3w1qJ-Iolhe44QmtC8HbSxN3Kb-v9kHDzui96iRqOBc#/entity/SP.Publishing.EmbedService
*
* @param thisContext
* @param webUrl
*/
function getEmbedInfo(thisContext, webUrl) {
var embedData = {};
thisContext.spHttpClient.get(thisContext.pageContext.web.absoluteUrl +
"/_api/SP.Publishing.EmbedService/EmbedData?url=%27".concat(encodeURIComponent(webUrl), "%27&version=1"), sp_http_1.SPHttpClient.configurations.v1)
.then(function (response) {
if (response.ok) {
return response.json();
}
else {
throw new Error(response.statusText);
}
})
.then(function (data) {
embedData = data;
console.log('embedData', embedData);
return embedData;
});
}
exports.getEmbedInfo = getEmbedInfo;
//# sourceMappingURL=EmbedServices.js.map
;