Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Implementation using Livelink WCF Web Services with ASP.NET

Status
Not open for further replies.

PonrajD

Programmer
Oct 22, 2014
2
OM
Hi,

I am very new to LiveLink Implementation. my project requirement is i need to upload and download the document through ASP.NET interface. Using LiveLink Web Service

Kindly share some sample file of implementation.


Thanks,
Ponraj
 
Has some helpful info


Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010
 
Thanks its very useful. Is there any sample code of implementation.

Regards,
Ponraj
 
Not tested

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace GreatFileUpload
{
class Program
{


/*APPU NAIR PROGRAMMERS REPURPOSING NOTE THESE 05/03/2013
* THIS PROJCETS SERVICE REFERENCES ARE POINTING TO LIVELINK TEST SYSTEM SO IF YOU BUILD AND MAKE THIS WORK CHECK
* THE OBJECTS IN .
* YOU WILL NEED A MANUAL LOGIN AS THE wcf EXPOSED IS ANONYMOUS SCHEME.SSO DOES NOT WORK
* CONTENTSERVICE IS THE WAY YOU GET BIG FILES IN.IF YOU HAVE MORE THAN 2 GB UPLOADS YOU NEED
* SOME TWEAKS IN CLIENTS AS WELL AS THE WEB.CONFIG IN THE LIVLINK IIS SRVER
* if code works and you re-run the sample you will get "object exists" as livelink will allow only one object
* by that name.you can add a new version to the object as livelink is a DMS
* also if you do ListContainer call you can enumerate children and find it yourself




*/




static void Main(string[] args)
{

//IMPORTANT README AND REPURPOSE this is your userid and password into livelink
//this is not your domain password the one that the livelink admin gave you

// string username = "Admin";
// string password = "livelink";

string username = "adjein";
string password = "Pl@t1num";

//this is the file I am using in this example
string filePath = @"C:\temp\EULA.RTF";

//this is the folder id where ihave permissions to put it
//if you are in the livlink gui look in the url above the objid/dataid of the folder
int parentID = 577372;
string name = "EULA.RTF";
string comment = "Uploaded through the EWS DocumentManagement web service.";




//==================================================================================
// 1) Create clients that use the service references
//==================================================================================
Authentication.AuthenticationClient authclient = new Authentication.AuthenticationClient();
DocumentManagement.DocumentManagementClient dm = new DocumentManagement.DocumentManagementClient();
ContentService.ContentServiceClient cs = new ContentService.ContentServiceClient();
MemberService.MemberServiceClient ms = new MemberService.MemberServiceClient();
//==================================================================================

//==================================================================================
// 2) Authenticate with the Livelink Server and obtain an authentication token
//==================================================================================
DocumentManagement.OTAuthentication dmOTAuth = new DocumentManagement.OTAuthentication();
MemberService.OTAuthentication msOTAuth = new MemberService.OTAuthentication();







ContentService.OTAuthentication csOTAuth = new ContentService.OTAuthentication();


try
{

string token = authclient.AuthenticateUser(username, password);
dmOTAuth.AuthenticationToken = token;
csOTAuth.AuthenticationToken = token;
msOTAuth.AuthenticationToken = token;
}
catch (Exception e)
{
Console.WriteLine("Error: " + e.Message);
Console.ReadLine();
return;
}
//==================================================================================

//==================================================================================
// 3) Create the Metadata for the Document and obtain a context for upload
//==================================================================================












//DocumentManagement.Metadata docMetadata = null;
//try
//{
// dm.CreateFolder(ref dmOTAuth, 2000, "appus test1", "hello ", docMetadata);
//}

//catch (Exception e)
//{
// Console.WriteLine("Error: " + e.Message);
// Console.ReadLine();
// return;
//}



string docContext = "";
try
{


bool advancedVersionControl = false; // Note: This will result in the creation of a minor version.
DocumentManagement.Metadata docMetadata1 = null; // inherit metadata from the parent object

docContext = dm.CreateDocumentContext(ref dmOTAuth, parentID, name, comment, advancedVersionControl, docMetadata1);

// dm.CreateFolder(ref dmOTAuth, 2000, "appus test1", "hello ", docMetadata1);
}
catch (Exception e)
{
Console.WriteLine("Error: " + e.Message);
Console.ReadLine();
return;
}
//==================================================================================

//==================================================================================
// 4) Upload the Content for the Document
//==================================================================================
try
{

FileInfo fi = new FileInfo(filePath);
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
ContentService.FileAtts fa = new ContentService.FileAtts();

// Store file attributes for the document
fa.CreatedDate = fi.CreationTime;
fa.ModifiedDate = fi.LastWriteTime;
fa.FileName = fi.Name;
fa.FileSize = fi.Length;

string objectID = cs.UploadContent(ref csOTAuth, docContext, fa, fs);

Console.WriteLine("Uploaded Document ID = " + objectID);
}
catch (Exception e)
{
Console.WriteLine("Error: " + e.Message);
Console.WriteLine("Stack Trace: " + e.StackTrace);
Console.ReadLine();
}
//==================================================================================
}
}
}




Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top