Share via


IWMSFileDescription.Type (Visual Basic .NET)

banner art

Previous Next

IWMSFileDescription.Type (Visual Basic .NET)

The Type property retrieves an enumeration value that indicates whether the IWMSFileDescription object describes a directory, a media file, or a playlist file.

Syntax

  WMS_FILE_TYPE = IWMSFileDescription.Type

Property Value

A member of a WMS_FILE_TYPE enumeration type indicating what the IWMSFileDescription object describes. This must be one of the following values.

Value Description
WMS_FILE_DIRECTORY Indicates a directory.
WMS_FILE_MEDIA Indicates a media file, such as a file with a .wma file name extension.
WMS_FILE_PLAYLIST Indicates a playlist file, such as a file with an .asx file name extension.
WMS_FILE_REMOTE_FILE Indicates a remote file.
WMS_FILE_STREAM_FORMAT The item is a stream format file, such as a file with an .nsc. file name extension.
WMS_FILE_UNSPECIFIED The file type is unknown or unspecified.

Remarks

This property is read-only.

Example Code

Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices

Private Sub GetFileType()

    ' Declare variables.
    Dim Server As WMSServer
    Dim FileDescriptions As IWMSFileDescriptions
    Dim FileDescription As IWMSFileDescription
    Dim strPath As String
    Dim ftType As WMS_FILE_TYPE

Try
    ' Create the WMSServer object.
    Server = New WMSServer()

    ' Retrieve the IWMSFileDescriptions object.
    strPath = "file://c:\wmpub\wmroot"
    FileDescriptions = Server.FileDescriptions(strPath, WMS_FILE_TYPE.WMS_FILE_UNSPECIFIED)

    ' Retrieve information associated with each description.
    For Each FileDescription In FileDescriptions

        ftType = FileDescription.Type
        If ftType = WMS_FILE_TYPE.WMS_FILE_UNSPECIFIED Then
            ' TODO: Handle unknown file types.
        End If

        If ftType = WMS_FILE_TYPE.WMS_FILE_DIRECTORY Then
            ' TODO: Handle directories.
        End If

        If ftType = WMS_FILE_TYPE.WMS_FILE_MEDIA Then
            ' TODO: Handle media files.
        End If

        If ftType = WMS_FILE_TYPE.WMS_FILE_PLAYLIST Then
            ' TODO: Handle playlist files.
        End If

        If ftType = WMS_FILE_TYPE.WMS_FILE_REMOTE_FILE Then
            ' TODO: Handle remote files.
        End If

        If ftType = WMS_FILE_TYPE.WMS_FILE_STREAM_FORMAT Then
            ' TODO: Handle stream format files.
        End If

    Next

Catch excCom As COMException
    ' TODO: Handle COM exceptions.
Catch exc As Exception
    ' TODO: Handle errors.
Finally
    ' TODO: Clean-up code goes here.
End Try

End Sub

Requirements

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