You are viewing limited content. For full access, please sign in.

Question

Question

SDK9 Retrieving Documents via Shortcuts

SDK
asked on April 6, 2016

(Were about to upgrade from LF8 to LF9)

Have a [C#] web service originally built on SDK8 that pulls various documents as PDF files.

Now I'm spinning off a SDK9 version to test against the new server.

All the web services operations still work except the one that involves document shortcuts.

I don't know if it's a setting they need to tweak on the new LF server/repository, or if it something I need to adjust for on my end.

Using

instFileID = Results.GetDatumAsString(1, SystemColumn.Id);

I get a number to feed the following..

DocumentInfo docInfo = Document.GetDocumentInfo(Int32.Parse(instFileID), session);

The entry Id seems to be that of the shortcut "7773434", which works fine in 8 but not 9.

From the client I figured out the 'Real' document is "7773426", and if I force that as the 'id' it can pull the document like before.

I've tried to figure out how to use something like EntryLinkInfo and TargetId??
But without an actual example to learn from I'm lost.

Q1: Is there something I can tell the Server people to change in Laserfiche to make it act like the old 8 server? (i.e. make the shortcuts work again)

Q2: If not, how do I get that 'real' Id when my results seem to only have the 'shortcut' one?

(Gee I hope any of that made sense for you)

Thank you for any help.

0 0

Answer

SELECTED ANSWER
replied on April 6, 2016

I don't think anything changed in the 9 server that would explain this, but here is how you resolve a shortcut:

EntryInfo entryInfo= Entry.GetEntryInfo(Int32.Parse(instFileID), session);
if (entryInfo.EntryType == EntryType.Shortcut)
    entryInfo= Entry.GetEntryInfo(((ShortcutInfo)entryInfo).TargetId, session);

// Now entry should be the DocumentInfo
if (entryInfo.EntryType == EntryType.Document)
{
    DocumentInfo docInfo = (DocumentInfo)entryInfo;
    // Process the document here
}

 

3 0
replied on March 1, 2018

It's working , but when searching and result contains a large number of shortcuts , this way will be very slow.

Is there any way to get target document using search syntax? 

0 0
replied on March 1, 2018

Use the SystemColumn.LinkTo column to get the id of the target entry.

1 0

Replies

replied on April 7, 2016

Dear RS, You are my Hero for the Day!!

Though I'd love for things to "just work" the way it did; your AWESOME code sample gave me a successful work-around.

It took a few tries for me to blend it into my code, but as soon as my break point showed the "Real" number within your sample, I knew.

Thank You so much for your help.

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.