LiveLink – Upload Facility

So after being able to delete and find documents in the LiveLink repository, the next obvious step is to use the web services to upload new documents. The code is as follows:

DocMngrWS.DocumentManagementClient client = null;

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

    client = new DocMngrWS.DocumentManagementClient();
    int parentId = 2261740;
    //DocMngrWS.Metadata meta = new ERDMSSearchSpike.DocMngrWS.Metadata();
    //DocMngrWS.AttributeGroup grp = new ERDMSSearchSpike.DocMngrWS.AttributeGroup();

    DocMngrWS.Attachment att = new ERDMSSearchSpike.DocMngrWS.Attachment();
    att.Contents = File.ReadAllBytes(txtFileToUpload.Text);
    att.FileName = "GBTestFile";
    att.FileSize = att.Contents.Length;
    att.ModifiedDate = File.GetLastWriteTime(txtFileToUpload.Text);
    DocMngrWS.Node newNode = client.CreateDocument(auth, parentId, "TestFromGb", "Test from GB", false, null, att);
catch (Exception ex)
    MessageBox.Show("Exception: " + ex.Message);
    if (client != null)

This code will insert a new document under parent node 2261740. There are commented out lines around the metadata as I need to look into this in a bit more detail.

One thought on “LiveLink – Upload Facility

Leave a Reply

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

You are commenting using your 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