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

Question  128
 You are designing a SharePoint 2010 solution that includes a custom site definition and a custom master page. The solution has the following three features:
.A hidden site-scoped feature named X that adds the custom master page to the Master Page gallery.
.A Web-scoped feature named Y with a feature receiver that sets the master page of the Web to the master page from feature X.
.A Web-scoped feature named Z with a feature receiver that populates the default.aspx file with sample content.
Any Web site that is created based on the solution’s custom site definition must have the master page and the sample content applied to it automatically. Your design must ensure that features X, Y, and Z can be activated in the proper order. Which approach should you recommend?
A. Include features X, Y, and Z in that order in the onet.xml file for the site definition.
B. Include a user control in the custom master page to activate feature Z the first time the page is rendered, and include features X and Y in the onet.xml file for the site definition.
C. Set feature dependencies so that feature X is dependent upon feature Y and feature Y is dependent upon feature Z, and then use feature stapling to attach feature X to the site definition.
D. Set feature dependencies so that feature Y is dependent upon feature Z, and then use feature stapling to attach features X and Y to the site definition.


解析:
  你在一个Sharepoint2010解决方案包中创建了一个网站定义(Site Definition)和一个用户自定义母板页(),此方案包还包含下面的功能:
  一个名为X的隐藏功能, 为网站集级别,用于添加用户母板页到Master Page Gallery中。
  一个名为Y的功能,为网站级别,此功能有一个Feature Receiver用于设置所处的网站使用上面功能X所添加的母板页
  一个名为Z的功能,也为网站级别,此功能有一个Feature Receiver用于根据样本内容建立Deafult.aspx页面。
  任何基于此网站定义创建的网站必须自动包括母板页以及对样本内容的应用, 并且你需要保证功能X,Y,Z需要在适当的时机被激活。
  你应该如何操作来实现本题的要求呢?
  从题干的描述我们似乎可以感觉到,此Solution的Feature之间存在明显的依赖关系:即X与Y.Z之间,Y.Z依赖于X创建的母板页,则Z则依赖于Y完成母板风格设置。那么这种感觉对不对呢?
  我们来看看激活依赖关系和范围的相关知识点:
  功能激活依赖关系表达对两个功能之间相互关系的要求。您可以针对同一个范围的功能或更大范围内的功能表达激活依赖关系。当某个特定范围内的某个功能对于其他范围内的其他功能具有依赖关系时,就存在跨范围激活依赖关系。跨范围激活依赖关系的一个示例是一个网站范围的功能依赖于一个网站集范围的功能【符合本题:X属于网站集范围,且隐藏。Y,Z属于网站范围】。
  根据激活依赖关系的跨范围规则中的一段子规则: 如果所依赖的功能不可见,则不支持跨范围的功能激活依赖关系。换句话说,网站范围的功能不可能依赖于在用户界面中不可见的网站集范围的功能。【这句话是关键,根据这句话,我们就直接排除了选项C。因为我们知道X是网站集级别,但它是隐藏的,而Y.Z是网站级别,且它们依赖于X,而根据此规则,这种依赖关系是不允许的!所以排除。而且,选项C所描述的依赖方向也是错误的】
  至于选项D. 很明显Y与Z之间的依赖方向不对,且Feature Stapling是用来对已经部署并投入应用的Site Defintion在无需对其进一步修改的情况下进行升级扩充的,属于运营后的再开发。所以此选项也应该排除。
  而选项A. 使用到Site Definiton的onet.xml文件,根据微软的描述: “在 Onet.xml 文件中,在网站定义配置内使用 Feature 元素可包含对 Feature 实例和默认属性值的引用。Configuration 元素指定在创建 SharePoint 网站时要使用的列表和模块。SharePoint Foundation 按照 Onet.xml 文件中指定的功能的列出顺序激活这些功能。因此,必须在依赖于某些功能的功能之前指定所依赖的这些功能 “。 根据此描述,选项A在Onet.xml文件中引用 了Z与Y,但它们之间有依赖关系,所以你必须要指定Z与Y的依赖关系,而选项A中并没作这一步。因此也应该被排除。
  最后就剩下了选项B. 此选项把功能X与Y放到Onet.xml 文件中,因为它们之间不存在依赖关系,所以可行,而功能Z放到页面呈现之后最后执行,就避免了还要因为在Onet.xml中的引用就必须要定义Z与Y之间的依赖关系这样的操作。更进一步,由于功能Z涉及到创建网站页面,所以,在它之前务必保证Site Scope或Web Scope的相关功能被激活就显得非常重要。
因此本题答案应该选 B

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

 

Question  129
 You have a SharePoint 2010 intranet site with a site collection for all team projects. Each team project site is created from a custom team project site definition. These sites are created with a standard list to help manage team projects. Each list can be modified as needed for each site. You are asked to design two features:
.A feature named X for the list template
.A feature named Y for creating an instance of the list
You need to ensure that the list template is installed before the list instance. Which approach should you recommend?
A. Set the scope of feature X to Web and the scope of feature Y to Site. Set feature X as an activation dependency for feature Y.
B. Set the scope of feature X to Site and the scope of feature Y to Web. Set feature Y as an activation dependency for feature X.
C. Set the scope of feature X to Site and the scope of feature Y to Web. Set feature X as an activation dependency for feature Y.
D. Set the scope of feature X to Web and the scope of feature Y to Site. Set feature Y as an activation dependency for feature X.


解析:
 你在Sharepoint2010内部网站中为小组项目管理创建了一个网站集,每一个小组网站均是基于一个小组网站定义(Site Definition)创建,在创建时自带一个标准的列表用于管理小组项目,而且这个列表可以根据各网站需要进行修改,为此你需要设计两个功能
  功能1.为列表模板创建功能X
  功能2.为创建列表实例创建功能Y
  你需要保证列表模板在创建列表实例之前安装,你应该采取什么方法呢?
  根据题意我们知道,功能X是网站集级别(因为它关联到列表模板,而列表模板可以被用来在各个网站上创建列表实例,这种具有可重用性的对象往往放到网站集级别),功能Y是网站级别(因为它关联到创建列表实例,而列表实例是存在于各个网站上的具体实现),而且功能Y依赖于功能X。
  按照这样的逻辑,直接就定位到了选项C。

因此本题答案应该选 C

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


Question  130
 A company with offices worldwide has asked you to design a SharePoint 2010 feature for an intranet portal. The feature must:
.Be activated only on a site collection.
.Contain a customized list template.
.Contain a custom List page.
.Use globalized resources that can be shared with other features.
You need to design the feature to support all these requirements. Which approach should you recommend?
A. Use the Scope attribute of the feature to limit the availability of the feature to a site collection. Then set the Require Resources element to true. Store globalized resources in a file in a global document library.
B. Use the Scope attribute of the feature to limit the availability of the feature to a site collection. Then use the Module element in the feature to provision a file into the SharePoint 2010 site. Store shared resources in the \web server extensions\14\Resources folder.
C. Use the Scope attribute of the feature to limit the availability of the feature to a farm. Then use the Module element to provision a file into the SharePoint site. Store shared resources in the \_catalogs folder.
D. Use the Module element in the feature to limit the availability of the feature to a site collection. Then set the Require Resources element to true. Store shared resources in the \web server extensions\14\Resources folder.

解析:
  一家全球化公司需要为其内部门户网站创建一个功能, 此功能必须
 1.包含一个列表模板
 2.包含一个含有用户列表实例的页面
 3.使用可与其它功能共享的全局资源
 你该如何设计此功能呢?
 首先,我们先来看看关于Sharepoint的Resource相关知识点,Sharepoint的资源文件可以存放到以下的相关位置:
• C:\Inetpub\wwwroot\wss\VirtualDirectories\ \App_GlobalResources\
• $SharePointRoot$\14\Resources\
• $SharePointRoot$\14\CONFIG\Resources\
• $SharePointRoot$\14\CONFIG\AdminResources\
• $SharePointRoot$\14\TEMPLATE\FEATURES\\Resources\
 这些位置各有各有适用情况。
每一种Resource在上述位置都有自己的Folder,作为方案解决包或功能的一部分提供的Resource可以存放到如下位置:
• $SharePointRoot$\14\TEMPLATE\FEATURES\\Resources\Resources..resx
• $SharePointRoot$\14\TEMPLATE\FEATURES\\Resources\
• $SharePointRoot$\14\Resources\
每个功能一般都使用存放在它们自己的Resource文件夹下的Resources File。如果要把Resources File共享给其它功能,你就需要把它放置到14\Resources\ folder目录。【如本题的情况】
  根据上述描述,我们就可以直接定位选项到B.D。因为它们都把Resource File放置到了正确的位置: \web server extensions\14\Resources。然而选项D使用Module元素来设置Feature的Scope这显然是不对的,设置Feature的Scope应该用Scope属性。它可以指定在其中激活功能的范围并包含下列值之一:Farm(服务器场)、WebApplication(Web 应用程序)、Site (网站集)、Web(网站)。
  选项A. Sharepoint中不存在global document library这种东西,所以直接排除。
  选项C. _catalogs 文件夹是Sharepoint内容数据库内的文件夹,它不是真正的文件系统下的文件夹。你可以通过像Http://Server:port/_catalogs/masterpage 这样的地址去获取母板页。或者用Sharepoint Designer打开你的网站,在左边面板上也能找到_catalogs 文件夹,你可以自己进去看看里面的内容。但不论如何,它都不是实现Resources File共享的正确位置。所以选项C也应该被排除。

因此本题答案应该选 B 

参考 
http://msdn.microsoft.com/en-us/library/ms434127.aspx
http://msdn.microsoft.com/en-us/library/ms436075.aspx
http://www.cnblogs.com/Sunmoonfire/archive/2012/07/28/2613674.html
http://www.sharepointblues.com/2012/05/28/sharepoint-2010-resource-file-deployment-done-easy/


 

posted @ 2014-03-08 13:51  wsdj  阅读(568)  评论(0编辑  收藏  举报