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

Question

Question

get tag value

SDK
asked on June 29, 2015

i need to get tag value in c# i can get document field by using get_Field but the tag how do i get it?

0 0

Answer

SELECTED ANSWER
replied on March 4, 2016 Show version history

And roughly the same thing in VB.net.  This code looks to see if a document has a particular tag, which is more challenging than you'd think.  The variable, sIsGeneratedTagName, is the tag name I am looking for.

                LF_EntryInfo = Entry.GetEntryInfo(nDocID, LF_Session)
                LF_Tags = LF_EntryInfo.GetAssignedTags()

                'Iterate through the tag collection
                For Each LF_Tag In LF_Tags

                    Dim ti As TagInfo = Laserfiche.RepositoryAccess.Tag.GetInfo(LF_Tag.TagId, LF_Session)
                    'Check for a tag name
                    If ti.Name = sIsGeneratedTagName Then
                        bIsGenTag = True
                        Exit For
                    End If
                Next

 

1 0

Replies

replied on June 29, 2015

I do not code for LFSO any more, but here is a sample using RA:

        private List<String> AssignedTags(int iEntryID)
        {
            List<String> ReturnList = new List<String>();
            // Only process if we are logged in
            if (CurrentSession != null)
            {
                try
                {
                    // Get the Entry
                    EntryInfo Ent = Entry.GetEntryInfo(iEntryID, CurrentSession);
                    // Get all assigned Tags
                    EntryTagCollection AssignedTags = Ent.GetAssignedTags();
                    // Process each tag
                    foreach (EntryTag eTag in AssignedTags)
                    {
                        // Get TagInfo for EntryTag ID
                        TagInfo CurrentTag = Laserfiche.RepositoryAccess.Tag.GetInfo(eTag.TagId, CurrentSession);
                        // Add it to list of Tags
                        ReturnList.Add(CurrentTag.Name);
                    }
                }
                catch (Exception ex)
                {
                    // Log error here
                }
            }
            return ReturnList;
        }

 

2 0
replied on June 29, 2015

look at the EntryInfo.GetAssignedTags() method.

0 0
replied on June 29, 2015

the TagData property of ILFEntry will give you a collection of assigned tags.

0 0
replied on June 29, 2015

Is there any sample code to get specific tag value 

 

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

Sign in to reply to this post.