首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在people picker Sharepoint提供的托管应用程序中修复SP.Executor.js中的无效字段或参数url

如何在people picker Sharepoint提供的托管应用程序中修复SP.Executor.js中的无效字段或参数url
EN

Stack Overflow用户
提问于 2016-06-08 12:14:13
回答 2查看 1.1K关注 0票数 0

代码语言:javascript
复制
@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <!-- IE9 or superior -->
    <meta http-equiv="X-UA-Compatible" content="IE=9">
    <title>People Picker HTML Markup</title>

    <!-- Widgets Specific CSS File -->
    <link rel="stylesheet"
          type="text/css"
          href="../Scripts/Office.Controls.css" />

    <!-- Ajax, jQuery, and utils -->
    <script src="~/Scripts/MicrosoftAjax.js"></script>
    <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.2.min.js"></script>
    <script type="text/javascript">
        // Function to retrieve a query string value.
        // For production purposes you may want to use
        //  a library to handle the query string.
        function getQueryStringParameter(paramToRetrieve) {
            var params =
                document.URL.split("?")[1].split("&");
            var strParams = "";
            for (var i = 0; i < params.length; i = i + 1) {
                var singleParam = params[i].split("=");
                if (singleParam[0] == paramToRetrieve)
                    return singleParam[1];
            }
        }
    </script>

    <!-- Cross-Domain Library and Office controls runtime -->
    <script type="text/javascript">
        //Register namespace and variables used through the sample
        Type.registerNamespace("Office.Samples.PeoplePickerBasic");
        //Retrieve context tokens from the querystring
        Office.Samples.PeoplePickerBasic.appWebUrl =
            decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
        Office.Samples.PeoplePickerBasic.hostWebUrl =
            decodeURIComponent(getQueryStringParameter("SPHostUrl"));

        //Pattern to dynamically load JSOM and and the cross-domain library
        var scriptbase =
            Office.Samples.PeoplePickerBasic.hostWebUrl + "/_layouts/15/";

        //Get the cross-domain library
        $.getScript(scriptbase + "SP.RequestExecutor.js",
            //Get the Office controls runtime and
            //  continue to the createControl function
            function () {
                $.getScript("../Scripts/Office.Controls.js", createControl)
            }
        );
    </script>

    <!--People Picker -->
    <script src="../Scripts/Office.Controls.PeoplePicker.js"
            type="text/javascript">
    </script>
</head>
<body>
    Basic People Picker sample (HTML markup declaration):
    <div id="PeoplePickerDiv"
         data-office-control="Office.Controls.PeoplePicker">
    </div>

    <script type="text/javascript">
    function createControl() {
        //Initialize Controls Runtime
        Office.Controls.Runtime.initialize({
            sharePointHostUrl: Office.Samples.PeoplePickerBasic.hostWebUrl,
            appWebUrl: Office.Samples.PeoplePickerBasic.appWebUrl
        });

        //Render the widget, this must be executed after the
        //placeholder DOM is loaded
        Office.Controls.Runtime.renderAll();
    }
    </script>
</body>
</html>

我想在SharePoint提供商托管的应用程序中创建一个人员选择器功能。我尝试了这个教程:https://msdn.microsoft.com/en-us/library/office/dn636915.aspx

我被这个错误卡住了。

Invalid field or parameter url in SP.Executor.js

EN

回答 2

Stack Overflow用户

发布于 2016-06-08 22:58:49

检查您的SP.RequestExecutor.js是否加载成功,如果没有,您可以给出SP.RequestExecutor.js的路径并直接加载,也可以使用下面的代码获取use

代码语言:javascript
复制
var scriptbase = hostweburl + "/_layouts/15/";

$.getScript(scriptbase + "SP.Runtime.js",
    function () {
        $.getScript(scriptbase + "SP.js",
            function () { $.getScript(scriptbase + "SP.RequestExecutor.js", createControl); }
        );
    }
);

希望这能解决你的问题。

票数 0
EN

Stack Overflow用户

发布于 2016-06-09 10:36:30

这解决了我的错误。感谢@Rahul的提示

代码语言:javascript
复制
var scriptbase = hostWebUrl + "/_layouts/15/";

            $.getScript(scriptbase + "SP.Runtime.js",
                function () {
                    $.getScript(scriptbase + "SP.js",
                        function () { $.getScript(scriptbase + "SP.RequestExecutor.js",
                           $.getScript("../Scripts/Office.Controls.js", createControl));
                        }
                    );
                }
            );

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37693118

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档