Paging Through Folder Children Items

The paging support is available in IT Hit WebDAV Server Engine for .NET v7.0 Beta and later versions.

The WebDAV Server Engine for .NET provides support for paging through the children items and sorting results. The client application can requesting a specified range of items with a specified sort conditions.

Detecting Paging Support

To determine server features the client application submits OPTIONS request to folder item. The WebDAV Server Engine v7.0 and later will always add 'paging' token to the DAV header to indicate paging support:

This code is part of WebDAV Server File System sample provided with IT Hit WebDAV Server Engine for .NET

                            
                        

Implementing Paging

The IItemCollectionAsync.GetChildrenAsync() method provides parameters for specifying number of items to skip before returning the the rest of items, number of items to return and sort columns list. Below you can see a sample GetChildrenAsync() method implementation for file system storage:

The code below is part of 'WebDAVServer.FileSystemStorage.AspNet' C# & VB samples provided with the SDK.

                            
                        

The code below is part of 'WebDAVServer.FileSystemStorage.AspNet' C# & VB samples provided with the SDK.

                            
                        

 Here is the description of each parameter :

  • offset - number of items to skip before returning the rest of the items.
  • nResults - number of items to return (page size). Note that on the last page the number of items may be smaller than specified in this parameter.
  • orderProps - list of sort order columns. You will sort your result set according to these rules before applying paging.

The GetChildrenAsync() function returns the PageResults class instance that contains list of items that corresponds to the requested page as well as a total number of items in the folder. Typically you will use the total number of items on the client side to calculate the number of pages available and to render pages links/buttons UI.

The total number of items is optional and can be null, as soon as in some systems determining a total number of items could consume resources or is not required.

In the Paging Through Children Items article you can find how to submit a paging request and implement paging using WebDAV Ajax Library.

Note that paging is an IT Hit WebDAV Server Engine specific feature and is not supported by most WebDAV Clients such as Windows Explorer/Mini re-director and Mac OS X Finder. They always request all items in the folder and offset, nResults and orderProps parameters will always be null when used with these clients.