IWMSPublishingPoints.ImportXML (Visual Basic .NET)

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

IWMSPublishingPoint = IWMSPublishingPoints.ImportXML(
  strNewPubPtName As String,
  strXMLFileName As String



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


[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 Value

This method returns the new IWMSPublishingPointIWMSPublishingPoint Object (Visual Basic .NET).

If this method fails, it returns an error number.




strNewPubPtName is already being used by another publishing point.


strNewPubPtName contains an invalid character. Invalid characters are: & " ' < > \ and the ANSI characters 0-31 and 127.


strNewPubPtName is longer than the maximum length allowed.


The ExportXML method, contained in the IWMSOnDemandPublishingPoint and IWMSBroadcastPublishingPoint objects, is 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 and .protocol://server_nameprotocol://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.


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


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

Private Sub CreatePubPoint()

    ' Declare variables.
    Dim Server As WMSServer
    Dim PubPoints As IWMSPublishingPoints
    Dim PubPoint As IWMSPublishingPoint
    Dim NewPubPoint As IWMSPublishingPoint
    Dim strName As String
    Dim strPath As String

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

    ' Retrieve the IWMSPublishingPoints object.
    PubPoints = Server.PublishingPoints

    ' 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 excCom As COMException
    ' TODO: Handle COM exceptions.
Catch exc As Exception
    ' TODO: Handle errors.
    ' TODO: Clean-up code goes here.
End Try

End Sub


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


IWMSPublishingPoints Object (Visual Basic .NET)