IFolder.GetChildren Method (Boolean, PropertyName[])

IT Hit WebDAV for .NET

Returns children of this folder together with custom properties.

[Visual Basic]
Function GetChildren( _
   ByVal recursively As Boolean, _
   ByVal names As PropertyName() _
) As IHierarchyItem()
[C#]
IHierarchyItem[] GetChildren(
   bool recursively,
   PropertyName[] names
);

Parameters

recursively
Indicates if all subtree of children should be returned.
names
Properties that will be retrieved for each item returned by this method.

Return Value

Array that include child folders and resources.

Remarks

Use this method if you would like to get known custom properties with each item returned by this method. For instance if you store item ID as a custom property you can retrieve the ID of each item with a single request to server.

Exceptions

Exception Type Condition
NotFoundException This folder doesn't exist on the server.
WebDavHttpException Server returned unknown error.
WebDavException Unexpected error occurred.

Example

The following example demonstrates how to get custom properties for all child items with a single request to server.

                
string license = "<?xml version='1.0' encoding='utf...
WebDavSession session = new WebDavSession(license);
session.Credentials = new NetworkCredential("User1", "pwd");

PropertyName[] propNames = new PropertyName[2];
propNames[0] = new PropertyName("MyID", "Sales");
propNames[1] = new PropertyName("Branch", "Sales");

IFolder folder = session.OpenFolder( new Uri("http://server:8080/"));
IHierarchyItem[] children = folder.GetChildren(false, propNames);
foreach (IHierarchyItem item in children)
{
    Console.WriteLine(item.DisplayName);
    foreach(Property prop in item.Properties)
    {
        Console.WriteLine(prop.Name.NamespaceUri + ":" + prop.Name.Name + " " + prop.StringValue);
    }
}
                
            

See Also

IFolder Interface | ITHit.WebDAV.Client Namespace | IFolder.GetChildren Overload List