IFolderAsync.GetChildrenAsync Method (Boolean,PropertyName[])
IT Hit WebDAV Classes Reference
Returns children of this folder together with custom properties.
Namespace:
ITHit.WebDAV.Client
Assembly:
ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll) Version: 2.0.420.0
Syntax Task<IHierarchyItemAsync[]> GetChildrenAsync(
bool recursively,
PropertyName[] names
)
Function GetChildrenAsync (
recursively As Boolean,
names As PropertyName()
) As Task(Of IHierarchyItemAsync())
Task<array<IHierarchyItemAsync^>^>^ GetChildrenAsync(
bool recursively,
array<PropertyName^>^ names
)
abstract GetChildrenAsync :
recursively : bool *
names : PropertyName[] -> Task<IHierarchyItemAsync[]>
Parameters
- recursively
- Type: System.Boolean
Indicates if all subtree of children should be returned. - names
- Type:ITHit.WebDAV.Client.PropertyName[]
Properties that will be retrieved for each item returned by this method.
Return Value
Type:
Task<IHierarchyItemAsync[]>Array that include child folders and files.
Exceptions 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.
Examples
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...
WebDavSessionAsync session = new WebDavSessionAsync(license);
session.Credentials = new NetworkCredential("User1", "pwd");
PropertyName[] propNames = new PropertyName[2];
propNames[0] = new PropertyName("MyID", "Sales");
propNames[1] = new PropertyName("Branch", "Sales");
IFolderAsync folder = await session.OpenFolderAsync( new Uri("http://server:8080/"));
IHierarchyItemAsync[] children = await folder.GetChildrenAsync(false, propNames);
foreach (IHierarchyItemAsync 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