The following C# code example removes an application named EncryptDocument.
(See Removing Applications.)
using System;
namespace RemoveApplication
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
try
{
//Create an ApplicationManagerService client object
ApplicationManagerService appManagerClient = new ApplicationManagerService();
appManagerClient.Credentials = new System.Net.NetworkCredential("administrator", "password");
//Get all applications
Object [] allApps = appManagerClient.getApplications();
//Iterate through the applications
int num = allApps.Length;
for (int i=0; i<num;i++)
{
//Get a ProcssInstanceRow instance
Application myApplication = (Application)allApps[i];
ApplicationId appId = myApplication.applicationId;
String appName = appId.applicationName;
if (appName.Equals("MortgageApplication"))
{
appManagerClient.removeApplication(appId);
Console.WriteLine("The application was removed.");
}
}
}
catch (Exception ee)
{
Console.WriteLine(ee.Message);
}
}
}
}
|
|
|