且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

试图让人们在Sharepoint 2013 APP中工作

更新时间:2023-11-30 17:41:40

您好,


您是否尝试修改脚本  loading  order?此外,你可能需要使用init.js文件(这只是一个想法,但你经常需要它)。


希望这会有所帮助! 


I am trying to get a peoplepicker field working in my sharepoint 2013 app. I am following the instuctions from here:

http://msdn.microsoft.com/en-us/library/jj713593.aspx

The picker and its functionality are defined in the clientforms.js, clientpeoplepicker.js, and autofill.js script files, which are located in the %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\TEMPLATE\LAYOUTS folder on the server.

from the following webpage they have suggested I use the following imports:

  <SharePoint:ScriptLink name="clienttemplates.js" runat="server" LoadAfterUI="true" Localizable="false" />
    <SharePoint:ScriptLink name="clientforms.js" runat="server" LoadAfterUI="true" Localizable="false" />
    <SharePoint:ScriptLink name="clientpeoplepicker.js" runat="server" LoadAfterUI="true" Localizable="false" />
    <SharePoint:ScriptLink name="autofill.js" runat="server" LoadAfterUI="true" Localizable="false" />
    <SharePoint:ScriptLink name="sp.js" runat="server" LoadAfterUI="true" Localizable="false" />
    <SharePoint:ScriptLink name="sp.runtime.js" runat="server" LoadAfterUI="true" Localizable="false" />
    <SharePoint:ScriptLink name="sp.core.js" runat="server" LoadAfterUI="true" Localizable="false" />

As my app is just in javascript my imports look like this:

<script type="text/javascript" src="../Scripts/jquery%20plugins/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>
<script type="text/javascript" src="../Scripts/sharepoint%20scripts/clienttemplates.debug.js"></script>
<script type="text/javascript" src="../Scripts/sharepoint%20scripts/clientforms.debug.js"></script>       
<script type="text/javascript" src="../Scripts/sharepoint%20scripts/clientpeoplepicker.debug.js"></script>
<script type="text/javascript" src="../Scripts/sharepoint%20scripts/autofill.debug.js"></script><script type="text/javascript" src="/_layouts/15/sp.core.js"></script>

(I copied the required scripts to /scripts/sharepoint scripts/)

when my page loads in clienttemplate.debug.js I get the following error:

0x800a1391 - JavaScript runtime error: 'Strings' is undefined

I'm not sure how where to go from here.

Hello,

Did you try to modify the scripts loading order? Also you might need to use the init.js file (that's really just a thought but you often need it).

Hope this helps!