Sharepoint托管应用程序提供“没有为应用程序部署配置可信URL”错误 [英] Sharepoint Hosted App Gives "There is no trusted URLs configured for the app deployment" error
问题描述
我正在尝试将一个sharepoint托管的应用程序部署到SharePoint Online上,该应用程序使用跨域库从主机网络中获取数据。 其中没有提供者托管的内容,所以我是完全混淆了为什么我收到此错误。
还有其他人看过吗?
function getData(){
//获取URI解码的URL。
hostweburl =
decodeURIComponent(
getQueryStringParameter(" SPHostUrl")
);
appweburl =
decodeURIComponent(
getQueryStringParameter(" SPAppWebUrl")
);
//资源位于以下格式的URL中:
// web_url / _layouts / 15 / resource
var scriptbase = hostweburl +" / _ layouts / 15 /" ;;
//加载js文件并继续到successHandler
$ .getScript(scriptbase +" SP.RequestExecutor.js",execCrossDomainRequest);
}
//准备和发出获取
的请求的函数// SharePoint数据
函数execCrossDomainRequest(){
//执行者: RequestExecutor对象
//使用应用程序Web URL初始化RequestExecutor。
var executor = new SP.RequestExecutor(appweburl);
//针对应用网络发出呼叫。
//要使用REST获取标题,我们可以点击端点:$ b $ b // appweburl / _api / web / lists / getbytitle('listname')/ items
//响应格式化JSON格式的数据。
//函数successHandler和errorHandler分别参加
// sucess和error事件。
executor.executeAsync(
{
url:
appweburl +
" / _ api / Data / $ metadata",
method:" GET" ,
成功:successHandler,
错误:errorHandler
}
);
}
嗨迈克尔,
你试过这个解决方案吗?
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/ce944e8a-7cd4-4396-bc39-b76bae8504a7/sharepoint-2013-rest-to-list-in- app-returns-the-error-there-is-no-trusted-urls-configured-for-forum = appsforsharepoint
I am trying to deploy a sharepoint hosted app onto SharePoint Online that uses the cross-domain library to get data out of the host web. There is nothing in it that is provider hosted so I am completely confused as to why I am getting this error. Has anyone else seen this?
function getData() { //Get the URI decoded URLs. hostweburl = decodeURIComponent( getQueryStringParameter("SPHostUrl") ); appweburl = decodeURIComponent( getQueryStringParameter("SPAppWebUrl") ); // resources are in URLs in the form: // web_url/_layouts/15/resource var scriptbase = hostweburl + "/_layouts/15/"; // Load the js files and continue to the successHandler $.getScript(scriptbase + "SP.RequestExecutor.js", execCrossDomainRequest); } // Function to prepare and issue the request to get // SharePoint data function execCrossDomainRequest() { // executor: The RequestExecutor object // Initialize the RequestExecutor with the app web URL. var executor = new SP.RequestExecutor(appweburl); // Issue the call against the app web. // To get the title using REST we can hit the endpoint: // appweburl/_api/web/lists/getbytitle('listname')/items // The response formats the data in the JSON format. // The functions successHandler and errorHandler attend the // sucess and error events respectively. executor.executeAsync( { url: appweburl + "/_api/Data/$metadata", method: "GET", success: successHandler, error: errorHandler } ); }
Hi Michael,
Have you tried this solution?
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/ce944e8a-7cd4-4396-bc39-b76bae8504a7/sharepoint-2013-rest-to-list-in-app-returns-the-error-there-is-no-trusted-urls-configured-for-the?forum=appsforsharepoint
这篇关于Sharepoint托管应用程序提供“没有为应用程序部署配置可信URL”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!