locked
create publishing page using JavaScript RRS feed

  • Question

  • 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'); }

    Monday, June 30, 2014 9:12 AM

All replies