4.2.3 Retrieve a Collection of Entities with an Inline Count

The following example illustrates the exchange of messages required for a client to retrieve all Employee list items from a data service and to instruct it to include the count of items retrieved in the response using the AtomPub format.

HTTP Request:

 GET /_vti_bin/ListData.svc/Employees?$inlinecount=allpages HTTP/1.1
 Accept: application/atom+xml
 Host: www.contoso.com

HTTP Response:

 HTTP/1.1 200 OK
 Cache-Control: no-cache
 Content-Type: application/atom+xml;charset=utf-8
 Server: Microsoft-IIS/7.0
 SPRequestGuid: d08f639f-59f9-451d-b09a-f4d073914262
 DataServiceVersion: 2.0;
 X-AspNet-Version: 2.0.50727
 Set-Cookie: SDA_Callback=05/01/2009 12:36:35; expires=Fri, 01-May-2009 19:46:35 GMT; path=/
 Set-Cookie: WSS_KeepSessionAuthenticated={afbe7ca4-c701-4f7d-9021-25cab947ae3f}; path=/
 X-Powered-By: ASP.NET
 MicrosoftSharePointTeamServices: 14.0.0.4006
 Date: Fri, 01 May 2009 19:36:50 GMT
 Content-Length: ###
  
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <feed xml:base="http://www.contoso.com/_vti_bin/ListData.svc/" 
   xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" 
   xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" 
   xmlns="http://www.w3.org/2005/Atom">
   <title type="text">Employees</title>
   <id>http://www.contoso.com/_vti_bin/ListData.svc/Employees</id>
   <updated>2009-05-01T19:36:50Z</updated>
   <link rel="self" title="Employees" href="Employees" />
   <m2:count xmlns:m2="http://schemas.microsoft.com/ado/2008/11/dataservices/metadata">
     10
   </m2:count>
   <entry m:etag="W/&quot;1&quot;">
     <id>http://www.contoso.com/_vti_bin/ListData.svc/Employees(1)</id>
     <title type="text">Margeret Smith</title>
     <updated>2009-05-01T19:36:50Z</updated>
     <author>
       <name />
     </author>
     <link rel="edit" title="EmployeesItem" href="Employees(1)" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Projects" 
       type="application/atom+xml;type=feed" title="Projects" 
       href="Employees(1)/Projects" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CreatedBy" 
       type="application/atom+xml;type=entry" title="CreatedBy" 
       href="Employees(1)/CreatedBy" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ModifiedBy" 
       type="application/atom+xml;type=entry" title="ModifiedBy" 
       href="Employees(1)/ModifiedBy" />
     <category term="Microsoft.SharePoint.DataService.EmployeesItem" 
       scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
     <content type="application/xml">
       <m:properties>
         <d:FullName>Margeret Smith</d:FullName>
         <d:Salary m:type="Edm.Double">75000</d:Salary>
         <d:HireDate m:type="Edm.DateTime">1984-01-07T00:00:00</d:HireDate>
         <d:ID m:type="Edm.Int32">1</d:ID>
         <d:Modified m:type="Edm.DateTime">2009-05-01T12:21:21</d:Modified>
         <d:Created m:type="Edm.DateTime">2009-05-01T12:21:21</d:Created>
         <d:Owshiddenversion m:type="Edm.Int32">1</d:Owshiddenversion>
         <d:Version>1.0</d:Version>
         <d:Path>/Lists/Employees</d:Path>
       </m:properties>
     </content>
   </entry>
   <entry m:etag="W/&quot;1&quot;">
     <id>http://www.contoso.com/_vti_bin/ListData.svc/Employees(2)</id>
     <title type="text">Sean Jacobson</title>
     <updated>2009-05-01T19:36:50Z</updated>
     <author>
       <name />
     </author>
     <link rel="edit" title="EmployeesItem" href="Employees(2)" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Projects" 
       type="application/atom+xml;type=feed" title="Projects" 
       href="Employees(2)/Projects" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CreatedBy" 
       type="application/atom+xml;type=entry" title="CreatedBy" 
       href="Employees(2)/CreatedBy" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ModifiedBy" 
       type="application/atom+xml;type=entry" title="ModifiedBy" 
       href="Employees(2)/ModifiedBy" />
     <category term="Microsoft.SharePoint.DataService.EmployeesItem"  
       scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
     <content type="application/xml">
       <m:properties>
         <d:FullName>Sean Jacobson</d:FullName>
         <d:Salary m:type="Edm.Double">92000</d:Salary>
         <d:HireDate m:type="Edm.DateTime">1974-06-20T00:00:00</d:HireDate>
         <d:ID m:type="Edm.Int32">2</d:ID>
         <d:Modified m:type="Edm.DateTime">2009-05-01T12:21:21</d:Modified>
         <d:Created m:type="Edm.DateTime">2009-05-01T12:21:21</d:Created>
         <d:Owshiddenversion m:type="Edm.Int32">1</d:Owshiddenversion>
         <d:Version>1.0</d:Version>
         <d:Path>/Lists/Employees</d:Path>
       </m:properties>
     </content>
   </entry>
   <entry m:etag="W/&quot;1&quot;">
     <id>http://www.contoso.com/_vti_bin/ListData.svc/Employees(3)</id>
     <title type="text">Alex Gurthner</title>
     <updated>2009-05-01T19:36:50Z</updated>
     <author>
       <name />
     </author>
     <link rel="edit" title="EmployeesItem" href="Employees(3)" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Projects" 
       type="application/atom+xml;type=feed" title="Projects" 
       href="Employees(3)/Projects" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CreatedBy" 
       type="application/atom+xml;type=entry" title="CreatedBy" 
       href="Employees(3)/CreatedBy" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ModifiedBy" 
       type="application/atom+xml;type=entry" title="ModifiedBy" 
       href="Employees(3)/ModifiedBy" />
     <category term="Microsoft.SharePoint.DataService.EmployeesItem" 
       scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
     <content type="application/xml">
       <m:properties>
         <d:FullName>Alex Gurthner</d:FullName>
         <d:Salary m:type="Edm.Double">68000</d:Salary>
         <d:HireDate m:type="Edm.DateTime">1990-10-14T00:00:00</d:HireDate>
         <d:ID m:type="Edm.Int32">3</d:ID>
         <d:Modified m:type="Edm.DateTime">2009-05-01T12:21:21</d:Modified>
         <d:Created m:type="Edm.DateTime">2009-05-01T12:21:21</d:Created>
         <d:Owshiddenversion m:type="Edm.Int32">1</d:Owshiddenversion>
         <d:Version>1.0</d:Version>
         <d:Path>/Lists/Employees</d:Path>
       </m:properties>
     </content>
   </entry>
   <entry m:etag="W/&quot;1&quot;">
     <id>http://www.contoso.com/_vti_bin/ListData.svc/Employees(4)</id>
     <title type="text">Phyllis Allen</title>
     <updated>2009-05-01T19:36:50Z</updated>
     <author>
       <name />
     </author>
     <link rel="edit" title="EmployeesItem" href="Employees(4)" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Projects" 
       type="application/atom+xml;type=feed" title="Projects" 
       href="Employees(4)/Projects" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CreatedBy" 
       type="application/atom+xml;type=entry" title="CreatedBy" 
       href="Employees(4)/CreatedBy" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ModifiedBy" 
       type="application/atom+xml;type=entry" title="ModifiedBy" 
       href="Employees(4)/ModifiedBy" />
     <category term="Microsoft.SharePoint.DataService.EmployeesItem" 
       scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
     <content type="application/xml">
       <m:properties>
         <d:FullName>Phyllis Allen</d:FullName>
         <d:Salary m:type="Edm.Double">108000</d:Salary>
         <d:HireDate m:type="Edm.DateTime">1975-03-28T00:00:00</d:HireDate>
         <d:ID m:type="Edm.Int32">4</d:ID>
         <d:Modified m:type="Edm.DateTime">2009-05-01T12:21:21</d:Modified>
         <d:Created m:type="Edm.DateTime">2009-05-01T12:21:21</d:Created>
         <d:Owshiddenversion m:type="Edm.Int32">1</d:Owshiddenversion>
         <d:Version>1.0</d:Version>
         <d:Path>/Lists/Employees</d:Path>
       </m:properties>
     </content>
   </entry>
   <entry m:etag="W/&quot;1&quot;">
     <id>http://www.contoso.com/_vti_bin/ListData.svc/Employees(5)</id>
     <title type="text">Carol Beck</title>
     <updated>2009-05-01T19:36:50Z</updated>
     <author>
       <name />
     </author>
     <link rel="edit" title="EmployeesItem" href="Employees(5)" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Projects" 
       type="application/atom+xml;type=feed" title="Projects" 
       href="Employees(5)/Projects" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CreatedBy" 
       type="application/atom+xml;type=entry" title="CreatedBy" 
       href="Employees(5)/CreatedBy" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ModifiedBy" 
       type="application/atom+xml;type=entry" title="ModifiedBy" 
       href="Employees(5)/ModifiedBy" />
     <category term="Microsoft.SharePoint.DataService.EmployeesItem" 
       scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
     <content type="application/xml">
       <m:properties>
         <d:FullName>Carol Beck</d:FullName>
         <d:Salary m:type="Edm.Double">88000</d:Salary>
         <d:HireDate m:type="Edm.DateTime">1989-08-11T00:00:00</d:HireDate>
         <d:ID m:type="Edm.Int32">5</d:ID>
         <d:Modified m:type="Edm.DateTime">2009-05-01T12:21:21</d:Modified>
         <d:Created m:type="Edm.DateTime">2009-05-01T12:21:21</d:Created>
         <d:Owshiddenversion m:type="Edm.Int32">1</d:Owshiddenversion>
         <d:Version>1.0</d:Version>
         <d:Path>/Lists/Employees</d:Path>
       </m:properties>
     </content>
   </entry>
   <entry m:etag="W/&quot;1&quot;">
     <id>http://www.contoso.com/_vti_bin/ListData.svc/Employees(6)</id>
     <title type="text">Willie Brooks</title>
     <updated>2009-05-01T19:36:50Z</updated>
     <author>
       <name />
     </author>
     <link rel="edit" title="EmployeesItem" href="Employees(6)" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Projects" 
       type="application/atom+xml;type=feed" title="Projects" 
       href="Employees(6)/Projects" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CreatedBy"  
       type="application/atom+xml;type=entry" title="CreatedBy" 
       href="Employees(6)/CreatedBy" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ModifiedBy" 
       type="application/atom+xml;type=entry" title="ModifiedBy" 
       href="Employees(6)/ModifiedBy" />
     <category term="Microsoft.SharePoint.DataService.EmployeesItem" 
       scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
     <content type="application/xml">
       <m:properties>
         <d:FullName>Willie Brooks</d:FullName>
         <d:Salary m:type="Edm.Double">95000</d:Salary>
         <d:HireDate m:type="Edm.DateTime">1983-02-06T00:00:00</d:HireDate>
         <d:ID m:type="Edm.Int32">6</d:ID>
         <d:Modified m:type="Edm.DateTime">2009-05-01T12:21:21</d:Modified>
         <d:Created m:type="Edm.DateTime">2009-05-01T12:21:21</d:Created>
         <d:Owshiddenversion m:type="Edm.Int32">1</d:Owshiddenversion>
         <d:Version>1.0</d:Version>
         <d:Path>/Lists/Employees</d:Path>
       </m:properties>
     </content>
   </entry>
   <entry m:etag="W/&quot;1&quot;">
     <id>http://www.contoso.com/_vti_bin/ListData.svc/Employees(7)</id>
     <title type="text">Isaiah Morgan</title>
     <updated>2009-05-01T19:36:50Z</updated>
     <author>
       <name />
     </author>
     <link rel="edit" title="EmployeesItem" href="Employees(7)" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Projects" 
       type="application/atom+xml;type=feed" title="Projects" 
       href="Employees(7)/Projects" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CreatedBy" 
       type="application/atom+xml;type=entry" title="CreatedBy" 
       href="Employees(7)/CreatedBy" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ModifiedBy" 
       type="application/atom+xml;type=entry" title="ModifiedBy" 
       href="Employees(7)/ModifiedBy" />
     <category term="Microsoft.SharePoint.DataService.EmployeesItem" 
       scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
     <content type="application/xml">
       <m:properties>
         <d:FullName>Isaiah Morgan</d:FullName>
         <d:Salary m:type="Edm.Double">74000</d:Salary>
         <d:HireDate m:type="Edm.DateTime">2003-12-21T00:00:00</d:HireDate>
         <d:ID m:type="Edm.Int32">7</d:ID>
         <d:Modified m:type="Edm.DateTime">2009-05-01T12:21:21</d:Modified>
         <d:Created m:type="Edm.DateTime">2009-05-01T12:21:21</d:Created>
         <d:Owshiddenversion m:type="Edm.Int32">1</d:Owshiddenversion>
         <d:Version>1.0</d:Version>
         <d:Path>/Lists/Employees</d:Path>
       </m:properties>
     </content>
   </entry>
   <entry m:etag="W/&quot;1&quot;">
     <id>http://www.contoso.com/_vti_bin/ListData.svc/Employees(8)</id>
     <title type="text">Leslie Rubio</title>
     <updated>2009-05-01T19:36:50Z</updated>
     <author>
       <name />
     </author>
     <link rel="edit" title="EmployeesItem" href="Employees(8)" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Projects" 
       type="application/atom+xml;type=feed" title="Projects" 
       href="Employees(8)/Projects" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CreatedBy" 
       type="application/atom+xml;type=entry" title="CreatedBy" 
       href="Employees(8)/CreatedBy" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ModifiedBy" 
       type="application/atom+xml;type=entry" title="ModifiedBy" 
       href="Employees(8)/ModifiedBy" />
     <category term="Microsoft.SharePoint.DataService.EmployeesItem" 
       scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
     <content type="application/xml">
       <m:properties>
         <d:FullName>Leslie Rubio</d:FullName>
         <d:Salary m:type="Edm.Double">82000</d:Salary>
         <d:HireDate m:type="Edm.DateTime">1976-01-23T00:00:00</d:HireDate>
         <d:ID m:type="Edm.Int32">8</d:ID>
         <d:Modified m:type="Edm.DateTime">2009-05-01T12:21:21</d:Modified>
         <d:Created m:type="Edm.DateTime">2009-05-01T12:21:21</d:Created>
         <d:Owshiddenversion m:type="Edm.Int32">1</d:Owshiddenversion>
         <d:Version>1.0</d:Version>
         <d:Path>/Lists/Employees</d:Path>
       </m:properties>
     </content>
   </entry>
   <entry m:etag="W/&quot;1&quot;">
     <id>http://www.contoso.com/_vti_bin/ListData.svc/Employees(9)</id>
     <title type="text">Zachary Martin</title>
     <updated>2009-05-01T19:36:50Z</updated>
     <author>
       <name />
     </author>
     <link rel="edit" title="EmployeesItem" href="Employees(9)" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Projects" 
       type="application/atom+xml;type=feed" title="Projects" 
       href="Employees(9)/Projects" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CreatedBy" 
       type="application/atom+xml;type=entry" title="CreatedBy" 
       href="Employees(9)/CreatedBy" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ModifiedBy" 
       type="application/atom+xml;type=entry" title="ModifiedBy" 
       href="Employees(9)/ModifiedBy" />
     <category term="Microsoft.SharePoint.DataService.EmployeesItem" 
       scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
     <content type="application/xml">
       <m:properties>
         <d:FullName>Zachary Martin</d:FullName>
         <d:Salary m:type="Edm.Double">112000</d:Salary>
         <d:HireDate m:type="Edm.DateTime">1974-08-15T00:00:00</d:HireDate>
         <d:ID m:type="Edm.Int32">9</d:ID>
         <d:Modified m:type="Edm.DateTime">2009-05-01T12:21:21</d:Modified>
         <d:Created m:type="Edm.DateTime">2009-05-01T12:21:21</d:Created>
         <d:Owshiddenversion m:type="Edm.Int32">1</d:Owshiddenversion>
         <d:Version>1.0</d:Version>
         <d:Path>/Lists/Employees</d:Path>
       </m:properties>
     </content>
   </entry>
   <entry m:etag="W/&quot;1&quot;">
     <id>http://www.contoso.com/_vti_bin/ListData.svc/Employees(10)</id>
     <title type="text">Kathleen Gill</title>
     <updated>2009-05-01T19:36:50Z</updated>
     <author>
       <name />
     </author>
     <link rel="edit" title="EmployeesItem" href="Employees(10)" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Projects" 
       type="application/atom+xml;type=feed" title="Projects" 
       href="Employees(10)/Projects" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CreatedBy" 
       type="application/atom+xml;type=entry" title="CreatedBy" 
       href="Employees(10)/CreatedBy" />
     <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ModifiedBy" 
       type="application/atom+xml;type=entry" title="ModifiedBy" 
       href="Employees(10)/ModifiedBy" />
     <category term="Microsoft.SharePoint.DataService.EmployeesItem" 
       scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
     <content type="application/xml">
       <m:properties>
         <d:FullName>Kathleen Gill</d:FullName>
         <d:Salary m:type="Edm.Double">102000</d:Salary>
         <d:HireDate m:type="Edm.DateTime">1989-03-22T00:00:00</d:HireDate>
         <d:ID m:type="Edm.Int32">10</d:ID>
         <d:Modified m:type="Edm.DateTime">2009-05-01T12:21:21</d:Modified>
         <d:Created m:type="Edm.DateTime">2009-05-01T12:21:21</d:Created>
         <d:Owshiddenversion m:type="Edm.Int32">1</d:Owshiddenversion>
         <d:Version>1.0</d:Version>
         <d:Path>/Lists/Employees</d:Path>
       </m:properties>
     </content>
   </entry>
 </feed>