Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Content Management (Extended ECM)
API, SDK, REST and Web Services
GetUniqueObject method does not work?
Sergio_Pinés_Martín
When I use the GetUniqueObject call, and I pass in the name of a document that already exists in the folder, I get back the same name. It does not return a "unique object" name as it claims. I am using .NET. For example, the following VB.NET code, supposing I have a document "Test doc" in a folder with ID 142342: Dim name As String = "Test doc" Dim aInfo As LLValue = (New LLValue).setAssocNotSet, aName As LLValue = (New LLValue).setAssocNotSet aInfo.add("Name", name) aInfo.add("SubType", ObjectSubtype) _Documents.GetUniqueObject(0, 142342, aInfo, aName))[_Documents is an instantiated LAPI_Documents class]OK, so the call will just return: "Test doc" (i.e., aInfo.toString = "Test doc")How's that??
Find more posts tagged with
Comments
Carsten_Kulms
Message from Carsten Kulms <
carsten.kulms@opentext.com
> via eLink
eLink
Currently I do not have the documentation at hand but I think the unique name is returned in the out-parameter "aName".
Sergio_Pinés_Martín
Sorry, I botched up the example - yes, the return value would be in aName, and that is the code I am actually using; I made a mistake writing down the example.This is the real code I use: Public Function GetUniqueName(ByVal name As String, ByVal ObjectSubtype As LLNodeSubtype) As String Dim aInfo As LLValue = (New LLValue).setAssocNotSet, aName As LLValue = (New LLValue).setAssocNotSet aInfo.add("Name", name) aInfo.add("SubType", ObjectSubtype) _Session.Documents.GetUniqueObject(Me.VolumeID, Me.ID, aInfo, aName) Return aName.toString End FunctionaName returns "Test doc" although that document already exists under folder 142342
Carsten_Kulms
Message from Carsten Kulms via eLinkI was unable to reproduce the issue.On the other hand there is a discrepany how the uniquess of names ismanaged by core and LAPI's GetUniqueObject function: If an object namecontains trainling spaces these are removed when adding via the UI.LAPI's GetUniqueObject function checks without touching possibly presenttrainling spaces. (LPO-617)So, in your case, maybe the object to add is actually named like "Testdoc " (without the double quotes)? Or the existing object has trainlingblanks?(I can imagine there is a similiar issue with leading blanks, but I donot know.)Btw: Which product version do you use?
Sergio_Pinés_Martín
Nope, no trailing spaces anywhere, just "Test doc"We're using 9.7 now. But we were previously using 9.5. In both cases we have this problem. It's not a terrible problem because I can just do a Search for the document and if the return count is 1 then it exists, otherwise it doesn't, and I can add numbers to the name until it is unique. That's ugly, though, and that's why I would like to use the GetUniqueObject function. But it doesn't work.
Appu_Nair
not sure if it will serve any purpose but I used your same variables and was able to create New Document ,New Document 1,New Document 2 and so on....Looks like the aname is not an assoc as the doc says you a implicit string conversion works.I was using LES9.7.1It is in C# but should be well readable.
Sergio_Pinés_Martín
It works with of our Livelink servers, but not on another.Do you know whether this is one of those options that the administrator can switch on or off? I doubt it, but I can't think of any reason why it works with one server but not the other. My same code, when connecting to one server works fine; when connecting to another, it does not.Both are with LES9.7.1Thanks
Appu_Nair
That is highly unlikely .A couple of things to check basic common sense.a)The patch levels of the server that works and that does not work.b)Are the servers in question connected to the same underlying database or are they say one is DEV and one is PROD.c)Is the lapi call to a LB address in that case you would not know which server is getting hit...d)Are there home customizations/modules that have overridden this call comehow or even the llapi command...I would run sysreport(the lite version) on both servers and compare using TextPad any tell tale signs...
Sergio_Pinés_Martín
sorry, I don't understand half of what you suggest :-(("the patch levels?"In any case, the problem is weirder: on one and the same server, the GetUniqueObject call works when I do it on my personal workspace, but if I access a folder in the enterprise workspace and try there - it does not work: it returns the same name of an already existing document. I use EXACTLY the same code in either case - only changing the folder id to test the GetUniqueObject in one case and in another. In the Personal Workspace, it correctly returns "Test Doc 2"; in the folder under the Enterprise Workspace, I get "Test Doc".I don't get it
Carsten_Kulms
Message from Carsten Kulms via eLinkThe Personal Workspace and Enterprise Workspace reside in differentso-called Volumes ... did you pass the correct VolumeID in the calls?
Appu_Nair
maybe it is because of the personal workspace volumeid and ent workspace volid.Also patch levels means that are all the servers in the cluster have the same patches it is under the \patch directory
Sergio_Pinés_Martín
Sorry - I was misleading when I said that on the personal workspace I get "Test Doc 2" and on the enterprise workspace folder only "Test doc" -- I was in fact using a different, longer name in the latter case (which I did not want to write as it's private, from work).I switched now the name to "Test Doc" on the enterprise workspace folder: and it works!!Hence, the problem seems, quite clearly, to be that the method does not work on names with a greater number of characters than X. I don't know what that X is.WHich makes the method pretty useless...
Pierre_Nocera
Message from Pierre Nocera <
pnocera@opentext.com
> via eLink
eLink
I guess the name can not exceed 248 chars
Pierre
De:
eLink Discussion: LAPI Discussion [mailto:lapi@elinkkc.opentext.com]
Enviada:
qui 18/06/2009 16:58
Para:
eLink Recipient
Assunto:
Has to do with name length
Has to do with name length
Posted by
intato013
(Pinés Martín, Sergio) on 2009/06/18 10:54
In reply to:
even stranger
Posted by
intato013
(Pinés Martín, Sergio) on 2009/06/18 10:42
Sorry - I was misleading when I said that on the personal workspace I get "Test Doc 2" and on the enterprise workspace folder only "Test doc" -- I was in fact using a different, longer name in the latter case (which I did not want to write as it's private, from work).
I switched now the name to "Test Doc" on the enterprise workspace folder: and it works!!
Hence, the problem seems, quite clearly, to be that the method does not work on names with a greater number of characters than X. I don't know what that X is.
WHich makes the method pretty useless...
[To reply to this thread, use your normal E-mail reply function.]
Topic:
GetUniqueObject method does not work?
Discussion:
LAPI Discussion
Livelink Server:
knowledge-wlweb01
To Unsubscribe from this Discussion, send an e-mail to
unsubscribe.lapi@elinkkc.opentext.com
.
Sergio_Pinés_Martín
as the subject says: the "longer" name on which the GetUniqueObject would not work was 44 characters long!!
Appu_Nair
your assessment of 44 characters are probably complicated by the fact that your string (the secret one) does not play nice with the query.(i took it form builder)stmt = 'select Name from DTree where OwnerID=:A1 and ParentID=:A2 and Name like :A3'ownerid is the volidparentid is the container you are trying to put itname is your top secret string.so if you have access to a livereport or sql and see if the secret name is returning results at the 44th position.My guess is that some character in the string is causing that idio syncracy.Otherwise a normal string amounting to 248 characters can be created because the name column is defined at 248Just a thought...
Sergio_Pinés_Martín
could well be. My topsecret string has a couple of brackets, e.g.:"Knowledge First, I love circus [elephants]"Try that. It's probably the brackets. Or the comma. But in any case that already messes up the utility of the GetUniqueObject function.Thanks Appu