IWMSPublishingPoints.ImportXML (C#)

banner art

Previous Next

IWMSPublishingPoints.ImportXML (C#)

The ImportXML method creates a new publishing point using the configuration data specified in an XML file.

Syntax

  IWMSPublishingPoint = IWMSPublishingPoints.ImportXML(
  string  strNewPubPtName,
  string  strXMLFileName 
);

Parameters

strNewPubPtName

[in] string containing the name of the publishing point to be created. The maximum length is 250 characters.

strXMLFileName

[in] string containing the name of the object to write the XML data to. This can be a file, console, communication resource, or a named pipe.

Return Values

This method returns the new IWMSPublishingPoint object.

If this method fails, it throws an exception.

Number Description
0xC00D0036L strNewPubPtName is already being used by another publishing point.
0xC00D1455L strNewPubPtName contains an invalid character. Invalid characters are: & " ' < > \ and the ANSI characters 0-31 and 127.
0xC00D1392L strNewPubPtName is longer than the maximum length allowed.

Remarks

The IWMSOnDemandPublishingPoint.ExportXML and IWMSBroadcastPublishingPoint.ExportXML methods are used to create this file for both an on-demand publishing point and a broadcast publishing point.

The name of the publishing point must be unique. You can indicate the home publishing point by specifying only the forward slash character (/). There can be only one home publishing point, and it can be either a broadcast or on-demand publishing point. A home publishing point is not mandatory, but it enables clients to connect using the shorter URL formats such as protocol://server_name and protocol://server_name/file_name.

Any other publishing point names must not contain a leading or trailing /, but a / character is permitted in the middle of a name. The following characters are not permitted:

< > \ ? % & '  # { } | ^ [ ] ` *

White spaces are permitted in the name, but the server will strip leading and trailing white spaces.

Because the ImportXML method uses the Windows CreateFile() function, all restrictions that apply when setting the name for that function apply to the ImportXML method.

  • Note   When a file name without a path is specified for the strXMLFileName parameter, the server will try to access the file located in the %systemroot%\system32 directory.

Example Code

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

// Declare variables.
WMSServer              Server;
IWMSPublishingPoints   PubPoints;
IWMSPublishingPoint    PubPoint;
IWMSPublishingPoint    NewPubPoint;

string                 strName;
string                 strPath;

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

    // Retrieve the IWMSPublishingPoints object.
    PubPoints = Server.PublishingPoints;

    // Add a new publishing point to the server.
    strName = "New Pub Point";
    strPath = "c:\\wmpub\\wmroot\\";
    PubPoint = PubPoints.Add(strName,
             ,
             strPath);

    // Create a new publishing point from an
    // exported XML file.
    strName = "New Pub Point Name";
    strPath = "c:\\wmpub\\wmroot\\pubpoint.xml";
    NewPubPoint = PubPoints.ImportXML(strName, 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