zoukankan      html  css  js  c++  java
  • Sharepoint学习笔记—习题系列--70-573习题解析 -(Q35-Q39)

    Question 35
    You have a custom Web Part that is deployed as a sandboxed solution.
    You need to ensure that the Web Part can access the local file system on a SharePoint server. You must minimize the amount of privileges assigned to the Web Part.
    What should you do?
    A. Elevate the trust level to Full.
    B. Elevate the trust level to WSS_Medium.
    C. Redeploy the Web Part as a farm solution.
    D. Deploy the Web Part to the Global Assembly Cache (GAC).

    解析:
      本题实质是要实现在SandBox Solution自身的代码中有限访问本地文件系统。
    由于SandboxSolution的安全限制,这个要求是不可能实现的,所以唯一的出路就是重新创建这个Solution,把它变成Farm Solution才能解决这个问题。
    至于其它的选项A.B.D等,都不是Sandbox Solution关心的问题,也不是解决Sandbox Solution权限限制的方法,所以都可以排除掉。
     所以本题目正确选项应该是C


    Question 36
    You need to convert a user control named Control.ascx to a SharePoint Web Part. The Web Part must be packaged as a user solution.
    What should you do?
    A. Modify the SafeControls section of the web.config file.
    B. Copy the Control.ascx file to the ControlTemplates folder.
    C. Create a new Visual Web Part and use the existing MyControl.ascx file.
    D. Create a new Web Part and reuse the code from the MyControl.ascx file.

    解析:
     本题实质是要把一个用户自定义控件Contrl.ascx引入到一个WebPart中。
    选项A. Modify the SafeControls section of the web.config file. 在Sharepoint 中只有确保受信任的控件才能在系统中使用。SharePoint将只加载在web.config文件中的SafeControl元素定义的控件。本选项与本题要达到的目的无关。
    选项B. Copy the Control.ascx file to the ControlTemplates folder. 打开一个使用到UserControl的项目(如下图),可以看到一个UserControl控件是放置在文件夹ControlTemplates下的,但它不仅仅是ascx文件,还有相应的后台代码文件.CS。
     
      通过这种直接拷贝Control.ascx文件的方法是实现不了再利用用户自定义控件的。
    选项C. Create a new Visual Web Part and use the existing MyControl.ascx file. 我们知道,Sharepoint2010中有Visual Web Part,当我们在VS2010中创建一个Visual Web Part的项目时,我们可以看到,它实际就是创建了一个用户自定义控件,然后再在Web Part中加载这个用户自定义控件从而实现设计时的可视化操作。因为在创建Viusal Web Part时,VS2010已经自动生成了一个用户自定义控件,所以你不可能还要去利用另一个MyControl.ascx文件。
    选项 D. Create a new Web Part and reuse the code from the MyControl.ascx file. 这个选项才是我们想要的,即利用MyControl.ascx的代码来创建我们的Web Part。
     所以本题目正确选项应该是D.

    参考:
    http://blogs.msdn.com/b/kaevans/archive/2011/04/28/user-controls-and-server-controls-in-sharepoint.aspx


    Question 37
    You are creating a Web Part in SharePoint Server 2010.
    You need to ensure that the Web Part can send data to another Web Part.
    Which interface should you override?
    A. IQueryable
    B. ISerializable
    C. IWebEditable
    D. IWebPartField

    解析:
      本题考的是从一个Webpart向另一个Webpart传递数据,需要什么接口。属于WebPart之间建立连接的知识范畴。
      Web 部件连接是两个服务器控件之间的链接或关联,使二者可以共享数据。一个连接始终正好涉及两个控件:一个是数据提供者,另一个是提供者所提供数据的使用者。一个控件既可以是使用者,也可以是提供者,并且无论是 WebPart 控件、自定义控件还是用户控件,任意类型的服务器控件都可以设计为参与连接。

    选项A. Iqueryable: 是属于LINQ的概念,IQueryable 接口由查询提供程序实现。该接口只能由同时实现 IQueryable<T> 的提供程序实现。如果该提供程序不实现 IQueryable<T>,则无法对提供程序数据源使用标准查询运算符。IQueryable 接口继承 IEnumerable 接口,以便在前者表示一个查询时可以枚举该查询的结果。

    选项B. Iserializable: 是属于序列化方面的概念,允许对象控制其自己的序列化和反序列化过程。序列化是将对象或对象图转换为线性的字节序列以存储或传输到其他位置的过程。反序列化是接受存储的信息并利用它重新创建对象的过程。通过 ISerializable 接口,类可以执行其自己的序列化行为。

    选项C. IwebEditable: IWebEditable 接口使您能够将自定义 EditorPart 控件与服务器控件相关联--例如 WebPart 控件、用户控件或自定义服务器控件。也即:为开发人员提供一个接口指定编辑器与 WebPart 控件的控件的自定义。

    选项D. IwebPartField: 此接口旨在用于 Web 部件连接。在 Web 部件连接中,位于 WebPartZoneBase 区域建立连接和共享数据,其中一个控件作为使用者的与另一个控件作为提供程序的两个服务器控件。共享的数据结构在 Web 部件连接是接口实例,提供程序提供给使用者传递回调方法。若要建立连接,使用者和提供者都必须都与共享数据同一个接口类型一起使用。 
     所以本题目正确选项应该是D

    参考:
    http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.webparts.iwebpartfield.aspx
    http://msdn.microsoft.com/zh-cn/library/ms178187(v=vs.100).aspx
    http://msdn.microsoft.com/zh-cn/library/system.linq.iqueryable.aspx
    http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.webparts.iwebeditable.aspx


    Question38
    You plan to create a Web Part for a SharePoint site.
    You need to ensure that the Web Part can send data to other Web Parts in the site.
    What should you do?
    A. Implement the IAlertNotifyHandler interface.
    B. Implement the IAlertUpdateHandler interface.
    C. Create a custom interface that uses the WebBrowsable and the WebPartStorage attributes.
    D. Create a custom interface that uses the ConnectionProvider and ConnectionConsumer attributes.

    解析:
     题意可以看出,它是要考你WebPart建立连接的知识。下面来看看各个选项。

    选项A. IAlertNotifyHandler  在 microsoft.sharepoint.dll 中,提供发送警报信息的相关方法。 例如可能通过IAlertNotifyHandler来自定义Alert Email。显然此接口与WebPart之间的连接无关。
    选项B. IAlertUpdateHandler : 此接口通常与IAlertNotifyHandler接口配合使用,实现通知处理程序。通过在 IAlertNotifyHandler 接口中实现 OnNotification 函数,可以捕获通知事件。
    通过在 IAlertUpdateHandler 中实现 PreUpdate 和 PostUpdate 函数,可以捕获通知创建或修改事件。显然它们也与Webpart之间的连接无关。
    选项C. WebBrowsable和WebPartStorage, 它们与Webpart控件的属性管理有关,WebBrowsable可以使Webpart的相关属性 (Property) 在用户编辑 Web 部件时显示在工具窗格中,也即:你可以在用户界面上看到甚至修改它。 WebPartStorage用于定义Webpart的属性是如何被保存的。一般有三种方式:Storage.Shared即此属性设置为所有用户共用。Storage.Personal:即此属性为每个用户私人拥有。Storage.None即此属性不保存在数据库中,一般用于不提供给用户操作的某些属性(例如:公司的Logo)。所以很显然,此选项也与本题无关。

    选项D. ConnectionProvider和ConnectionConsumer  我们知道Web 部件连接是两个服务器控件之间的链接或关联,使二者可以共享数据。一个连接始正好涉及两个控件:一个是数据提供者(ConnectionProvider),另一个是提供者所提供数据的使用者(ConnectionConsumer  )。一个控件既可以是使用者,也可以是提供者,并且无论是 WebPart 控件、自定义控件还是用户控件,任意类型的服务器控件都可以设计为参与连接。所以,Webpart的连接就是围绕着ConnectionProvider和ConnectionConsumer展开的。

    所以本题目正确选项应该是D

    参考:
    http://msdn.microsoft.com/zh-cn/library/microsoft.sharepoint.ialertupdatehandler.aspx
    http://msdn.microsoft.com/zh-cn/library/bb897791(v=office.12).aspx
    http://msdn.microsoft.com/zh-cn/library/dd585825(v=office.11).aspx
    http://msdn.microsoft.com/zh-cn/library/ms178187(v=vs.90).aspx
    http://msdn.microsoft.com/zh-cn/library/ff597538.aspx

    Question39
    You are creating two Web Parts named WPMaster and WPDetails.
    You need to ensure that when an item is selected from WPMaster, the details of the item are displayed in WPDetails.
    What should you implement in WPMaster?
    A. ICellProvider
    B. IListProvider
    C. IWebPartRow
    D. IWebPartTable

    解析:
      本题仍然是Webpart连接的内容。想要实现的是在两个Webpart之间建立类似于“主-从表”之间的效果,即在一个Webpart中点选了一个Item,就在另一个Webpart中显示一行关于此item的详细信息。

    分析各选项:
    A. IcellProvider: 此接口用于配合ICellConsumer接口来实现在两个Webpart之间传递“单值”数据的(single value: [例如一个单元格或字段])目的。这两个接口已过时,因此不用再深入了解它们。它已经被IWebPartField 代替了。
    B. IlistProvider 此接口用于定义事件(Events), 配合IListConsumer 接口,实现在两个Webpart之间传递整个List(Entire List [rowset] of data)的功能。这两个接口也已经过时,它们被IwebPartTable接口代替了。

    C. IwebPartRow 是一个提供者接口,属于 Web 部件控件集中的标准接口,”用于基于数据行创建连接” ,即Webpart之间传递的是”数据行”数据(这正是本题需要的: 根据所选”主”值,传回相关的”从”数据行)。

    D. IwebPartTable 此接口用于实现在Webpart之间基于整个数据表的传递连接。

    对于上述的接口,您也可以创建自定义接口以用于 Web 部件连接,但在由数据驱动的许多 Web 应用程序中,基于数据源中的公共字段(参见 IWebPartField 接口)、表(参见 IWebPartTable 接口)或者行创(参见 IwebPartRow接口)建连接是很有用的。
     
    所以本题目正确选项应该是C

    参考:
    http://msdn.microsoft.com/zh-cn/library/microsoft.sharepoint.webpartpages.communication.icellprovider.aspx
    http://msdn.microsoft.com/zh-cn/library/dd586425(v=office.11).aspx
    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.iwebpartrow.aspx
    http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.webparts.iwebpartrow(v=vs.80).aspx
    http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.webparts.iwebparttable.aspx

  • 相关阅读:
    Python反射(自省)机制
    Python多态和多态性
    Python中子类调用父类的方法
    Python类的组合和继承
    Python类的静态属性、类方法、静态方法
    Python类的内置函数
    Python json模块详解
    python os模块总结
    python sys模块详解
    python 模块和包的入方法
  • 原文地址:https://www.cnblogs.com/wsdj-ITtech/p/3137152.html
Copyright © 2011-2022 走看看