Ok, this is my first post, but here's the issue:
Let's say I have a file named 12345ABCDE0001.txt. I want to "display" that file as "Bob.txt".
This part works OK.
Now, let's say we get a revised file for Bob. And let's say the file name is now 67890VWXYZ0001.txt, but we still want it to display as "Bob.txt".
In other words, I want to version the file. I'm trying to write to LiveLink through C# using the LAPI.
The reason I need to do this in C# is beyond the scope of this post, but I had to write a Windows service to do it.
Anyway, any help in this matter will be greatly appreciated. This is a project at work, and I've been working on this for a couple of weeks now, and the deadline is looming.
Here's a snippet I found that will write and create an initial version. The problem is creating additional versions.
The error I get (in the EventViewer) is that the object already exists. I assume this means it's trying to create an object with the same name (i.e. "Bob.txt" in the example above).
Here's the code:
LAPI_DOCUMENTS doc = new LAPI_DOCUMENTS(session);
LLValue createInfo = (new LLValue()).setAssocNotSet();
LLValue objectInfo = new LLValue().setAssocNotSet();
// strMyFileName is the "name" that I want to display (i.e. "Bob.txt")
if (doc.CreateObjectEx(volID, ParentID, LAPI_DOCUMENTS.OBJECTTYPE, LAPI_DOCUMENTS.DOCUMENTSUBTYPE, strMyFileName, createInfo, objectInfo) != 0)
{
//GetErrors(session);
//return;
//throw new Exception(session.getErrMsg());
}
//Add a version to the document object. FullFilePath is the full path to the file, such as C:\MyFolder\MyFile.txt
if (doc.CreateVersion(volID, objectInfo.toInteger("ID"), FullFilePath, versionInfo) != 0)
{
GetErrors(session);
//return;
throw new Exception(session.getErrMsg());
}