【发布时间】:2014-05-09 22:43:10
【问题描述】:
我正在关注这个会议研讨会http://video.ch9.ms/sessions/spc/2014/SPC261.mp4 他们教你如何创建共享点应用程序
有时我有这个脚本
$(document).ready(function () {
//get context and then username
context = new SP.ClientContext.get_Current();
web = context.get_web();
//get the tasks for the user
getTaskCountForUser();
});
它只会计算任务列表中剩余的任务数。
我在应用程序部分的 aspx 文件中包含下一个脚本
<%--<script type="text/javascript" src="../Scripts/jquery-1.9.1.min.js"></script>--%>
<script type="text/javascript" src="/_layouts/15/MicrosoftAjax.js"></script>
<script src="/_layouts/15/sp.js" type="text/javascript"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="//ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js" type="text/javascript"></script>
<script src="/_layouts/15/sp.runtime.debug.js" type="text/javascript"></script>
<script src="/_layouts/15/sp.debug.js" type="text/javascript"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.9.0/jquery-ui.min.js" type="text/javascript"></script>
<script src="https://ajax.aspnetcdn.com/ajax/knockout/knockout-2.1.0.js" type="text/javascript"></script>
<script src="../Scripts/QuickTask.js" type="text/javascript"></script>
一切似乎都很好。应用程序部分显示在 SharePoint Online 中,我可以将其包含在主页中,但脚本无法正常工作并在行中抛出 Uncaught TypeError: undefined is not a function
context = new SP.ClientContext.get_Current();
我尝试像这样封闭该段:
ExecuteOrDelayUntilScriptLoaded(function () {
//my code above in here
}, "sp.js");
但在这种情况下,第一行会抛出相同的错误。
我错过了什么?我正在使用我的 MSDN 订阅 Vsual Studio 2013 中的 Sharepoint E3 在线帐户,在视频中,这个人可以无缝地完成它。
谢谢
【问题讨论】:
标签: javascript sharepoint visual-studio-2013 sharepoint-2013