I am developing a SharePoint-Hosted add-in which bascially provisions a custom page layout to the master page gallery of an publishing site collection. After this is done I want to make this layout as default page layout of my wiki pages. Is there a way to do this with using the REST API or CSOM/JSOM?
1 Answer
Not sure about REST but it can be achieved through CSOM
// The page layout is defined by its filename
var filename = "NewsArticlePage.aspx";
setDefaultPageLayout(filename, onSuccess, onFailure);
// The page layouts are defined by an array of filenames
var filenames = ["NewsArticlePage.aspx"];
setAvailablePageLayouts(filenames, onSuccess, onFailure);
// The web templates are defined by their long name,
//the guid is that of the feature which deploys the web template
var webTemplates = ["{BDACFFF5-05DF-4446-9907-B4C39F15F1D7}#WT_VanitySite"];
setAvailableWebTemplates(webTemplates, onSuccess, onFailure);
-
i found this code at this website as well paulryan.com.au/2014/setting-default-page-layout-via-csom but not sure how to use the method "setDefaultPageLayout". Commented Sep 21, 2016 at 13:46
-
See this sharepoint.stackexchange.com/questions/92910/… Commented Sep 21, 2016 at 15:52
-
this link is unfortunately not what i'm looking for. I look for something like this sharepoint.stackexchange.com/questions/25796/… Commented Sep 21, 2016 at 23:51