Duplicate or Copy publishing pages (Pages document library)
-
13-02-2021 - |
Question
I want to duplicate an existing WebPart page from the Pages document library (Publishing feature enabled). I have found a no-code Sandboxed solution (NCSS) which can enble this functionality in SharePoint 2013 (Link to the article).
But I don't wan't to deploy any wsp into solution gallery as my organization won't approve it. Looking for an alternative way through client side code JSOM/Rest.
Solution
I have taken a look into the Mavention Duplicate Page (no-code Sandboxed WSP) link.
Found out that there is only a js file inside. Tried putting the content of the js file into a script editor webpart in my Pages document library and it's working.
Actually there is no need to deploy the wsp into solution gallery.
eval(function(p, a, c, k, e, d) {
debugger;
e = function(c) {
return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36))
};
if (!''.replace(/^/, String)) {
while (c--) {
d[e(c)] = k[c] || e(c)
}
k = [function(e) {
return d[e]
}];
e = function() {
return '\\w+'
};
c = 1
};
while (c--) {
if (k[c]) {
p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c])
}
}
return p
}('(2(){I(L(h)===\'D\'||h===16){n}h.e(2(){0 v=2(){0 5={};5.U=\'w\';5.V=Q;5.E={};5.E.P=2(1){n A(1)};I(L(G)!==\'D\'){G.19.12(5)}};0 A=2(1){0 c=13(1);11(1,2(){0 6=p 10(c+\'-r\');q(1,6);6.Y()});0 7=[];7.e(\'<s Z=\'+14(c+\'-15\')+\' 1a="t-u-r t-u-X">\');7.e(17(1,1.8,1.1b));7.e(\'</s>\');n w.W(c,7.T(\'\'))};0 q=2(1,6){R(1,6);0 S=1.8;6.18(p 1w({1E:\'o\',1F:2(1G,1D){0 l=3.4.i.1C(\'1y f...\',1z);0 9=1.8.x.1A(\'.y\',p 1B().1H(\'1I\')+\'.y\');0 j=3.1Q.1c();0 z=j.1O();0 d=z.1P(1.8.x);d.1N();d.1J(9);d.1K();j.1L(F.O(H,2(B,m){3.4.i.C(l);0 b=3.4.g.J(\'o f:\',\'1M 1x 1j 1k: <a 1l="\'+9+\'">\'+9+"</a>",k);3.4.g.K(b,\'1i\');0 M={\'1h\':1,\'1d\':k};1e(M,3.4.1f.1g)}),F.O(H,2(B,m){3.4.i.C(l);0 b=3.4.g.J(\'o f:\',\'1m 1n 1t 1u 1v 1s 1r 1o f: <N>\'+m.1p()+\'</N>\',k);3.4.g.K(b,\'1q\')}))}}))};v()})})();', 62, 115, 'var|renderCtx|function|SP|UI|templateOverride|calloutActionMenu|ecbMarkup|CurrentItem|path||sid|calloutID|file|push|page|Status|_spBodyOnLoadFunctions|Notify|context|true|nid|eventArgs|return|Duplicate|new|calloutOnPostRenderCustomTemplate|actions|span|js|callout|registerDuplicatePageAction|Callout|FileRef|aspx|web|calloutRenderCustomFooterTemplate|sender|removeNotification|undefined|Templates|Function|SPClientTemplates|this|if|addStatus|setStatusPriColor|typeof|evtAjax|em|createDelegate|Footer|850|CalloutOnPostRenderTemplate|listItem|join|BaseViewID|ListTemplateType|GenerateDefaultFooter|ecbActionDownArrow|render|id|CalloutActionMenu|AddPostRenderCallback|RegisterTemplateOverrides|GetCalloutElementIDFromRenderCtx|StAttrQuote|ecbMenu|null|RenderECBinline|addAction|TemplateManager|class|CurrentFieldSchema|get_current|csrAjaxRefresh|AJAXRefreshView|DialogResult|OK|currentCtx|green|duplicated|as|href|The|following|the|get_message|red|duplicating|while|error|has|occured|CalloutAction|successfully|Copying|false|replace|Date|addNotification|action|text|onClickCallback|event|format|yyyyMMddHHmmss|copyTo|undoCheckOut|executeQueryAsync|Page|checkOut|get_web|getFileByServerRelativeUrl|ClientContext'.split('|'), 0, {}))
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange