Share via


Setting the Wrapper Path for the Default Publishing Point

The following examples illustrate how to set the wrapper path for the default on-demand publishing point. Because you cannot assume that the default publishing point will be the first object in the publishing point collection, you must loop through the collection to find it.

Visual Basic .NET Example

Imports Microsoft.WindowsMediaServices.Interop
Imports interop_msxml

Private Sub SetWrapperPath()

  ' Declare variables.
  Dim Server As WMSServer
  Dim PubPoint As IWMSPublishingPoint
  Dim I As Integer

  Try
    ' Create a new WMSServer object.
    Server = New WMSServer()

    ' Assign the wrapper playlist to the default on-demand
    ' publishing point identified by a forward slash (/).
    PubPoint = Server.PublishingPoints("/")
    PubPoint.WrapperPath = "c:\wmpub\wmroot\PlylstWrap.wsx"

    Catch Err As Exception
      ' TODO: Exception handler goes here.

    Finally
      ' TODO: Clean-up code goes here.

    End Try

End Sub

C# Example

using Microsoft.WindowsMediaServices.Interop;
using interop_msxml;

// Declare variables.
WMSServer server;
IWMSPublishingPoint pubpoint;

try
{
  // Create a new WMSServer object.
  server = new WMSServer();

  // Assign the wrapper playlist to the default on-demand
  // publishing point identified by a forward slash (/).
  pubpoint = server.PublishingPoints["/"];
  pubpoint.WrapperPath = "C:\\WMPub\\WMRoot\\PlylstWrap.wsx";
}

catch(Exception)
{
  // TODO: Exception handler goes here.
}

finally
{
  // TODO: Clean-up code goes here.
}

C++ Example

// Include header files.
#include <windows.h>
#include <atlbase.h>    // Includes CComBSTR and CComVariant.
#include "wmsserver.h"

// Declare variables and interfaces.
IWMSServer              *pServer;
IWMSPublishingPoints    *pPubPoints;
IWMSPublishingPoint     *pPubPoint;
CComVariant              varIndex;
CComBSTR                 bstrPath;
HRESULT                  hr;

// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
if (FAILED(hr)) goto EXIT;

hr = CoCreateInstance(CLSID_WMSServer,
                      NULL,
                      CLSCTX_ALL,
                      IID_IWMSServer,
                      (void **)&pServer);
if (FAILED(hr)) goto EXIT;

// Get the collection.
hr = pServer->get_PublishingPoints(&pPubPoints);
if (FAILED(hr)) goto EXIT;

varIndex = L"/";
hr = pPubPoints->get_Item(varIndex, &pPubPoint);
if (FAILED(hr)) goto EXIT;

bstrPath = "c:\\wmpub\\wmroot\\plylstwrap.wsx";
hr = pPubPoint->put_WrapperPath(bstrPath);
if (FAILED(hr)) goto EXIT;

EXIT:
  // TODO: Release temporary COM objects and uninitialize COM.

See Also (General)

See Also (Visual Basic .NET)

See Also (C#)

See Also (C++)