Question 127
You create a custom list named Products.
You need to perform a Representational State Transfer (REST) query that returns the first product in the list.
Which URL should you use?
A. http://intranet/_vti_bin/ListData.svc/Products(1)
B. http://intranet/_vti_bin/ListData.svc/Products $filter=1
C. http://intranet/Lists/Products/AllItems.aspx contents=1
D. http://intranet/Lists/Products/ListData.svc $expand=1
解析:
本题是想要返回列表中的第一条记录(ID值为1)。
在Question126中我们已经看了关于REST的基本知识点,下面直接分析各选项:
选项A. http://intranet/_vti_bin/ListData.svc/Products(1) 获取Product列表中ID值为1的Item.
选项B. http://intranet/_vti_bin/ListData.svc/Products $filter=1 此用法不对,一般语法 是/_vti_bin/ListData.svc/ListName?$filter=COLUMN1 eq 'VALUE11’ 即通过某列的值进行过滤查找。
选项C. http://intranet/Lists/Products/AllItems.aspx contents=1 这明显不是REST的表达
选项D. http://intranet/Lists/Products/ListData.svc $expand=1此用法不对,Expand的作用类似于JOIN,例如:如果要返回两个List(Building与 Rooms)的Items,则使用$expand 扩展:/_vti_bin/ListData.svc/Building?$expand=Rooms
所以本题目正确选项应该是A
参考:
http://msdn.microsoft.com/en-us/library/ff798339.aspx
Question 128
You create two custom lists named Offices and Rooms.
Rooms has the following columns:
Title
Capacity
Equipment
Offices has the following columns:
Title
Rooms (a lookup to the Title column in the Rooms list)
Rooms: Capacity
Rooms: Equipment
You need to perform a Representational State Transfer (REST) query that returns a list of all the offices that have rooms with a capacity of 10. The query results must include the room titles and the equipment in each room.
Which URL should you choose?
A. /_vti_bin/ListData.svc/Offices $expand=Rooms&$filter=Rooms/Capacity eq 10
B. /_vti_bin/ListData.svc/Offices &$filter=Rooms/Capacity eq 10
C. /_vti_bin/ListData.svc/Rooms $expand=Offices&$filter=Rooms/Capacity eq 10
D. /_vti_bin/ListData.svc/Rooms &$filter=Offices/Capacity eq 10
解析:
本题涉及到两列表的连接,所以必然要用到Expand方法。所以直接可以排除选项B,D。
又根据题意:需要返回所有拥有接客量为10的房间的Office记录,即:是Rooms跟Office连接,Office是主表,Rooms是从表,返回Office列表项记录,Expand之后跟的应该是从表,所以选项A为答案。
所以本题目正确选项应该是A
参考:
http://msdn.microsoft.com/en-us/library/ff798339.aspx
Question 129
You need to create a Microsoft .NET Framework console application that queries a list by using the SharePoint client object model.
Which two assemblies should you reference? (Each correct answer presents part of the solution. Choose two.)
A. Microsoft.Office.Sharepoint.ClientExtensions.dll
B. Microsoft.SharePoint.Client.dll
C. Microsoft.SharePoint.Client.Runtime.dll
D. Microsoft.SharePoint.Client.Silverlight.Runtime.dll
解析:
本题是想建立一个基于.NET Framework的控制台应用程序去访问Sharepoint的列表资源。
涉及到Sharepoint的客户端对象模型。
使用 SharePoint Foundation 2010 托管客户端对象模型,您可以设计客户端应用程序,以便无需在运行 Microsoft SharePoint Foundation 2010 的服务器上安装代码即可访问 SharePoint 内容。例如,您可以构建新类别的应用程序,其中包括编写基于 Microsoft .NET Framework 的应用程序、丰富的交互式 Web 部件、Microsoft Silverlight 应用程序以及在 SharePoint Web 部件中运行客户端的 ECMAScript(JavaScript、JScript) 应用程序。
若要构建Windows 控制台托管的客户端对象模型应用程序,您必须添加对以下两个程序集的引用:Microsoft.SharePoint.Client.dll 和 Microsoft.SharePoint.Client.Runtime.dll。安装 SharePoint Foundation 时将会在服务器上安装这两个程序集。这两个程序集位于以下目录中:
%ProgramFiles%Common FilesMicrosoft Sharedweb server extensions14ISAPI
对于 SharePoint Foundation Beta 和 Microsoft SharePoint Server 2010 Beta,您必须复制这两个程序集并将其放到开发客户端计算机上的方便位置。在设置使用 SharePoint Foundation 2010 托管客户端对象模型的项目时,必须通过浏览找到这两个程序集才能添加对它们的引用。
所以本题目正确选项应该是B.C
参考:
SharePoint 2010: Introducing the Client Object Model
http://www.chakkaradeep.com/post/SharePoint-2010-Introducing-the-Client-Object-Model.aspx
http://msdn.microsoft.com/zh-cn/library/ee857094(v=office.14).aspx
Question 130
You need to delete the previous versions of all documents in a document library.
The deleted versions of the documents must be retained in the SharePoint Recycle Bin.
What should you do?
A. For the document library, call the Recycle method.
B. For the document library, call the Delete method.
C. For each document, call the DeleteAll method of the Versions property.
D. For each document, call the RecycleAll method of the Versions property.
解析:
本题是想把被删除的某文档库中的文档保留在Sharepoint的回收箱中,在代码中如何实现。
直接来看各选项提供的相应方法:
选项A. For the document library, call the Recycle method. 此方法用于回收列表(Recycle the List),并返回被收回的列表的GUID。
选项B. For the document library, call the Delete method. 此方法用于删除列表(Delete the List)。
其中选项A.B均是基于SPDocumentLibrary类上的方法。
选项C. For each document, call the DeleteAll method of the Versions property. 此方法用于删除除了当前版本以外的所有的文档列表项。
选项D. For each document, call the RecycleAll method of the Versions property. 此方法用于回收除了当前版本以外的所有的文档列表项。
其中选项C.D均是基于SPListItemVersionCollection类上的方法。
Recycle与Delete的区别是:Recycle要进回收站,Delete则是直接删除掉,再也找不回来。
所以本题目正确选项应该是D
参考:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitemversioncollection.recycleall.aspx
http://msdn.microsoft.com/zh-cn/library/microsoft.sharepoint.splist.recycle(v=office.12).aspx
http://msdn.microsoft.com/zh-cn/library/microsoft.sharepoint.spdocumentlibrary_members(v=office.12).aspx