Quantcast
Channel: SharePoint Legacy Versions - Using SharePoint Designer, InfoPath and Other Customizations Forum
Viewing all articles
Browse latest Browse all 2319

create publishing page using JavaScript

$
0
0

hi friends 

i am using below code to create publishing page it is working fine

but my problem is am unable to define name of the page it is creating with default name

i try to use "pageInfo.set_name()" but it is not working

is there any solution. 

var contextPage; var webPage; var pubweb; var pageInfo; var newPage function pageCreate(){ SP.SOD.executeFunc('SP.js','SP.ClientContext',loadFun); } function loadFun(){ contextPage = new SP.ClientContext.get_current(); webPage= contextPage.get_web(); pubweb= SP.Publishing.PublishingWeb.getPublishingWeb(contextPage,webPage); contextPage.load(webPage); contextPage.load(pubweb); contextPage.executeQueryAsync(onQuerySuccedPage, onQueryFailedPage); } function onQuerySuccedPage(){ pageInfo = new SP.Publishing.PublishingPageInformation(); newPage = pubweb.addPublishingPage(pageInfo); //pageInfo.set_name('test123.aspx') "it is not working" contextPage.load(newPage); contextPage.executeQueryAsync(onPageCreate, onQueryFailedPage); } function onPageCreate(){ alert('page created'); } function onQueryFailedPage(){ alert('failed'); }


Viewing all articles
Browse latest Browse all 2319

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>