Condividi tramite


Subfolders Property

Retrieves the collection of subfolders in this folder.

Syntax

[ coll = ] FeedFolder.Subfolders

Possible Values

coll Object that receives the collection.

The property is read-only. The property has no default value.

Remarks

The object returned from this property can be cast to IFeedsEnum.

Examples

The following Microsoft Visual Basic Scripting Edition (VBScript) example for Windows Script Host (WSH) demonstrates how to recursively search the Subfolders collection to return the total number of feeds.

Function CountFeeds(f)
   Dim total, i
   
   total = f.Feeds.Count
   For i = 1 To f.Subfolders.Count
      ' Recursively count the feeds in each subfolder
      total = total + CountFeeds(f.Subfolders.Item(i-1))
   Next
   
   CountFeeds = total
End Function

Set fm = CreateObject("Microsoft.FeedsManager")
WScript.Echo "Total Feeds: " & CountFeeds(fm.RootFolder)

The following example, written in C#, also demonstrates how to recursively search the Subfolders collection to return the total number of feeds. Note that the public entry point (which takes no arguments) passes the root folder to a private helper function of the same name.

using Microsoft.Feeds.Interop;
                
public static int AggregateFeedCount()
{
    IFeedsManager feedmgr = new FeedsManagerClass();
    return AggregateFeedCount((IFeedFolder)feedmgr.RootFolder);
}

private static int AggregateFeedCount(IFeedFolder folder)
{
    int i = ((IFeedsEnum)folder.Feeds).Count;
    
    foreach (IFeedFolder subfolder in (IFeedsEnum)folder.Subfolders)
        i += AggregateFeedCount(subfolder);

    return i;
}

Applies To

FeedFolder

See Also

Count, Feeds, GetSubfolder