IWMSPublishingPoints.Clone (Visual Basic .NET)

banner art

Previous Next

IWMSPublishingPoints.Clone (Visual Basic .NET)

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

Syntax

  IWMSPublishingPoint = IWMSPublishingPoints.Clone(
  strDestName As String,
  pSrcPubPt As IWMSPublishingPoint
)

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.

If this method fails, it returns an error number.

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

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

Private Sub ClonePubPoint()

    ' 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

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)

    ' 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 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