设为首页 收藏本站
查看: 554|回复: 0

[经验分享] Sharepoint学习笔记—习题系列--70-573习题解析

[复制链接]

尚未签到

发表于 2015-9-26 10:20:09 | 显示全部楼层 |阅读模式
  Question 11
You have a Web page named ShowMessage.aspx.
You create a new Web page.
You need to display the content from ShowMessage.aspx in an IFRAME on the new Web page. You must achieve this goal by using the minimum amount of effort.
  What should you do?
A. Add a FormView Web Part that displays ShowMessage.aspx.
B. Use Response.Write to write text to the browser.
C. Use SP.UI.ModalDialog.showModalDialog() to display a dialog.
D. Use Response.Redirect to send users to the ShowMessage.aspx page.
  解析:
本题要求你在一个页面中用Iframe方式显示另一个页面的内容,并且要求工作量最少。
选项A. 使用FormView Web Part,因为此类Webpart主要是用于和数据库数据打交道,用于显示,更新数据库数据的,所以不适合。
选项B. Response.Write方法用于向当前的HTTP输出写入特定的字符串。如下格式:
<H3 align=center>I just want to say <% Response.Write "Hello World.</H3><BR>" %>  
Your name is: <% Response.Write Request.QueryString("name") %> <BR>
它并不能接受另一个URL的页面地址为参数并显示那个页面,所以此选项也并不适合。
选项D. Response.Redirect,使用此方法可以显示指定的URL页面内容,示例如下:
Response.RedirectLocation = "Put The Target Page URL";
Response.StatusCode = 301;
但这种显示却并不是基于IFRAME的,因此也不适合本题。
此外,微软推荐使用的是SPUtility.Redirect 在Sharepoint中代替Response.Redirect方法。因为它提供了更多的选择参数。
选项C. SP.UI.ModalDialog.showModalDialog() 此方法会根据你提供的相关参数(包括其它页面的URL)显示一个模态窗口,如下某个示例:



<script language="javascript" type="text/javascript">
function OpenDialogUsing_showModalDialog() {
var dialogOptions = SP.UI.$create_DialogOptions();
dialogOptions.url = '/sites/cs/md/Pages/PageinDialog.aspx';
dialogOptions.width = 650;
dialogOptions.height = 300;
SP.UI.ModalDialog.showModalDialog(dialogOptions);
return false;
}
</script>
<a href="#" onclick="javascript:OpenDialogUsing_showModalDialog(); return false;" id="htmlAnchor">showModalDialog</a>
  
  所以,选项C是本题的答案。
  
参考
http://msdn.microsoft.com/zh-cn/library/ff410058(v=office.14).aspx
https://www.nothingbutsharepoint.com/sites/devwiki/SP2007Dev/Pages/How%20to%20use%20SPUtility.Redirect.aspx
http://www.chaholl.com/archive/2010/11/17/using-the-dialog-framework-in-sharepoint-2010.aspx
  
Question12
You create a modal dialog that displays a list of items.
You need to capture the items selected by a user.
Which code segment should you use?
A. SPItem item = SPContext.Current.Item;
B. var items = SP.ListOperation.Current.Item();
C. var items = SP.ListOperation.Selection.getSelectedItems();
D. var item = SPContext.Current.Item["Selected"];
  解析:
本题的实质就是考你在Sharepoint中如何返回List被选中的Items。
Sharepoint提供了SP.ListOperation.Selection.getSelectedItems()方法来返回List被选中的Items。此方法的返回值是一组键/值对,其中键(Key)是基于0开始计算的索引,值(Value)是一个包含两个属性的对象,两个属性就是 id和 fsObjType, 其中 id就是List Item的ID ,fsObjType 就是此Item的类型,0 = 是list item 或 document, 1= 是文件夹,所以本题目正确选项应该是C
  选项A. SPContext.Current.Item, 返回是当前List的当前Item,(要根据给定的List ID与Item ID确定),如果在上下文丢失了ID,则会出现报错,这也是为什么网上有人反应通过使用SPContext.Current.List 或 SPContext.Current.Item 找不到当前List或当前List的Item的原因,但不管怎样,它返回的都不可能返回你当前选择的若干个List Items.
  选项B. SP.ListOperation命名空间下就只有Selection类成员,找不到Current类,所以选项B是根本不存在的。
  选项D. SPContext.Current.Item["Selected"],即使能返回值,也只是返回指定List的指定Item中的某个名为”Selected”的Column的值,而并不是被选中的Item的对象集。
所以本题目正确选项应该是C
  参考
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spcontext.item.aspx
http://msdn.microsoft.com/en-us/library/ff409526.aspx
  
Question 13
You need to add a modal dialog box to a SharePoint application.
What should you use?
A. the Core.js JavaScript
B. the Microsoft.SharePoint assembly
C. the Microsoft.SharePoint.Client assembly
D. the SP.js JavaScript
  解析:
本题考的是如何在Sharepoint中引入showModalDialog功能,ModalDialog属于Sharepoint的客户端ECMAScript对象模型,当你在Sharepoint网站的Webpart页面或者application页面(aspx page)上使用ECMAScript对象模型时,你只需要引用SP.js就可以了。
Sharepoint提供了两个版本的Sp.js (即:Sp.js与Sp.debug.js)。它们通过Sharepoint网站的MasterPage里的scriptmanager来加载。默认情况下Scriptmanager的ScriptMode设置为auto,即自动加载Sp.js。如果你想要加载Debug版本,你需要修改web.config中的<system.web> 节下的<deployment retail="false" /> 。
  当然,当你部署到生产机时,你必须加载Sp.js而不是Sp.debug.js。
选项 A. Core.js,  Sharepoint2010的运行在很大程度上依赖于Javascript,而Core.js则包含了许多Sharepoint的运行任务,尤其是上下文菜单。如下面一些功能就是依赖于Core.js中定义的javascript功能:
GetFirstChildElement(e)
GetLastChildElement(e)
GetCBSelectedValues(frm)
createNewDocumentWithProgID(strTemplate, strSaveLocation, strProgID, bXMLForm)
选项B. Microsoft.SharePoint assembly 提供的是关于top-level site 和其下面的subsite或lists的相关类型与成员。是Sharepoint服务器端的最重要组件之一。没有它,Sharepoint平台就完全不能运行了。
选项C. the Microsoft.SharePoint.Client assembly。若要使 你开发的Windows 窗体、Windows Presentation Foundation (WPF) 或其他调用 .NET 托管 SharePoint Foundation 客户端 API 的应用程序能正常工作,则客户端计算机必须已安装 (引用)上述位置的SharePoint Foundation 客户端 DLL ,你必须同时具有 Microsoft.SharePoint.Client.dll 和 Microsoft.SharePoint.Client.Runtime.dll 才能使用 .NET 托管对象模型远程开发解决方案。也就是说:若要在客户端计算机上使用包含 .NET 托管客户端 API 的 DLL,必须使用 Microsoft 的 随应用程序一起分发它们。
  显然,B与C都与模态窗口的功能无关。
所以本题目正确选项应该是D
  参考
http://msdn.microsoft.com/en-us/library/ee538253.aspx
http://www.cnblogs.com/wsdj-ITtech/archive/2013/03/18/2559413.html
  
Question 14
You are developing an application page.
You need to create a pop-up window that uses the ECMAScript object model.
Which namespace should you use?
A. SP.UI.Menu
B. SP.UI.ModalDialog
C. SP.UI.Notify
D. SP.UI.PopoutMenu
  解析:
还是关于模态窗口的题,如果看了前面的资料,几乎不用思索就选B了,因为SP.UI.ModalDialog类就是用于Sharepoint的模态窗口功能的。
  选项A. 在命名究竟SP.UI下只有如下的类:
AspMenu :   Represents an AspMenu control.
Dialog:   Represents a dialog.
DialogHostedWindow: This class and its members are reserved for internal use and are not intended to be used in your code.
ModalDialog:  Represents a modal dialog.
Notify:   Provides methods for managing notification alerts.
PopoutMenu:  Defines a pop-out menu.
Status:   Provides methods for managing status messages.
Workspace:  Represents a workspace area.
根本不存在所谓的命名空间SP.UI.Menu,所以此选项是错误的。
  选项C.D  从上面的列举可以知道SP.UI.Notify 用于显示notification alerts消息的。 SP.UI.PopoutMenu用于显示pop-out菜单,二者都和显示模态窗口无关。
所以本题目正确选项应该是B
参考:
http://msdn.microsoft.com/en-us/library/ee552096(v=office.14).aspx
http://www.a2zmenu.com/Blogs/sharepoint/SharePoint%202010%20Model%20Dialog.aspx
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-118981-1-1.html 上篇帖子: 对 SharePoint WebService 的调用 下篇帖子: SharePoint中的"用户或用户组"栏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表