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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URGENT: AddDocument generates get(name) error

Status
Not open for further replies.

trbldntyrd

Programmer
Jun 7, 2011
7
US
I'm using C#.net. I have some very simple code that uploads a document from a user's system to a directory in Livelink. This works fine on my local as well as other developers' systems but not on the test server. Below is a snippet of my code, and it errors on the last line:
[tt]
string fileName = Path.GetFileName(fup.PostedFile.FileName);
string filePath = fup.PostedFile.FileName;
LLValue objInfo = (new LLValue()).setAssoc();
LLValue versionInfo = (new LLValue()).setAssocNotSet();

utility.Status = utility.Documents.AddDocument(livelinkVolumeID, parentID, fileName, filePath, objInfo, versionInfo);
[/tt]
And the error generated is this:

[COLOR=red yellow]
get(name) not implemented for this datatype

Exception Details: com.opentext.api.LLIllegalOperationException: get(name) not implemented for this datatype

[LLIllegalOperationException: get(name) not implemented for this datatype]
com.opentext.api.LLInstance.get(String name) +46
com.opentext.api.LLValue.toValue(String name) +12
com.opentext.api.LLConnect.unMarshall(String argName) +40
com.opentext.api.LAPI_DOCUMENTS.AddDocument(Int32 ParentVolumeID, Int32 ParentID, String Name, String FilePath, LLValue ObjInfo, LLValue VersionInfo) +134
[/color]

There is not much help available online for opentext/livelink, so this is my last resort. If anyone can please provide assistance, it would greatly be appreciated!
 
why are you not looking at the session error.get(name) happens because the previous call did not succeed and you are trying to print/get something that does not exist.I attach a error trap.

take a loot at GetErrors in this piece of code.

your utility.status variable returns 0 if the call worked non zero if it is an error you need to pipe the error to
take a look at GetErrors in this piece of code.
Code:
//Specify import directives
import com.opentext.api.*;
import java.util.*;
public class CreateDocumentAndVersion
{

	//class member functions
	public static void main (String args[])
	{
		try
		{
			//Create a new Livelink Session
			LLSession session;
			session = new LLSession ("localhost", 4099, "", "Admin", "livelink", null);

			//Initialize any LAPI Objects
			LAPI_DOCUMENTS	doc = new LAPI_DOCUMENTS(session);
            LLValue myEntValues=new LLValue();
            int volumeID=0, objectID=0,versionID=0;
         //we are accessing the enterprise workspace
         if (doc.AccessEnterpriseWS(myEntValues) == 0)
          {
               volumeID = myEntValues.toInteger("VolumeID");
               objectID = myEntValues.toInteger("ID");
               System.out.println("This and other better Lapi samples at [URL unfurl="true"]http://www.greggriffiths.org");[/URL]
               System.out.println("My objID -->"+objectID+" My VolumeID is -->"+volumeID);
               System.out.println("I love LAPI.Dr Lapi");

          }//if ends

     // we need a folder to create our document
     //in this example we are trying to create in
     //enterprise workspace,change this call to
     //any valid folder id for this lapi users
     //has 'Add item' perms
         int myFolderObjID=objectID;


         String myDocToBeUploaded="c:\\temp\\test.txt";

			//////////////////////////////////////////////////////////////////////
			//Code to Create a Document
			//First we create the document node subtype
			//Then we add a  version
			//Demonstrates why this lapi call is superior
			//than AddDocument
			//////////////////////////////////////////////////////////////////////
			//Finally, we can create the document
			//create the output variable objectInfo, which will contain the object's information
			LLValue objectInfo = (new LLValue()).setAssocNotSet();

			//Setup any information for creation
			LLValue createInfo = (new LLValue()).setAssocNotSet();
			createInfo.add("Comments","These are the document's comments.");
			//Create the document object in Livelink
			//By changing the subtype you get to create
			//the differnet objecrs

			if(doc.CreateObjectEx(volumeID, myFolderObjID, doc.OBJECTTYPE, doc.DOCUMENTSUBTYPE, "New Document Name", createInfo, objectInfo) != 0)
			{
				GetErrors(session);
				//if it has errored out we should really be checking what the
				//error was .But since this is a createVersion on a pre-existing
				//node excercise we will assume that the error is due to a
				//pre-existing node we grab its information.For this we need
				//to list objects and we are interested in finding only the
				//documents

				/********************************************************/
				CreateVersion(session,doc,volumeID,objectID,objectInfo,myDocToBeUploaded);
				return;
			}
			else
				System.out.println("Document Object Created.");

	         }
		catch (Throwable e)
		{
			System.err.println(e.getMessage());
			e.printStackTrace(System.err);
		}
	}

//This function creates any number of versions if the node already exists
	public static void CreateVersion(LLSession session,LAPI_DOCUMENTS doc,int volumeID,int objectID,LLValue objectInfo,String path)
	{

        LLValue children=(new LLValue()).setTable();
        //create the output variable versionInfo, which will contain the version's information
		LLValue versionInfo = (new LLValue()).setAssocNotSet();
		doc.ListObjects(volumeID,objectID,"DTREE","subtype=144",doc.PERM_FULL,children);

/*since children is a RecArray we have to use content enumeration methods to figure
out the type of the object.The subtype=144 limits returning documents where the
PERM_FULL is applied to the lapi user making this call*/
/* see the full out put of this recarray.For simplicity we take the "Name" out
of it and compare to the name we are trying to give */

		    	}


























//This function outputs any errors from the session
	public static void GetErrors(LLSession session)
	{
		System.out.println("Status Code: " + session.getStatus());
		System.out.println("Api Error: " + session.getApiError());
		System.out.println("Error Message: " + session.getErrMsg());
		System.out.println("Status Message: " + session.getStatusMessage());
	}





















	}//Class Ends

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