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

Question

Question

Set a Tag on the Parent folder using the SDK (RA)

asked on September 4, 2014

 

Greetings,

I have a folder I want to run a workflow on.  I have set the rule to look for the change of adding a Tag. My application creates the folder, adds metadata to the folder, then adds images to the folder in LaserFiche.  After a period of time I need to trigger a workflow, my plan was to set the Tag on the Parent folder.  Can this be done using the SDK?

 

Thanks

Phil

 

0 0

Answer

SELECTED ANSWER
replied on September 4, 2014

Is there another Tag class in your code that is superseding the RA Tag class? Try prefixing Tag.GetInfo with Laserfiche.RepositoryAccess

1 0

Replies

replied on September 4, 2014

You can assign tags using the EntryInfo.AssignTag method in RepositoryAccess, something like this:

 

int docId = 100;
DocumentInfo doc = Document.GetDocumentInfo(docId, Session);
FolderInfo parentFolder = doc.GetParentFolder();

TagInfo tagToAssign = Tag.GetInfo("name of the tag to assign", Session);
parentFolder.AssignTag(tagToAssign, ""); // Saves immediately

 

1 0
replied on September 4, 2014

Robert,

Thanks for the help. I am getting any error when I try to implement this method.  Here is my code.

 

// ====== Set Tag to Triger Workflow ====== 9/4/2014
            int docId = documentID;
            Laserfiche.RepositoryAccess.DocumentInfo doc = 				Document.GetDocumentInfo(docId, mySess); 
            FolderInfo parentFolder = doc.GetParentFolder(); 
            TagInfo tagToAssign = Tag.GetInfo("Packet 				 	Complete",mySess); 
            parentFolder.AssignTag(tagToAssign, ""); // Saves 				immediately 

The error occurs at "Tag.GetInfo" it says;

Error 19 'object' does not contain a definition for 'GetInfo' and no extension method 'GetInfo' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) H:\_Development\VS2012\c#.Net\Document Package Creator\Document Package Creator\Form1.cs 99 39 Document Package Creator
 

I assumed this is a Repository Access assembly.

 

What am I missing?

 

Phil

0 0
SELECTED ANSWER
replied on September 4, 2014

Is there another Tag class in your code that is superseding the RA Tag class? Try prefixing Tag.GetInfo with Laserfiche.RepositoryAccess

1 0
replied on September 15, 2014

Thanks Robert,

It is these little things with C# that I miss.  I will remember to try this in the future.

 

Much Thanks!!

 

Phil

 

0 0
replied on August 20, 2015 Show version history

This was a useful example, Robert. Here's a snippet I used to test this in VB.net, for a document vs a folder.  It uses the same steps with a little different syntax:

 

'Create a Doc Info Object
Dim LF_DocInfo As DocumentInfo = Document.GetDocumentInfo(DocID, LF_Session)
'Create the Tag Info Object
Dim TagToAssign As TagInfo = Tag.GetInfo(sTagName, LF_Session)
'Assign the Tag to the Document
LF_DocInfo.AssignTag(TagToAssign, "")

 

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

Sign in to reply to this post.