Sharepoint学习笔记—习题系列--70-573习题解析 -(Q15-Q18)

Question15

You are creating an application page that will open a dialog box.

The dialog box uses a custom master page. You write the following code segment. (Line numbers are included for reference only.)

01 <script type="text/javascript">

02   function DialogCallback(dialogResult, returnValue)

03   {

04   }

05   function OpenEditDialog(id)

06   {

07     var options = {

08              url:"http://intranet/_layouts/MsgToShow.aspx,

09              width: 300,

10              height: 300,

11              dialogReturnValueCallback: DialogCallback

12     };

13     SP.UI.ModalDialog.showModalDialog(options);

14   }

15 </script>

You need to ensure that the code opens the dialog box.

What should you do?

A. Add a script link that references SP.js.

B. Add a script link that references SharePoint.Dialog.js.

C. At line 13, change showModalDialog to openDialog.

D. At line 13, change showModalDialog to commonModalDialogOpen.

 

解析:

 本题在代码段没有什么错误,所以要保证能正确显示ModalDialog窗口,就只能是SP.js的引入了。参考  Question 13,所以本题没有太多讲解,正确答案应该是A

 

Question16

You plan to add a custom tab to the Ribbon in a SharePoint Web application.

You create a custom Feature that contains an Elements.xml file.

You need to ensure that the custom tab only appears in the document libraries of the Web application.

Which code segment should you add to the Custom Action node of the Elements.xml file?

A. Location="DocumentLibrary"

B. RegistrationId="101"

C. RegistrationType="List"

D. ShowInLists="false"

 

解析:

 本题的题意是要你设置你添加的Tab容器的显示时机。也即它只与Document Libraries关联显示。

先看一段Ribbon的Element.xml样例

<?xml version="1.0" encoding="utf-8"?>

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

<CustomAction

  Id="DemoHelloWorldButton"

  RegistrationType="List"

  RegistrationId="101"

  Location="CommandUI.Ribbon">

    <CommandUIExtension>

      <CommandUIDefinitions>

        <CommandUIDefinition

         Location="Ribbon.Documents.New.Controls._children">

          <Button

           Id="Ribbon.Documents.New.Controls.DemoHelloWorldButton"

           Alt="Hello World Ribbon Button"

           Sequence="10"

           Image32by32="/_layouts/images/PPEOPLE.GIF"

           Command="Demo_HelloWorld"

           LabelText="Hello World Demo"

           TemplateAlias="o2"/>

        </CommandUIDefinition>

      </CommandUIDefinitions>

      <CommandUIHandlers>

        <CommandUIHandler

         Command="Demo_HelloWorld"

         CommandAction="javascript:alert('Hello World!');" />

      </CommandUIHandlers>

    </CommandUIExtension>

  </CustomAction>

</Elements>

 

选项A. Location="DocumentLibrary" 表达是错误的。

CustomAction元素的Location 属性告知 CustomAction 在何处应用自定义项(即此元素内的所有自定义内容)。下表就是此属性相关选项的取值及说明:

                    值

                              说明

CommandUI.Ribbon

对于指定的 RegistrationId,自定义项出现在任何地方。

CommandUI.Ribbon.ListView

当存在列表视图 Web 部件时出现自定义项。

CommandUI.Ribbon.EditForm

自定义项出现在编辑表单上。

CommandUI.Ribbon.NewForm

自定义项出现在新建表单上。

CommandUI.Ribbon.DisplayForm

自定义项出现在显示表单上。

 选项B. RegistrationId="101". 用于指定与此操作(CustomAction )关联的列表或项内容类型的标识符,或文件类型或编程标识符 (ProgID)。 关于它们的含义请参见   Sharepoint学习笔记—Ribbon系列-- Reference :List definitions Type and BaseType ,此设置为101 也即我们自定义的CustomAction与 Document library //文档库 进行关联。也就是说当我们选择Sharepoint网站的某个DocumentLibrary List时,就会出现我们自下定义的CustomAction选项卡(Tab),也就是说,在CustomAction的相关属性设置中,我们解决了它显示的“时机”问题。 

选项C. RegistrationType="List" ,RegistrationType属性: 用于给每项操作指定注册附件。可能的值包括:None,ContentType,FileType,List,ProgId

选项D. ShowInLists="false" 此属性已经弃用,不应该再使用。可选属性,类型为 Boolean。如果仅在用于管理内容类型的页上显示针对列表的自定义操作,则为 TRUE。默认值为 FALSE。

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

参考:

http://techtrainingnotes.blogspot.com/2008/01/sharepoint-registrationid-list-template.html

http://msdn.microsoft.com/en-us/library/ff630938.aspx

http://msdn.microsoft.com/en-us/library/ms460194.aspx

 

Question 17

You have one Web application that contains several SharePoint site collections.

You need to create a Feature that adds a custom button to the Documents tab on the Ribbon of one site collection only.

What should you do?

A. Create a new Feature. In a new <CommandUIDefinition> node, specify the location of Ribbon.Tabs._children.

B. Create a new Feature. In a new <CommandUIDefinition> node, specify the location of Ribbon.Documents.Manage.Controls._children.

C. Modify the CMDUI.xml file. In a new <CommandUIDefinition> node, specify the location of Ribbon.Tabs._children.

D. Modify the CMDUI.xml file. In a new <CommandUIDefinition> node, specify the location of Ribbon.Documents.Manage.Controls._children.

 解析:

 本题的题意要是要实现在”某一个” Site Collection中的Ribbonr的Document Tab上添加一个用户自定义的按钮。所以是关于Ribbon的实现的。由要求可知 1. 此按钮并非”通用”的,即适用于所有的Site Collection. 2. 此按钮要出现在Document Tab中。

 明确了要求,我们就可以首先排除C.D了,因为CMDUI.xml中定义的均是Out-Of-Box的Ribbon元素,也即在这里所作的改变均会显示到所有的相关的Site Collection中,具有”通用”性。达不到只针对某个Site Collection的要求。

  然后就是Document Tab的位置要求,本题位置要求应该是Ribbon.Documents. 即选项B符合要求。

至于选项A,是根本不存在Ribbon.Tabs这样的位置定义的。

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

参考:

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

http://www.cnblogs.com/wsdj-ITtech/tag/Ribbon/

http://howtosharepoint.blogspot.com/2010/06/ribbon-basics.html

 

Question 18

You have a SharePoint site that contains 10 lists.

You need to prevent a list named List1 from appearing on the Quick Launch navigation bar.

What should you configure? 

A. the Hidden property of List1

B. the Navigation.QuickLaunch.Parent.IsVisible property of the site

C. the OnQuickLaunch property of List1

D. the QuickLaunchEnabled property of the site

 解析:

选项A. List的Hidden Property用于设置这个List是否在Documents page, Lists page, Quick Launch bar, Modify Site Content page, 或者 Add Column page上显示.请注意,它控制的不仅是Quick Launch Bar上是否显示。

选项B. 看表达就知道它控制的并不是List,而是QuickLlaunch对象自身的元素。而且是否有此属性我还并没验证。

选项C. 此属性用于设置指定的List是否在HomePage的Quick Launch 上出现,这正是我们需要的。

选项D. 用于设置Quick Launch area 是否在Web Site上能用(显示与否)。

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

参考

http://msdn.microsoft.com/zh-cn/library/microsoft.sharepoint.splist.onquicklaunch.aspx

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.onquicklaunch.aspx

http://msdn.microsoft.com/zh-cn/library/microsoft.sharepoint.spweb.quicklaunchenabled(v=office.12).aspx

posted @ 2013-06-12 18:02  wsdj  阅读(637)  评论(2编辑  收藏  举报