[lang_de]
Mit diesem Code können Sie z.B. mit einem Überwachungsdienst gewisse Empfangsspeicherorte überwachen. Dies macht z.B. bei POP3 Empfangsspeicherorte Sinn, bei denen ab und an der POP3 Server nicht verfügbar ist:
System.Management.ManagementObject requiredRLObj = null;
System.Management.ObjectGetOptions objGetOptions = new ObjectGetOptions();
System.Management.ManagementClass rlObjectClass = new ManagementClass("root\\MicrosoftBizTalkServer", "MSBTS_ReceiveLocation", objGetOptions);System.Management.EnumerationOptions enumObjOptions = new EnumerationOptions();
enumObjOptions.ReturnImmediately = false;
System.Management.ManagementObjectCollection rlObjColl = rlObjectClass.GetInstances(enumObjOptions);
foreach (ManagementObject rlObjInstance in rlObjColl)
{
if (rlObjInstance["Name"] != null)
{
if (string.Compare("Empfangsspeicherortname", rlObjInstance["Name"].ToString(), true, System.Globalization.CultureInfo.CurrentUICulture) == 0)
{
requiredRLObj = rlObjInstance;
}
}
}
try
{
requiredRLObj.InvokeMethod("Disable", null);
requiredRLObj.InvokeMethod("Enable", null);
}
catch
{
Console.Write("Enabling Receive Location failed");
}
[/lang_de]
[lang_en]
With this code yo can (re)activate a Biztalk Server Receive Location with e.g. a surveillance service. This may make sense if you use a POP3 Receive Location where the pop3 server casually is not reachable.
System.Management.ManagementObject requiredRLObj = null;
System.Management.ObjectGetOptions objGetOptions = new ObjectGetOptions();
System.Management.ManagementClass rlObjectClass = new ManagementClass("root\\MicrosoftBizTalkServer", "MSBTS_ReceiveLocation", objGetOptions);System.Management.EnumerationOptions enumObjOptions = new EnumerationOptions();
enumObjOptions.ReturnImmediately = false;
System.Management.ManagementObjectCollection rlObjColl = rlObjectClass.GetInstances(enumObjOptions);
foreach (ManagementObject rlObjInstance in rlObjColl)
{
if (rlObjInstance["Name"] != null)
{
if (string.Compare("ReceiveLocationName", rlObjInstance["Name"].ToString(), true, System.Globalization.CultureInfo.CurrentUICulture) == 0)
{
requiredRLObj = rlObjInstance;
}
}
}
try
{
requiredRLObj.InvokeMethod("Disable", null);
requiredRLObj.InvokeMethod("Enable", null);
}
catch
{
Console.Write("Enabling Receive Location failed");
}
[/lang_en]
0 Kommentare