如何从sharepoint托管应用程序安装应用程序到子站点+ JavaScript

时间:2014-01-22 13:35:50

标签: javascript sharepoint-2013 sharepoint-clientobject sharepoint-apps sharepoint-online

我需要使用javascript以编程方式将我的sharepoint应用程序从根站点安装到其他子站点。但我的安装功能不起作用:

 function InstallApp()
  { 
    var context = new SP.ClientContext(appweburl);
var factory = new SP.ProxyWebRequestExecutorFactory(appweburl);
context.set_webRequestExecutorFactory(factory);

var installContext = new SP.AppContextSite(context, hostweburl + '/subSite');

var installWeb = installContext.get_web();

var appFile = installWeb.getFileByServerRelativeUrl('/SiteAssets/myAppFile.app');

installWeb.loadAndInstallApp(appFile);
installWeb.update();

installContext.get_context().load(installWeb);
installContext.get_context().executeQueryAsync(onInstallSuccess, OnFailure); 
  }

0 个答案:

没有答案