Share via


IWMSPublishingPoints.Clone (C#)

banner art

Previous Next

IWMSPublishingPoints.Clone (C#)

The Clone method creates a duplicate instance of a specific IWMSPublishingPoint object.

Syntax

  IWMSPublishingPoint = IWMSPublishingPoints.Clone(
  string  strDestName,
  IWMSPublishingPoint  pSrcPubPt
);

Parameters

strDestName

[in] string that contains the name of a publishing point to be duplicated. The maximum length for this string is 250 characters.

pSrcPubPt

[in] IWMSPublishingPoint object to copy.

Return Values

This method returns an IWMSPublishingPoint object.

If this method fails, it throws an exception.

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

Remarks

When a publishing point is cloned, properties of plug-ins on the new publishing point may need to be adjusted to avoid conflicts. For example, when cloning a broadcast publishing point on which a multicast data sink plug-in is enabled, values such as the multicast address will need to be changed if the multicast data sink IP address is specified manually. In addition, all plug-ins that were enabled on the publishing point that was cloned will also be enabled on the cloned publishing point. All plug-ins in the cloned publishing point that have the WMS_PLUGIN_REMOVE_ON_SERVICE_RESTART flag set in their Status property will not show up in the new publishing point.

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

    // Clone the newly added publishing point.
    // Note: Plug-ins must be re-enabled on the clone.
    strName = "Cloned Pub Point";
    NewPubPoint = PubPoints.Clone(strName, PubPoint);
}
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