IWMSPublishingPoints.Add (Visual Basic .NET)

banner art

Previous Next

IWMSPublishingPoints.Add (Visual Basic .NET)

The Add method creates a new IWMSPublishingPoint object and adds it to the IWMSPublishingPoints collection.

Syntax

  IWMSPublishingPoint = IWMSPublishingPoints.Add(
  Name As String, 
  Category As WMS_PUBLISHING_POINT_CATEGORY, 
  Path As String
)

Parameters

Name

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

Category

[in] Member of a WMS_PUBLISHING_POINT_CATEGORY enumeration specifying the type of the publishing point. This must be one of the following values. There is no default value.

Value Description
WMS_PUBLISHING_POINT_TYPE_ON_DEMAND Specifies an on-demand publishing point object.
WMS_PUBLISHING_POINT_TYPE_BROADCAST Specifies a broadcast publishing point object.

Path

[in] String containing the path to the content for the publishing point.

Return Values

This method returns an IWMSPublishingPoint object.

If this method fails, it returns an error number.

Number Description
0x80070057 The value specified for Category is invalid or Path is a zero-length string or NULL.
0xC00D0036L Name is already being used by another publishing point.
0xC00D1455L Name contains an invalid character. Invalid characters are: & " ' < > \ and the ANSI characters 0-31 and 127.
0xC00D1392L Name is longer than the maximum length allowed.

Remarks

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.

The path must start with an appropriate prefix to indicate the data source plug-in to use. The following table illustrates valid paths.

Path Example
Media file file:://C:\wmpub\wmroot\movie.wmv

file://\\server\directory\movie.wmv

Playlist file file:://C:\wmpub\wmroot\playlist.wsx

file://\\server\directory\playlist.wsx

Stream from an encoder https://encoder:port
Stream pushed to an encoder push:*
Content from a publishing point on a local server lpp://pubpoint/media.wmv
Stream from a publishing point on a local or remote server rtsp://server/pubpoint

https://server/pubpoint

Stream from a station or publishing point on a version 4.1 server https://server/stationname

https://server/pubpoint

Media file or playlist on a local or remote server rtsp://server/pubpoint/movie.wmv
Playlist file from a Web server https://server/playlist.asp

https://server/playlist.wsx

Directory of files file://C:\wmpub\wmroot\directory

When the server is installed, it creates a cache publishing point and a proxy publishing point. You cannot create or delete these.

Example Code

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

Private Sub AddPubPoint()

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

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

    ' 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, WMS_PUBLISHING_POINT_CATEGORY.WMS_PUBLISHING_POINT_BROADCAST, strPath)

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