IWMSLoggingAdmin.Template (C#)

banner art

Previous Next

IWMSLoggingAdmin.Template (C#)

The Template property specifies and retrieves the log file template path.

Syntax

  IWMSLoggingAdmin
  .Template = string;
string = IWMSLoggingAdmin.Template;

Property Value

A string containing the log file path template.

If this property fails, it throws an exception.

Number Description
0x80004005 The server cannot find the WMS Client Logging plug-in.
0x80070057 The template you specified is not valid.

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 environment variables and 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, or 2003).
<z> or <Z> Time zone name or abbreviation. There are no characters if the time zone is unknown.

Example Code

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

// Declare variables.
WMSServer Server;
IWMSPlugin Plugin;
IWMSLoggingAdmin LogAdmin;

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

    // Retrieve the plug-in to be configured.
    Plugin = Server.EventHandlers[
                        "WMS Client Logging"];

    // Retrieve the custom interface of the plug-in.
    LogAdmin =
        (IWMSLoggingAdmin)Plugin.CustomInterface;

    // Set the current log file name template.
    LogAdmin.Template = "C:\\LogFiles\\<V>\\WMS_<Y><m><d>.log";
}
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