IWMSNamedValues.Add (C#)
Previous | Next |
IWMSNamedValues.Add (C#)
The Add method adds an IWMSNamedValue object to the IWMSNamedValues collection.
Syntax
IWMSNamedValues.Add( string strName, object varValue );
Parameters
strName
[in] string containing the name.
varValue
[in] object containing the value. The default value is a zero-length string.
Return Values
This method does not return a value.
If this method fails, it throws an exception.
Number | Description |
0x8007000E | There is insufficient memory to complete the function. |
0xC00D1396L | strName contains an invalid character. Invalid characters are: & " ' < > \ and the ANSI characters 0-31 and 127. |
0xC00D1392L | varValue is greater than the maximum length allowed. |
0xC00D138BL | varValue is an unsupported type. |
Example Code
using Microsoft.WindowsMediaServices.Interop; using System.Runtime.InteropServices; // Declare variables. WMSServer Server; IWMSNamedValues NamedValues; IWMSNamedValue NamedValue; object varValue; string strName; try { // Create a new WMSServer object. Server = new WMSServerClass(); // Retrieve the IWMSNamedValues object // containing descriptive information about the server. NamedValues = Server.Properties; // Add a new property to the collection of name-value pairs. strName = "System Administrator"; varValue = "Bob Jenkins"; NamedValue = NamedValues.Add(strName, varValue); } 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 |