none
create InfoPath Form in Form Library using the existing template in Office 365 REST/CSOM Not Working

    Question

  •  var clientContext;
            var oWebsite;
            var oList;
            var fileCreateInfo;
            var fileContent;
    
            clientContext = new SP.ClientContext.get_current();
            oWebsite = clientContext.get_web();
            oList = oWebsite.get_lists().getByTitle("Testing");
    
            fileCreateInfo = new SP.FileCreationInformation();
            fileCreateInfo.set_url("template.xml");
            fileCreateInfo.set_content(new SP.Base64EncodedByteArray());
    
     for (var i = 0; i < fileContent.length; i++) {
    
                fileCreateInfo.get_content().append(fileContent.charCodeAt(i));
            }
    
            this.newFile = oList.get_rootFolder().get_files().add(fileCreateInfo);
    
            clientContext.load(this.newFile);
            clientContext.executeQueryAsync(
                Function.createDelegate(this, successHandler),
                Function.createDelegate(this, errorHandler)
            );
    
            function successHandler() {
                console.log("Success");               
            }
    
            function errorHandler() {
                console.log("Request failed: " + arguments[1].get_message());
            }

    I want to create InfoPath Form in Form Library from above code using the existing template in Office 365

    I can't make it working by attaching it to template, Urgent help is appreciated.


    Regards,
    Rupesh Singh
    Blog: www.networkraft.com
    Site: www.ngenioussolutions.com/
    ---------------------------------------------------------------------
    Please don't forget to mark it as answered, if your problem resolved or helpful.

    Thursday, May 19, 2016 10:10 AM