MSBTS_ReceiveLocation.Name 属性 (WMI)

 

包含接收位置的名称。

显示的语法是非特定语言的。

语法

string Name;  

注解

此属性在创建实例时可写入。 创建实例后,此属性为只读。

此属性具有 密钥 限定符。 除了 MgmtDbNameOverrideReceivePortNameMgmtDbServerOverride 外,此键还构成类的复合键。

此属性的最大长度为 128 个字符。

此属性包装托管 Microsoft.BizTalk.ExplorerOM.ReceiveLocation.Name 属性。

示例:

以下示例摘自 SDK\Samples\Admin\WMI\Enumerate Receive Locations\VBScript\EnumRecLocs.vbs 文件。

  
Sub EnumRecLocs()  
  
   'error handling is done by explicity checking the err object rather than using  
   'the VB ON ERROR construct, so set to resume next on error.  
   on error resume next  
  
   Dim InstSet, Inst  
   set InstSet = GetObject ("winmgmts:\root\MicrosoftBizTalkServer").InstancesOf("MSBTS_ReceiveLocation")  
  
   'Check for error condition before continuing.  
   If Err <> 0   Then  
      PrintWMIErrorThenExit Err.Description, Err.Number  
   End If  
  
   'Report on number of receive locations found and list each one.  
   wscript.echo "A Total of " & InstSet.Count & " Receive Locations were found."  
   If InstSet.Count > 0 Then  
      For Each Inst In InstSet  
         wscript.echo  
         wscript.echo "Receive Location Name: " & Inst.Name  
         wscript.echo "  Disabled           : " & Inst.IsDisabled  
         wscript.echo "  Pipeline Name      : " & Inst.PipelineName  
         wscript.echo "  Receive Port Name  : " & Inst.ReceivePortName  
         wscript.echo  
      next  
   End If   
  
End Sub  
  

以下示例摘自 SDK\Samples\Admin\WMI\Enumerate Receive Locations\CSharp\EnumRLs.cs 文件。

  
static void Main(string[] args)  
{  
   // Display help information   
   if (args.Length > 0)  
   {  
         if (args[0] == "/?")   
         {  
            Console.WriteLine();  
            Console.WriteLine();  
            Console.WriteLine("The correct usage of this sample is \"EnumRL.exe [RLName]\"");  
            Console.WriteLine("Where [RLname] is the name of a particular receive location to enumerate.");  
            Console.WriteLine("If receive location name contains spaces make sure to put it in quotes");   
            Console.WriteLine();  
            Console.WriteLine("Example #1 Enumerate all the receive locations.");  
            Console.WriteLine("         EnumRL");  
            Console.WriteLine();  
            Console.WriteLine("Example#2 enumerate just the \"My Receive Location #3\" receive location.");   
            Console.WriteLine("         EnumRL \"My Receive Location #3\" ");  
            Console.WriteLine();  
            Console.WriteLine();  
            Console.WriteLine("To get help use enumRL.exe /?");  
            return;  
         }  
   }  
  
   try   
   {     
      //Create the WMI search object.  
      ManagementObjectSearcher Searcher = new ManagementObjectSearcher();  
  
      // create the scope node so we can set the WMI root node correctly.  
      ManagementScope Scope = new ManagementScope("root\\MicrosoftBizTalkServer");  
      Searcher.Scope = Scope;  
  
      // Build a Query to enumerate the MSBTS_ReceiveLocation instances if an argument  
      // is supplied use it to select only the matching RL.  
      SelectQuery Query = new SelectQuery();   
      if (args.Length == 0)   
         Query.QueryString="SELECT * FROM MSBTS_ReceiveLocation";  
      else  
         Query.QueryString="SELECT * FROM MSBTS_ReceiveLocation WHERE Name = '" + args[0] + "'";  
  
      // Set the query for the searcher.  
      Searcher.Query = Query;  
  
      // Execute the query and determine if any results were obtained.  
      ManagementObjectCollection QueryCol = Searcher.Get();  
  
      // Use a bool to tell if we enter the for loop  
      // below because Count property is not supported  
      bool ReceiveLocationFound = false;  
  
      // Enumerate all properties.  
      foreach (ManagementBaseObject envVar in QueryCol)  
      {  
         // There is at least one Receive Location  
         ReceiveLocationFound = true;  
  
         Console.WriteLine("**************************************************");  
         Console.WriteLine("Receive Location:  {0}", envVar["Name"]);  
         Console.WriteLine("**************************************************");  
  
         PropertyDataCollection envVarProperties = envVar.Properties;  
         Console.WriteLine("Output in the form of: Property: {Value}");  
  
         foreach (PropertyData envVarProperty in envVarProperties)   
         {                 
            Console.WriteLine(envVarProperty.Name+ ":\t" + envVarProperty.Value);  
         }  
      }  
  
      if (!ReceiveLocationFound)   
      {  
         Console.WriteLine("No receive locations found matching the specified name.");  
      }   
   }  
  
   catch(Exception excep)  
   {  
      Console.WriteLine(excep.ToString());  
   }  
  
   Console.WriteLine("\r\n\r\nPress Enter to continue...");  
   Console.Read();  
}  
  

要求

页眉: 在 BTSWMISchemaXP.mof 中声明。

Namespace: 包含在 \root\MicrosoftBizTalkServer 中。