Hi all, I am struggeling with a kind of newbie problem :-S It shouldn't be that hard but I cannot find out what I do wrong. Hopefully someone can help me out!
I am trying to add a simple .txt document to a folder ("FolderX") with a required Category ("CategoryX") which has a required Attribute ("AttributeX").
I can access the enterprise workspace but when calling the function CreateObjectX an error occurs (see //// THE ERROR OCCURS HERE //// in the sourcecode).
Whatever I am trying, everytime I get the same error message:
Session failure status is 101101 (0x101101)
Message=Could not get results.
errMsg=
apiError=
Any help is welcome! Thanks in advance.
//I left some code out here... (accessing is not the problem)
// Access the Enterprise Workspace
LLValue pwsInfo = (new LLValue()).setAssocNotSet();
if (doc.AccessEnterpriseWS(pwsInfo) != 0)
{
Console.WriteLine("Enterprise Workspace access Failed.");
GetErrors(session);
return;
}
else
{
Console.WriteLine("Accessed Enterprise Workspace.");
//Define the parent object's dataID and volumeID (also called ownerID)
dataID = 41246; //"FolderX" FolderID
volumeID = pwsInfo.toInteger("ID");
}
//Create the objID assoc necessary for some category functions
LLValue objID = (new LLValue()).setAssocNotSet();
objID.add("ID", dataID);
//First, obtain a list of the folder's categories
LLValue catIDList = (new LLValue()).setAssocNotSet();
if(doc.ListObjectCategoryIDs(objID, catIDList) != 0)
{
Console.WriteLine("ListObjectCategoryIDs Failed.");
GetErrors(session);
return;
}
else
Console.WriteLine("Retrieved Category Listing.");
//loop through the categories and retrieve the catVersion
LLValue catID = (new LLValue()).setAssocNotSet();
for(int i=0; i < catIDList.size(); i++)
{
if((catIDList.toValue(i).toString("DisplayName")).CompareTo("CategoryX") == 0)
{
catID = catIDList.toValue(i);
}
}
//Now load the category version for this category from the folder
LLValue catVersion = (new LLValue()).setAssocNotSet();
if(doc.GetObjectAttributesEx(objID, catID, catVersion) != 0)
{
Console.WriteLine("GetObjectAttributesEx Failed.");
GetErrors(session);
return;
}
else
Console.WriteLine("Retrieved Category Version.");
//Now set the "Required Text Attribute" attribute
LLValue attrValuesPath = (new LLValue()).setAssocNotSet();
LLValue attrValues = (new LLValue()).setList();
attrValues.add("TestAttributeValue");
if(attr.AttrSetValues(catVersion, "AttributeX", LAPI_ATTRIBUTES.ATTR_TYPE_STRFIELD, attrValuesPath, attrValues) != 0)
{
Console.WriteLine("GetObjectAttributesEx Failed.");
GetErrors(session);
return;
}
else
Console.WriteLine("Retrieved Category Version.");
//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();
LLValue request = (new LLValue()).setAssocNotSet();
request.add("Comment", "These are the document's comments.");
createInfo.add("request", request);
//Create the list of categories for the document
LLValue categories = (new LLValue()).setList();
categories.add(catVersion);
//Add the list of categories to the createInfo
createInfo.add("Categories", categories);
//Create the document object in Livelink
if(doc.CreateObjectEx(volumeID, dataID, LAPI_DOCUMENTS.OBJECTTYPE, LAPI_DOCUMENTS.DOCUMENTSUBTYPE, "LivelinkTest2", createInfo, objectInfo) != 0)
{
//// THE ERROR OCCURS HERE ////
GetErrors(session);
return;
}
else
Console.WriteLine("Document Object Created.");
//create the output variable versionInfo, which will contain the version's information
LLValue versionInfo = (new LLValue()).setAssocNotSet();
//Add a version to the document object
if(doc.CreateVersion(volumeID, objectInfo.toInteger("ID"), @"D:\LivelinkTest2.txt", versionInfo) != 0)
{
GetErrors(session);
return;
}
else
Console.WriteLine("Version Created.");
}
I am trying to add a simple .txt document to a folder ("FolderX") with a required Category ("CategoryX") which has a required Attribute ("AttributeX").
I can access the enterprise workspace but when calling the function CreateObjectX an error occurs (see //// THE ERROR OCCURS HERE //// in the sourcecode).
Whatever I am trying, everytime I get the same error message:
Session failure status is 101101 (0x101101)
Message=Could not get results.
errMsg=
apiError=
Any help is welcome! Thanks in advance.
//I left some code out here... (accessing is not the problem)
// Access the Enterprise Workspace
LLValue pwsInfo = (new LLValue()).setAssocNotSet();
if (doc.AccessEnterpriseWS(pwsInfo) != 0)
{
Console.WriteLine("Enterprise Workspace access Failed.");
GetErrors(session);
return;
}
else
{
Console.WriteLine("Accessed Enterprise Workspace.");
//Define the parent object's dataID and volumeID (also called ownerID)
dataID = 41246; //"FolderX" FolderID
volumeID = pwsInfo.toInteger("ID");
}
//Create the objID assoc necessary for some category functions
LLValue objID = (new LLValue()).setAssocNotSet();
objID.add("ID", dataID);
//First, obtain a list of the folder's categories
LLValue catIDList = (new LLValue()).setAssocNotSet();
if(doc.ListObjectCategoryIDs(objID, catIDList) != 0)
{
Console.WriteLine("ListObjectCategoryIDs Failed.");
GetErrors(session);
return;
}
else
Console.WriteLine("Retrieved Category Listing.");
//loop through the categories and retrieve the catVersion
LLValue catID = (new LLValue()).setAssocNotSet();
for(int i=0; i < catIDList.size(); i++)
{
if((catIDList.toValue(i).toString("DisplayName")).CompareTo("CategoryX") == 0)
{
catID = catIDList.toValue(i);
}
}
//Now load the category version for this category from the folder
LLValue catVersion = (new LLValue()).setAssocNotSet();
if(doc.GetObjectAttributesEx(objID, catID, catVersion) != 0)
{
Console.WriteLine("GetObjectAttributesEx Failed.");
GetErrors(session);
return;
}
else
Console.WriteLine("Retrieved Category Version.");
//Now set the "Required Text Attribute" attribute
LLValue attrValuesPath = (new LLValue()).setAssocNotSet();
LLValue attrValues = (new LLValue()).setList();
attrValues.add("TestAttributeValue");
if(attr.AttrSetValues(catVersion, "AttributeX", LAPI_ATTRIBUTES.ATTR_TYPE_STRFIELD, attrValuesPath, attrValues) != 0)
{
Console.WriteLine("GetObjectAttributesEx Failed.");
GetErrors(session);
return;
}
else
Console.WriteLine("Retrieved Category Version.");
//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();
LLValue request = (new LLValue()).setAssocNotSet();
request.add("Comment", "These are the document's comments.");
createInfo.add("request", request);
//Create the list of categories for the document
LLValue categories = (new LLValue()).setList();
categories.add(catVersion);
//Add the list of categories to the createInfo
createInfo.add("Categories", categories);
//Create the document object in Livelink
if(doc.CreateObjectEx(volumeID, dataID, LAPI_DOCUMENTS.OBJECTTYPE, LAPI_DOCUMENTS.DOCUMENTSUBTYPE, "LivelinkTest2", createInfo, objectInfo) != 0)
{
//// THE ERROR OCCURS HERE ////
GetErrors(session);
return;
}
else
Console.WriteLine("Document Object Created.");
//create the output variable versionInfo, which will contain the version's information
LLValue versionInfo = (new LLValue()).setAssocNotSet();
//Add a version to the document object
if(doc.CreateVersion(volumeID, objectInfo.toInteger("ID"), @"D:\LivelinkTest2.txt", versionInfo) != 0)
{
GetErrors(session);
return;
}
else
Console.WriteLine("Version Created.");
}