I am creating a text file and saving data in it but when I try to update this file than I am getting following error
Unexpected response data from server.
My Code is
function SetupTenantInfo() {
var siteURL = window.location.href.split("/Pages/Config.aspx");
var clientContext = new SP.ClientContext(siteURL[0]);
//parentWeb = parentCtx.get_web();
scriptList = clientContext.get_web().get_lists().getByTitle("Document");
fileCreateInfo = new SP.FileCreationInformation();
fileCreateInfo.set_url("Info.txt");
fileCreateInfo.set_overwrite(true);
fileCreateInfo.set_content(new SP.Base64EncodedByteArray());
// Read the binary contents of the base 64 data URL into a Uint8Array
// Append the contents of this array to the SP.FileCreationInformation
var arr = str2ab(tenantInfo);//convertDataURIToBinary(result);
for (var i = 0; i < arr.length; ++i) {
fileCreateInfo.get_content().append(arr[i]);
}
// Upload the file to the root folder of the document library
this.newFile = scriptList.get_rootFolder().get_files().add(fileCreateInfo);
clientContext.load(this.newFile);
clientContext.executeQueryAsync(onSuccess, onFailure);
}
function onSuccess() {
alert("success")
}
function onFailure() {
alert(arguments[1].get_message());
}
Can any body please help me out to fix this?
Aucun commentaire:
Enregistrer un commentaire