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.aspxweb
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.aspxapp
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.dllpost
解析:
本題是想創建一個基於.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 Files\Microsoft Shared\web server extensions\14\ISAPI
對於 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).aspxui
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.spa
解析:
本題是想把被刪除的某文檔庫中的文檔保留在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設計