Click or drag to resize

IItemCollectionGetChildren Method

IT Hit WebDAV Classes Reference
Gets direct children of this folder.

Namespace: ITHit.WebDAV.Server
Assembly: ITHit.WebDAV.Server (in ITHit.WebDAV.Server.dll) Version: 4.5.3121.0
Syntax
IEnumerable<IHierarchyItem> GetChildren(
	IList<PropertyName> propNames
)

Parameters

propNames
Type: System.Collections.GenericIListPropertyName
List of properties requested by the client.

Return Value

Type: IEnumerableIHierarchyItem
IEnumerableT with IHierarchyItem items. Each item is a file or folder item.
Examples

The code below is part of 'WebDAVServer.NtfsStorage' sample provided with the SDK.

public virtual IEnumerable<IHierarchyItem> GetChildren(IList<PropertyName> propNames)
{
    // Enumerates all child files and folders.
    // You can filter children items in this implementation and 
    // return only items that you want to be visible for this 
    // particular user.

    IList<IHierarchyItem> children = new List<IHierarchyItem>();

    FileSystemInfo[] fileInfos =
        context.FileOperation(
            this,
            () => dirInfo.GetFileSystemInfos(),
            Privilege.Read);

    foreach (FileSystemInfo fileInfo in fileInfos)
    {
        string childPath = Path + EncodeUtil.EncodeUrlPart(fileInfo.Name);
        IHierarchyItem child = context.GetHierarchyItem(childPath);
        if (child != null)
        {
            children.Add(child);
        }
    }

    return children;
}
See Also