MSBTS_SendHandler 的 AdapterName 屬性 (WMI)

 

包含所使用之配接器的名稱。

所顯示的語法為非語言相關。

語法

  
string AdapterName;  

備註

在建立執行個體時,需要這個屬性。 在建立執行個體時,可寫入這個屬性。 建立執行個體之後,這個屬性會是唯讀。

這個屬性具有索引 限定詞。 此索引鍵連同 連同 mgmtdbnameoverrideMgmtDbServerOverride,形成類別的複合索引鍵。

這個屬性的最大長度是256個字元。

範例

下列範例取自 SDK\Samples\Admin\WMI\Set Send Handler Property\VBScript\ConfigureSMTP.vbs 檔案。

  
Sub ConfigureSMTPSendHandler()  
   '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  
  
   'Get the command line arguments entered for the script  
   Dim objArgs: Set objArgs = WScript.Arguments  
  
   'Make sure the expected number of arguments were provided on the command line.  
   'if not, print usage text and exit.  
   If (objArgs.Count <> 2) Then  
      PrintUsage()  
      WScript.Quit 0  
   End If  
  
   Dim objInstSet, objInst, strQuery, strSMTPHostName, strFromAddress, strConfigXML, strAdapterName  
  
   strAdapterName = "SMTP"  
   strSMTPHostName = objArgs(0)  
   strFromAddress = objArgs(1)  
   strConfigXML = "<CustomProps><SMTPHost vt=""8"">" & strSMTPHostName & "</SMTPHost><SMTPAuthenticate vt=""19"">2</SMTPAuthenticate><From vt=""8"">" & strFromAddress & "</From></CustomProps>"  
  
   'set up a WMI query to acquire a list of send handlers with the given Name key value.  
   'This should be a list of zero or one send handlers.  
   strQuery = "SELECT * FROM MSBTS_SendHandler WHERE AdapterName =""" & strAdapterName & """"  
   Set objInstSet = GetObject("Winmgmts:!root\MicrosoftBizTalkServer").ExecQuery(strQuery)  
  
   'Check for error condition before continuing.  
   If Err <> 0   Then  
      PrintWMIErrorThenExit Err.Description, Err.Number  
   End If  
  
   'If send handler found, set configuration information, otherwise print error and end.  
   If objInstSet.Count > 0 then  
      For Each objInst in objInstSet  
         'Set config data for send handler  
         objInst.CustomCfg = strConfigXML  
         If Err <> 0   Then  
            PrintWMIErrorThenExit Err.Description, Err.Number  
         End If  
  
         'Commit the change to the database  
         objInst.Put_(1)  
         If Err <> 0   Then  
            PrintWMIErrorThenExit Err.Description, Err.Number  
         End If  
         WScript.Echo "The Send Handler was successfully configured."  
      Next  
   Else  
      WScript.Echo "No Send Handler was found matching that AdapterName."  
   End If  
End Sub  
  

未提供 C# 的範例。

規格需求

Header: 於 BTSWMISchema2K.mof 或 BTSWMISchemaXP.mof 中宣告。

命名空間: 包含在 \root\MicrosoftBizTalkServer 中。