Sharepoint学习笔记—习题系列--70-576习题解析 -(Q29-Q31)

Question 29
You are designing a SharePoint 2010 intranet site at your company. The accounting department has designed a  SharePoint list. They need this list to be included in any new site that is created by using the Team Site site definition provided by SharePoint. A feature has been created that provisions the list in a site. You need to satisfy the request from the accounting department, while reducing the risk that future SharePoint service pack updates
will impact your solution. Which approach should you recommend?
A. Modify the Team Site onet.xml file. Add the feature to the Web Features element in the onet.xml file.
B. Modify the Team Site onet.xml file. Add the feature to the Site Features element in the onet.xml file.
C. Create an event handler and register it with the Web Adding event. Activate the feature in the event handler.
D. Create an event handler and register it with the Web Provisioned event. Activate the feature in the event handler.


解析:
  本题题意:你公司的会计部门设计了一个列表,他们希望这个列表可以包含在任何基于工作组网站网站定义(Team Site site defintion)创建的新网站中,你需要满足会计部门的这个需求,但同时还要考虑到今后Sharepoint服务包升级对你的解决方案造成的潜在风险。
   首先在选项A.B中均提到了一个重要的文件:Onet.xml,我们先来了解一下这个文件:
   我们在安装 Microsoft SharePoint Foundation 时,将安装多个 Onet.xml 文件:一个文件位于 %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\GLOBAL\XML 中,该文件适用于全局部署;一些文件位于 %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\SiteTemplates 中的不同文件夹中。后一组中的每个文件对应于 SharePoint Foundation 附带的一个网站定义。例如,它们包括博客网站、管理中心网站、会议工作区网站和 SharePoint 工作组网站【即本题提到的工作组网站定义】。
全局 Onet.xml 文件定义适用于全局部署的隐藏列表的列表模板、列表基类型、默认定义配置和模块。%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\SiteTemplates 目录的子目录中的每个 Onet.xml 文件都可以定义在对应的网站定义中使用的导航区域、列表模板、文档模板、配置、模块、组件和服务器电子邮件页脚。
   警告: 我们不支持对最初安装的 Onet.xml 文件进行更改。更改此文件可能会破坏现有网站。此外,安装 SharePoint Foundation 的更新或 Service Pack 或者将安装升级到下一产品版本时,可能存在 Microsoft 提供的文件的新版本,并且安装无法将您的更改与新版本合并。【看到这句话,你就应该排除选项A.B了,因为它们均试图直接去修改”工作组网站定义”这个最初安装的 Onet.xml 文件,并且此修改方式会影响后续Sharepoint服务包升级并造成可能的风险,这也是题干描述部分要求避免的】
于是,转向选项C.D,二者的共同点是: 均试图通过Event Handler来实现本题的目标,区别在于对Event Handler的选择不同。一个是选择Web Adding Event,一个是选择Web Provisioned Event,我们来看看微软对它们的描述:
创建 SharePoint 网站涉及两个独立的步骤:首先,将一个网站添加到网站集(SPSite 实例)中。此时,网站本身和一个空文件夹差不多,只具有一组属性。然后,在第二个步骤中,设置网站(也就是应用 Web 模板),接着各个项(如列表、文件和其他内容对象)被实例化,并根据指定的站点定义进行组织。
因为大多数重要的活动发生在设置阶段,这些与网站相关的新事件与添加和设置网站的过程相关联:
WebAdding(SPWebEventProperties)
WebProvisioned(SPWebEventProperties)
在创建新网站之前会引发 WebAdding 事件,因此,如果创建操作被取消,则不会创建任何 SharePoint 网站,也不会启动设置过程。您可以使用 WebAdding 事件执行条件验证等活动,以确保 URL 是有效的或创建网站的用户拥有适当的凭据。
在网站完全设置好并且设置过程已完成之后,会发生 WebProvisioned 事件。此事件可配置为在同步或异步模式下运行。可使用此事件完成开发操作,例如,将 Web 部件添加到网站中。
 所以,针对本题需要把一个列表包含到新创建的网站中,这种操作明显属于上述描述的设置网站阶段,即使用WebProvisioned。

因此本题答案应该选D

参考 
http://msdn.microsoft.com/zh-cn/library/ms474369(v=office.14).aspx
http://msdn.microsoft.com/zh-cn/library/ee539050(v=office.14).aspx


Question 30
You are designing a SharePoint 2010 application that will be used across multiple Web applications. A custom list definition is deployed to every site collection in the farm. Your application must include a report that shows how often the new list is provisioned anywhere in the farm. The application must enable permissions to be granted to specific users to view the report, without the redeployment of code. You need to design a system for logging and reporting this activity. Which two actions should be performed? (Each correct answer presents part of the solution. Choose two.)
A. Create an event handler and register it with the List Added event of your custom list definition. In the event handler, connect to the logging service and log the list creation event. Deploy the event handler to every site collection in the farm.
B. Create a list workflow and bind it to the custom list definition. When the Item Added event executes, connect to the logging service and log the list creation event. Deploy the workflow to every site collection in the farm.
C. Create a Web service that adds a row to a custom database each time a list is created. Create an application page that displays a report of logged activity. Grant specific users permission to view the page in the code behind of the application page. Deploy the page to Central Administration.
D. Create a service application that adds a row to a custom database each time a list is created, and displays a report of the logged activity. Create an instance of the service application that can be used by every Web application in the farm. Grant specific users permission to view the report from the Services Applications tab in Central Administration.

解析:
    本题是个多选题,讲的是你设计了一个Sharepoint应用程序,它可以跨多Web Application使用(也即在Sharepoint场范围内部署),此应用程序完成的是向授权的用户展现一个报表,这个报表统计的是关于一个指定的列表在整个服务器场中的使用频率, 这个使用频率值由你设计一个系统负责记录并报告, 而这个列表可以部署在全场的任何一个网站集中。
所以你的解决方案应该需要解决3大问题:1.如何获取创建指定列表的统计值[如何记录,如何捕获创建事件]。2. 如何控制权限。 3.如何提供统计表服务[通过前面的需求描述,我们至少会意识到,能够向整个场中的Web application提供某种服务的途径,多半要和Sharepoint的Service application关联上了]。
下面来分析各个选项,看看哪两个可以配套解决本题。
选项A. Create an event handler and register it with the List Added event of your custom list definition. In the event handler, connect to the logging service and log the list creation event. Deploy the event handler to every site collection in the farm.
     本选项在客户列表定义中注册一个列表Added事件,在此事件中完成记录此列表的创建事件,并在场内的所有网站集部署此Event Handler。这样,当在任何网站集中基于此列表定义添加新列表时,就会激活Added事件,从而在日志中添加一条统计值。
     从上面描述来看,此选项解决了如何获取创建指定列表的统计值这样的任务,它捕获了创建列表事件,并记录到日志中。

选项B. Create a list workflow and bind it to the custom list definition. When the Item Added event executes, connect to the logging service and log the list creation event. Deploy the workflow to every site collection in the farm.
     本选项试图创建一个列表工作流并把它绑定到列表定义,当有Item Added事件发生时,此工作流连接到日志服务并记录列表创建事件,此工作流部署到场内的所有网站集中。
     我们知道,Sharepoint的列表工作流是与特定的列表实例关联的,而列表定义则是用来创建具体的列表实例的,所以把依赖于具体列表实例的列表工作流与并不是列表实例的列表定义进行绑定是不可行的。再者,此选项记录列表创建的事件是Item Added而非List Added,从这方面来看也是不对的。所以本选项应该被排除。

选项C. Create a Web service that adds a row to a custom database each time a list is created. Create an application page that displays a report of logged activity. Grant specific users permission to view the page in the code behind of the application page. Deploy the page to Central Administration.
本选项试图通过创建一个Web Service实现每当一个列表创建时就向用户数据库中添加一条记录。创建一个应用程序页面展示统计报表。在此应用程序页面的后台代码实现授权指定用户查看本页面,并部署此应用程序页到Central Administration。
首先,当你开发Web Service时你会发现它是基于具体的网站的,这意味着你得为每一个场内的网站定制对应的Web Service来达到:每当一个列表创建时就向用户数据库中添加一条记录这样的目的,所以借助Web Service,你无法做到跨越不同的Web Application去提供统一的操作与服务。进一步,创建应用程序页面展示统计报表的作法也是与具体网站结合的,应用程序页面用于支持 SharePoint Foundation 中的应用程序实现。它存储在前端 Web 服务器的文件系统上的 %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\LAYOUTS 目录中,并且 Web 应用程序中的每个网站都有应用程序页面。此文件夹映射到称为 _layouts 的 Internet Information Services (IIS) 虚拟目录中。每个网站和子网站将可以通过使用 _layouts 虚拟目录来访问应用程序页面。 由此可见,通过应用程序页面也显然是无法做到跨越不同的Web Application去提供统一的操作与服务的。因此,此选项也应该被排除。
  
选项D. Create a service application that adds a row to a custom database each time a list is created, and displays a report of the logged activity. Create an instance of the service application that can be used by every Web application in the farm. Grant specific users permission to view the report from the Services Applications tab in Central Administration.
本选项创建一个服务应用程序实现每当有新列表创建时就向用户数据库中添加一条记录,并负责展示统计报表。创建一个此服务应用程序的实例提供给场内的每一个Web application。在Central Administration中授权特定用户有权查看此服务应用程序提供的统计报表。
    我们知道服务应用程序就是实现跨Web application提供服务支持的,而在Central Administration界面实现对用户权限的控制也是必须的,因此,此选项也应该做为本题答案的一部分。
因此本题答案应该选 A.D

参考 
http://msdn.microsoft.com/zh-cn/library/aa979592(v=office.14).aspx
http://msdn.microsoft.com/zh-cn/library/ee705814(v=office.14).aspx
http://www.cnblogs.com/wsdj-ITtech/archive/2012/11/28/2552465.html

 

Question 31
You are using SharePoint 2010 to design an intranet application for a manufacturer. Employees need to view Web pages with instructions on how to assemble various products. The legal department requires that employees can view past versions of each set of instructions. The instructions may contain rich text elements such as bullets and images. You need to design a solution that meets these requirements. Which approach should you recommend?
A. For each product, create a Web Part page and add a Content Editor Web Part titled “Instructions” to a Web  Part zone on that page. Add the set of instructions to the Web Part.
B. For each product, create an application page and add a Content Editor Web Part titled “Instructions” to a Web Part Zone on that page. Add the set of instructions to the Web Part.
C. Create a page layout that includes a Web Part zone and a Content Editor Web Part titled “Instructions” in that Web Part Zone. For each product, create a publishing page based on that page layout and add the set of instructions to the Web Part.
D. Create a content type with a Publishing HTML column titled “Instructions”. Create a page layout based on the content type for each product. For each product, create a publishing page using the page layout. Add the set of instructions to the "Instructions" column.


解析:
   本题是让你为一个制造厂提供一个解决方案,此方案用来帮助制造厂的工作人员查看各个产品的所有版本的组装说明,查看内容支持富文本(图片)。
首先需要注意是对组装说明的多版本支持,所以上来就可以排除选项A.B,因为不论是WebPart Page还是Application Page均不支持多版本处理。
接下来再分析选项C.D的区别,一个是使用Content Editor Web Part,一个是使用Publishing HTML,需要注意的是由于Content Editor Web Part并不支持版本历史的存储,所以即使我们使用了Publishing Page,其内嵌的Content Editor Web Part也并不能帮助我们回溯到以前版本的Publishing Page内容。
因此本题答案应该选 D
参考 
http://msdn.microsoft.com/en-us/library/ff648024.aspx
http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/5dac5309-0361-4e6c-b0d7-5aa622775190/
http://www.dotnetcurry.com/ShowArticle.aspx?ID=638
http://msdn.microsoft.com/zh-cn/library/ff648024.aspx

 

posted @ 2013-09-28 16:44  wsdj  阅读(586)  评论(0编辑  收藏  举报