IWMSFileDescriptions.length (C#)

banner art

Previous Next

IWMSFileDescriptions.length (C#)

The length property retrieves the number of file description objects contained in the collection.


  int = IWMSFileDescriptions.length;

Property Value

int containing the number of file description objects contained in the collection.


If the publishing point path references a playlist, the length property returns 1. It does not retrieve the number of media files referenced by the playlist.

This is the JScript version of the Count property. It is included for developers who are more comfortable with JScript syntax.

This property is read-only.

Example Code

using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer                   Server;
IWMSFileDescriptions        FileDescriptions;
IWMSFileDescription         FileDescription;

string                      strPath;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Retrieve the IWMSFileDescriptions object.
    strPath = "file://c:\\wmpub\\wmroot";
    FileDescriptions = Server.get_FileDescriptions(strPath,

    // Use the length property as an iteration boundary
    // when accessing individual objects in the collection.
    for (int i = 0; i < FileDescriptions.length; i++)
        // .
        FileDescription = FileDescriptions[i];
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
catch (Exception e) {
    // TODO: Handle exceptions.


Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows ServerĀ 2003 family, Windows ServerĀ 2008 family.

See Also

Previous Next