IWMSFileDescriptions.CreateDataSourceDirectory (C#)

banner art

Previous Next

IWMSFileDescriptions.CreateDataSourceDirectory (C#)

The CreateDataSourceDirectory method creates a new directory at the specified path, which can be used to store content.

Syntax

  IWMSFileDescriptions
  .CreateDataSourceDirectory(
  string  strPath 
);

Parameters

strPath

[in] string containing the path and directory to create.

Return Values

This method does not return a value.

If this method fails, it throws an exception.

Number Description
0x8007000E There is insufficient memory to complete the function.
0xC00D1580L The data source plug-in that the server is attempting to use to access the path referenced by strPath does not support enumeration of files.
0xC00D157EL The server was not able to find a data source plug-in to access the path referenced by strPath.

Remarks

This method requires the Network Service account to have write and browse access to the specified path.

Example Code

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

// Declare variables.
WMSServer                   Server;
IWMSFileDescriptions        FileDescriptions;

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);

    // Create a new directory.
    strPath = "file://c:\\wmpub\\wmroot\\New Directory\\";
    FileDescriptions.CreateDataSourceDirectory (strPath);
}
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