LiveLink – Node Deletion

Through work I appear to be integrating to a new system. A second post will appear shortly with the details of how to search for items using their SQL-esque language and web services.

The architecture I’m working with is LiveLink installed on a Solaris box, and therefore am communicating with the Java Web Services as provided out of the box. I’m not certain which version of the software I’m working with.

One of the requirements is to be able to process deletes. The following code works from a .NET C# test harness and will:

  • Delete individual documents / items
  • Delete empty folders
  • Delete populated folders (and lower level folders / documents / items)

So it needs to be used with an element of caution. It also requires a user with the associated privileges to perform a delete in the required area.

DocMngrWS.DocumentManagementClient client = null;

try
{
    DocMngrWS.OTAuthentication auth = new ERDMSSearchSpike.DocMngrWS.OTAuthentication();
    auth.AuthenticationToken = getToken();

    client = new DocMngrWS.DocumentManagementClient();
    client.Open();

    client.DeleteNode(auth, 2068767);
    MessageBox.Show("Done.");
}
catch (Exception ex)
{
    MessageBox.Show("Exception: " + ex.Message);
}
finally
{
    if (client != null)
    {
        client.Close();
    }
}

private static string getToken()
{
    AuthWebService.AuthenticationClient client = new AuthWebService.AuthenticationClient();
    return client.AuthenticateUser("<username>", "<password>");
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s