我正在寻找SharePoint 托管应用程序解决方案,它将将品牌文件(JS/CSS/图像) 配置到SharePoint Online/Office 365 环境中。
我得到了一篇非常好的文章来实现这一点,并尝试实现如下链接所示:http ://www.sharepointnutsandbolts.com/2013/05/sp2013-host-web-apps-provisioning-files.html
该解决方案对我不起作用,并且在执行应用程序时,出现以下错误:
Failed to provision file into host web. Error: Unexpected response data from server.
这是给我错误的代码:
// utility method for uploading files to host web..
uploadFileToHostWebViaCSOM = function (serverRelativeUrl, filename, contents) {
var createInfo = new SP.FileCreationInformation();
createInfo.set_content(new SP.Base64EncodedByteArray());
for (var i = 0; i < contents.length; i++) {
createInfo.get_content().append(contents.charCodeAt(i));
}
createInfo.set_overwrite(true);
createInfo.set_url(filename);
var files = hostWebContext.get_web().getFolderByServerRelativeUrl(serverRelativeUrl).get_files();
hostWebContext.load(files);
files.add(createInfo);
hostWebContext.executeQueryAsync(onProvisionFileSuccess, onProvisionFileFail);
}
请建议我,这段代码有什么问题?或者建议我另一种方式/参考,在其中我可以创建一个 SharePoint 托管的应用程序来配置品牌文件。
提前致谢!