IWMSPublishingPoints.Add (C#)

The Add method creates a new IWMSPublishingPointIWMSPublishingPoint Object (C#) and adds it to the IWMSPublishingPoints collection.

IWMSPublishingPoint = IWMSPublishingPoints.Add(
  string  Name,
  WMS_PUBLISHING_POINT_CATEGORY  Category,
  string  Path
);

Arguments

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 Value

This method returns an IWMSPublishingPoint object.

If this method fails, it throws an exception.

Number

Description

0x80070057

The value specified for Category is invalid or that 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 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.

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

http://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

http://server/pubpoint

Stream from a station or publishing point on a version 4.1 server

http://server/stationname

http://server/pubpoint

Media file or playlist on a local or remote server

rtsp://server/pubpoint/movie.wmv

Playlist file from a Web server

http://server/playlist.asp

http://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

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

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

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