Share via


IWMSNamedValue Object (Visual Basic .NET)

banner art

Previous Next

IWMSNamedValue Object (Visual Basic .NET)

You can use the IWMSNamedValue object to specify the name and retrieve or specify the value of a name-value pair associated with the server. You can use the IWMSNamedValues object to manage a collection of name-value pairs.

The IWMSNamedValue object exposes the following properties.

Property Description
Name Retrieves the name portion of the name-value pair.
Value Specifies and retrieves the value portion of the name-value pair.

Example Code

The following example illustrates how to retrieve an IWMSNamedValue object.

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

Private Sub RetrieveObj()

    ' Declare variables.
    Dim Server As WMSServer
    Dim NamedValues As IWMSNamedValues
    Dim NamedValue As IWMSNamedValue
    Dim i As Integer

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

    ' Retrieve the IWMSNamedValues object
    ' containing descriptive information about the server.
    NamedValues = Server.Properties

    ' Retrieve information about each name-value pair.
    For i = 0 To NamedValues.Count - 1
        NamedValue = NamedValues.Item(i)
    Next i

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

System and custom plug-ins contain default name-value pairs that can be accessed by simply indexing the name of the property you want to retrieve. For a list of the default values you can access, see Registering Plug-in Properties.

The following example illustrates how to retrieve some default configuration values from the WMS Digest Authentication plug-in.

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

Private Sub GetConfigValues()

    ' Declare variables.
    Dim Server As WMSServer
    Dim Plugins As IWMSPlugins
    Dim Plugin As IWMSPlugin
    Dim Properties As IWMSNamedValues
    Dim WMSSystemPlugin As Integer
    Dim MMCMoniker As String
    Dim ASPMoniker As String
    Dim UnsupportedLoadTypes As Integer
    Dim Realm As String
    Dim Name As String
    Dim Description As String
    Dim Author As String
    Dim Copyright As String

Try

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

    ' Retrieve the WMS Digest Authentication plug-in.
    Plugins = Server.Authenticators
    Plugin = Plugins.Item("WMS Digest Authentication")

    ' Retrieve the configuration properties specified
    ' for the plug-in.
    Properties = Plugin.Properties
    WMSSystemPlugin = Properties.Item("WMSSystemPlugin").Value
    MMCMoniker = Properties.Item("MMCMoniker").Value
    ASPMoniker = Properties.Item("ASPMoniker").Value
    UnsupportedLoadTypes = Properties.Item("UnsupportedLoadTypes").Value
    Realm = Properties.Item("Realm").Value
    Name = Properties.Item("Name").Value
    Description = Properties.Item("Description").Value
    Author = Properties.Item("Author").Value
    Copyright = Properties.Item("Copyright").Value

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

See Also

Previous Next