Partager via


MSBTS_ReceiveLocation.Name, propriété (WMI)

 

Contient le nom de l'emplacement de réception.

La syntaxe présentée est indépendante de la langue.

Syntaxe

string Name;  

Notes

Cette propriété n'est accessible en écriture qu'au moment de la création d'une instance. Par la suite, elle est toujours en lecture seule.

Cette propriété a un qualificateur de clé . Avec MgmtDbNameOverride, ReceivePortName et MgmtDbServerOverride, cette clé forme une clé composée pour la classe.

La longueur maximale de cette propriété est de 128 caractères.

Cette propriété encapsule la propriété Microsoft.BizTalk.ExplorerOM.ReceiveLocation.Name managée.

Exemple

L'exemple suivant est issu du fichier 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  
  

L'exemple suivant est issu du fichier SDK\Samples\Admin\WMI\Enumerate Receive Locations\VCSharp\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();  
}  
  

Configuration requise

En-tête: Déclaré dans BTSWMISchemaXP.mof.

Espace de noms : inclus dans \root\MicrosoftBizTalkServer.