IFolderGetChildrenAsync Method
IT Hit WebDAV Classes Reference
Returns children of this folder.
Namespace:
ITHit.WebDAV.Client
Assembly:
ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll) Version: 6.0.4052-Beta
Syntax Task<IHierarchyItem[]> GetChildrenAsync(
bool recursively = false,
PropertyName[] names = null,
IDictionary<string, string> headers = null,
CancellationToken cancellationToken = null
)
Function GetChildrenAsync (
Optional recursively As Boolean = false,
Optional names As PropertyName() = Nothing,
Optional headers As IDictionary(Of String, String) = Nothing,
Optional cancellationToken As CancellationToken = Nothing
) As Task(Of IHierarchyItem())
Task<array<IHierarchyItem^>^>^ GetChildrenAsync(
bool recursively = false,
array<PropertyName^>^ names = nullptr,
IDictionary<String^, String^>^ headers = nullptr,
CancellationToken cancellationToken = nullptr
)
abstract GetChildrenAsync :
?recursively : bool *
?names : PropertyName[] *
?headers : IDictionary<string, string> *
?cancellationToken : CancellationToken
(* Defaults:
let _recursively = defaultArg recursively false
let _names = defaultArg names null
let _headers = defaultArg headers null
let _cancellationToken = defaultArg cancellationToken null
*)
-> Task<IHierarchyItem[]>
Parameters
- recursively (Optional)
- Type: SystemBoolean
Indicates if all subtree of children should be returned. - names (Optional)
- Type: ITHit.WebDAV.ClientPropertyName
Properties that will be retrieved for each item returned by this method. - headers (Optional)
- Type: System.Collections.GenericIDictionaryString, String
Request headers. - cancellationToken (Optional)
- Type: System.ThreadingCancellationToken
Propagates notification that operations should be canceled.
Return Value
Type:
TaskIHierarchyItemArray 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");
IFolder folder = await session.GetFolderAsync( new Uri("https://server:8080/"));
IHierarchyItem[] children = await folder.GetChildrenAsync(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