IWMSAdminArchiveSink.ExpandTemplate (Visual Basic .NET)

banner art

Previous Next

IWMSAdminArchiveSink.ExpandTemplate (Visual Basic .NET)

The ExpandTemplate method retrieves the expanded path of the tokenized template.

Syntax

  String = IWMSAdminArchiveSink.ExpandTemplate(bstrTemplate)

Parameters

bstrTemplate

[in] A String containing the tokenized template.

Return Values

This method returns a String containing the expanded path of the template.

If this method fails, it throws an exception.

Number Description
0x8000FFFF The WMS Archive Data Writer plug-in cannot be found.

Remarks

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 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 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 1-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 two-digit format (00 - 99).
<Y> Year with the century in 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.

The following wildcard characters are available for use with archive files only.

Wildcard character Description
<E> Expands to an integer value which starts at one (1) and is incremented every time the archive plug-in creates a new digital media file.
<F> Expands to match the role attribute of a media element in a playlist file. If the media element being archived is not in a playlist file or does not contain a role attribute, this will be replaced by an underscore.
<L> Expands to the last path segment specified by the src attribute of a media element in a playlist file. However, if the media element contains a mediaName attribute, the value of the mediaName attribute will be used instead. The last path segment in the URL includes all of the characters after the last slash (/) or backward slash (\). If the last path segment contains a colon (:), the colon and all subsequent characters are removed. For example, if the src attribute references an individual file such as C:\WMPub\WMRoot\Welcome1.asf, the L wildcard character returns the name of the file, "Welcome1.asf". If the src attribute references a remote publishing point, the L wildcard character returns the name of the source file on the origin server. If the src attribute references https://encoder1 in a push or pull scenario, the L wildcard character returns a value of "_".

Example Code

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

Private Sub ExpandTemplatePath()

    ' Declare variables.
    Dim Server As WMSServer
    Dim BCPubPoint As IWMSBroadcastPublishingPoint
    Dim Plugin As IWMSPlugin
    Dim AdminArchiveSink As IWMSAdminArchiveSink
    Dim Expanded As String

Try
    ' Create the WMSServer object.
    Server = New WMSServer()

    ' Add a new broadcast publishing point.
    BCPubPoint = Server.PublishingPoints.Add("NewPubPoint", _
         WMS_PUBLISHING_POINT_CATEGORY.WMS_PUBLISHING_POINT_BROADCAST, _
         "c:\wmpub\wmroot\playlist.wsx")

    ' Retrieve the plug-in to be configured.
    Plugin = BCPubPoint.BroadcastDataSinks.Item( _
         "WMS Archive Data Writer")

    ' Retrieve the custom interface of the plug-in.
    AdminArchiveSink = Plugin.CustomInterface

    ' Expand the template path for archived content.
    Expanded = AdminArchiveSink.ExpandTemplate(AdminArchiveSink.Path)

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