IWMSFileDescription.Type (C#)
Previous | Next |
IWMSFileDescription.Type (C#)
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.
This method requires the Network Service account to have read and browse access to the file being described.
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, WMS_FILE_TYPE.WMS_FILE_UNSPECIFIED); // Retrieve information associated with each description. for (int i = 0; i < FileDescriptions.Count; i++) { FileDescription = FileDescriptions[i]; WMS_FILE_TYPE ftType; ftType = FileDescription.Type; if (ftType == WMS_FILE_TYPE.WMS_FILE_UNSPECIFIED) { // TODO: Handle unknown file types. } if (ftType == WMS_FILE_TYPE.WMS_FILE_DIRECTORY) { // TODO: Handle directories. } if (ftType == WMS_FILE_TYPE.WMS_FILE_MEDIA) { // TODO: Handle media files. } if (ftType == WMS_FILE_TYPE.WMS_FILE_PLAYLIST) { // TODO: Handle playlist files. } if (ftType == WMS_FILE_TYPE.WMS_FILE_REMOTE_FILE) { // TODO: Handle remote files. } if (ftType == WMS_FILE_TYPE.WMS_FILE_STREAM_FORMAT) { // TODO: Handle stream format files. } } } catch (COMException comExc) { // TODO: Handle COM exceptions. } catch (Exception e) { // TODO: Handle exceptions. }
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 |