IWMSLoggingAdmin::get_Template

banner art

Previous Next

IWMSLoggingAdmin::get_Template

The get_Template method retrieves the log file template path.

Syntax

  HRESULT get_Template(
  
  BSTR*
  
  pbstrTemplate
  
  );

Parameters

pbstrTemplate

[out] Pointer to a BSTR containing the log file template path.

Return Values

If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.

Return code Number Description
E_FAIL 0x80004005 The logging plug-in could not be found.
E_POINTER 0x80004003 The pbstrTemplate parameter is NULL.

Remarks

The specified template path must be to a folder that provides the Network Service account with read, write, and modify permissions. If the Network Service account does not have proper access to the specified folder, an error message will be posted to the troubleshooting pane of the Windows Media Services snap-in.

A template path may contain wildcard characters that are replaced with appropriate values when the file is created by the server. Valid wildcard characters used by Windows Media Services are identified in the following table.

  • Note   When the information denoted by the wildcard is not present on the system, the server will substitute an underscore character (_) for it. Also, because a playlist is considered a single presentation unit, time and date wildcards will expand to the same value for all entries in the playlist.
Wildcard character Description
<a> Abbreviated weekday name (three letters).
<A> Full weekday name.
<b> Abbreviated month name (three letters).
<B> Full month name.
<c> Date and time representation appropriate for the locale of the server generating the file.
<d> Day of the month in a two-digit format (01 - 31).
<H> Hour in a 24-hour, two-digit format (00 - 23).
<I> Hour in a 12-hour, two-digit format (01 - 12).
<j> Day of the year in a three-digit format (001 - 366).
<m> Month in a two-digit format (01 - 12).
<M> Minute in a two-digit format (00 - 59).
<N> A four-digit sequence that starts at zero and is incremented every time a new file is added. The counter is reset to zero when the rest of the file name (not including the four-digit sequence) changes in any way.
<P> The 12-hour format AM or PM indicator of the server generating the file.
<S> Seconds in a two-digit format (00 - 59).
<T> The name of the server generating the file.
<U> Week of the year in a two-digit format (00 - 53), with Sunday as the first day of the week.
<V> The name of the publishing point from which content is being archived. If content is being archived from the default publishing point, "[Default]" is inserted in the archive file name. If the publishing point name contains a forward slash (/), the forward slash is replaced with an underscore (_). If the publishing point is renamed, the archive file automatically cycles to reflect the new name.
<w> Day of the week as a decimal number in a one-digit format (0 - 6; Sunday is 0).
<W> Week of the year in a two-digit format (00 - 53), with Monday as the first day of the week.
<x> Date representation for the current locale of the server generating the log file.
<X> Time representation for the current locale of the server generating the log file.
<y> Year without the century in a two-digit format (00 - 99).
<Y> Year with the century in a four-digit format (for example 1999, 2003).
<z> or <Z> Time zone name or abbreviation. There are no characters if the time zone is unknown.

Example Code

#include <windows.h>
#include <atlbase.h>    // Includes CComBSTR and CComVariant.

// To access system plug-in interfaces, the
// entire type library must be imported as shown.
#import "WMSServerTypeLib.dll" no_namespace named_guids \
                               raw_interfaces_only

// Declare variables and interfaces.
IWMSServer          *pServer;
IWMSPlugins         *pPlugins;
IWMSPlugin          *pPlugin;
IDispatch           *pDispatch;
IWMSLoggingAdmin    *pLogAdmin;

HRESULT         hr;
CComVariant     varIndex;
CComBSTR        bstrTemplate;

// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMSServer,
                      NULL,
                      CLSCTX_ALL,
                      IID_IWMSServer,
                      (void **)&pServer);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to an IWMSPlugins interface
// containing event handler plug-ins.
hr = pServer->get_EventHandlers(&pPlugins);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to the IWMSPlugin interface
// of the plug-in to be configured.
varIndex = "WMS Client Logging";
hr = pPlugins->get_Item(varIndex, &pPlugin);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to the custom interface
// of the plug-in.
hr = pPlugin->get_CustomInterface(&pDispatch);
if (FAILED(hr)) goto EXIT;

// Query the specific administration interface
// for the plug-in.
hr = pDispatch->QueryInterface(IID_IWMSLoggingAdmin,
                              (void **)&pLogAdmin);
if (FAILED(hr)) goto EXIT;

// Retrieve the current log file template path.
hr = pLogAdmin->get_Template(&bstrTemplate);
if (FAILED(hr)) goto EXIT;

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

Requirements

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also

Previous Next