.NET Server

Upgrading Your Server Implementation to WebDAV Server Engine .NET v7

In this article

Upgrading Your Server Implementation to WebDAV Server Engine .NET v7

IT Hit WebDAV Server Engine v7 provides methods for requesting a specified range of items when listing folder content and searching. You can also specify specify sort conditions when listing folder content.

Interfaces Changes

The IItemCollectionAsync.GetChildrenAsync() method and IFolderAsync.SearchAsync() method now provide new parameters for specifying number of items to skip before returning the rest of the items (offset) and a number of items to return (page size). The GetChildrenAsync() function also provides a parameter to pass sorting conditions (sort columns). It also has a different return type: PageResults class which contains items that correspond to the requested range and sorting as well as the total number of items in a folder.

Upgrading Your Code

To upgrade your server follow these steps:

  1. Update the ITHit.WebDAV.Server package. Reference a new packages from NuGet or from IT Hit WebDAV Server Engine for .NET SDK install folder (by default C:\Program Files (x86)\IT Hit\WebDAV Server Engine\<version>\Server\bin\).

    After upgrade your server DAV header will advertise paging support:

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

                                
                            

    Now the WebDAV Ajax Library v5.8 or later can detect paging support. You can use the WebDAV Ajax Library to make paging requests and build paging UI. See Implementing Paging Through Folder Children Items and Search Results article for more details.

  2. Update your GetChildrenAsync() method. Replace your GetChildrenAsync() method:

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

                                
                            

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

                                
                            

    with a new method:

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

                                
                            

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

                                
                            

    You need to add 3 new parameters and change the return type.

    See how to implement paging in the Implementing Paging Through Folder Children Items and Search Results article.

    Note that if you do not need the paging support you can just ignore new parameters and leave your existing implementation. The only change you need to make is to modify the return object to be PageResults type. Pass list of items that you previously were returning from GetChildrenAsync() method to PageResults constructor:

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

                                
                            

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

                                
                            
  3. Update your SearchAsync() method. Replace SearchAsync() method:

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

                                
                            

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

                                
                            

    with:

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

                                
                            

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

                                
                            

    You need to add 2 new parameters and change the return type. As with GetChildrenAsync() method, if you do not need paging, you can ignore new parameters and pass the list of search results and total number of items in results directly to PageResults object constructor:

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

                                
                            

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

                                
                            

 

See Also:

Next Article:

Upgrading Your Server Implementation to WebDAV Server Engine .NET v6