List of Tagged Content through the API

I need some help navigating through the API to find a way to get a list of tagged content. I'm happy to do this through iBO, Webservices or the iMIS business objects directly.

My goal is to produce a custom .NET control that passes in a tag and returns the title and description for content records that have been 'tagged' with that tag. I know that I can use a Tagged Content List iPart to do this - however the output is not controlled enough for what I need it to do.

Any help appreciated.

Regards

Jay

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Are tags in the blob?

My initial thinking was that tags were in a blob in the content table. Which seems strange - because we need to be able to get at tags more easily than that.

Is the  table - Tagged_Page_Interest_Category - the mechanism for tagging content pages?

In 15.1.3 all iparts were meant to have been rewritten using web services, which means that the web services for the tagged list should be available. Does anyone know where theese are documented?

They're in Tag and UniformTag

Just FYI, WCM tags are stored in the Tag and UniformTag tables.  All of the content/tag related table names with underscores in them are the old eCM tables.

As for the part about iParts being rewritten to use web services - this is mostly true.  All of the iParts we are currently working on and all of the ETP iParts that shipped with 15.1.3 are/have been rewritten using SOA.  However, all of the old content related iParts (ContentHTML, ContentLink, etc.) still remain the same.  If having access to content records, tags, navigation, etc. via SOA is important to you then feel free voice your opinions to Tech Support or your favorite ASI Product Manager.

Hope this clears things up.

Courtney Robertson

I think having the tags

I think having the tags available via SOA is important if we want to start writing tag clouds, or wordles or creative stuff like that with out content.. Will voice to PM

Hi Jay, iBO and the iMIS web

Hi Jay,

iBO and the iMIS web service (Soa) do not currently support WCM object (navigation, content, tags, etc.).  The content related objects in iBO are actually eCM objects.  This means you will have to use Asi.Business.ContentManagement.dll to achieve what you need.  I should warn you that this library, and several other Asi libraries, are not documented partly because they are subject to change from release to release.  However, I have mocked up some code that I believe will get you what you need.  I haven't tested it, so it may need some tweaking, but here it is:

// Define a container to be used later - this will ensure better performance when retrieving content
Asi.Business.BusinessContainer container = new Asi.Business.BusinessContainer();

// Find tags by name (if you have the tag key already, skip to the cod in the first for loop
Asi.Business.ContentManagement.TagController tc = new Asi.Business.ContentManagement.TagController();
System.Data.DataRow[] rows = tc.SelectWithFilter(new Asi.Business.BusinessFilter[] {new Asi.Business.BusinessFilter("Name", ComparisonType.Equal, "[TagName]")});

Asi.Business.ContentManagement.UniformTagController utc = new Asi.Business.ContentManagement.UniformTagController();
foreach (var dataRow in rows) {
    // Retrieve content by UniformKey Guid tagKey = ((Asi.Business.ContentManagement.Tag) dataRow).TagKey;
    Asi.Business.ContentManagement.UniformTag[] uniformTags = utc.GetUniformTagsByTag(tagKey, true);
    foreach (var uniformTag in uniformTags) {
        Asi.Business.ContentManagement.Content content = Asi.Business.ContentManagement.Content.GetFromContentKey(uniformTag.UniformKey, container); 
        if (content != null)
            // Do something (We check for null because tags will be used for more than just content in the future) 
    }
}

Good luck,
Courtney Robertson

Filter?

Courtney

Thanks so much for this... however when I've been playing with it i'm getting the following error:

Specified filter is not valid for the controller, property ,Name

Is there a way to determine, given the controller being used, what the valid properties are that I can filter on?

Thanks

Jay

Whoops, I got one thing

Whoops, I got one thing wrong. Change the line that creates the TagController to this:

Asi.Business.ContentManagement.TagController tc = Asi.Business.ContentManagement.TagController.NewTagController(container);

You should be able to filter on any of the properties defined in the business object for which the controller belongs.  In this case, you could open the Tag BO in order to view which properties you are able to filter on.

Good luck,
Courtney Robertson

Tagged List using Items By Tag Report IQA

We are also trying to create a custom tagged list . We have been able to create the list using the "Items By Tag Report" IQA. This is working perfectly except for the date. The only dates ware are able to get from this is the actual date the record was actually created (vBoDocument.CreatedOn) . the date we need to filter on is the same as a normal tagged list ( date of publication or important until date) , but I cannot find a way to access this through this IQA. Does anyone know the Business Object that would let me access either date of publication or important until date?

I was not able to get the code above to work , but am happy to use that instead if anyone can update it with the correction needed to make it work. I was getting the same error as the previous reply was.

Any help in this regard would be really appreciated.

Thanks

James

James Harrison
www.visualantidote.com

Yes, the published date is

Yes, the published date is in serialized in the blob, so you'd need to use the API like the above coding example to get the pieces you need. In IQA, the UpdatedOn field might be a little closer to what you need, but I don't believe it's identical to the PublishedDateTime.

When you tried the example above, did you replace the tag controller line with the comment right above yours?

Asi.Business.ContentManagement.TagController tc = Asi.Business.ContentManagement.TagController.NewTagController(container);

Courtney

Thanks!

Hi Courtney,

Thanks for your reply. I will give that a try. What I ended up doing was using a SQl lookup to find the documents tagged, I ran out of time unfortunately and I just couldn't get the code above in this post to work, so I needed to use SQL to get it done on time. Here is the lookup I used:

string sql = "SELECT DISTINCT vBoTag.Name AS Tag_Name, vBoDocument.DocumentKey as DocKey, vBoDocument.AlternateName AS Item_Name, vBoDocument.Description AS Item_Description, vBoDocument.CreatedOn as Date FROM vBoTag INNER JOIN vBoUniformTag ON vBoTag.TagKey = vBoUniformTag.TagKey INNER JOIN vBoDocument ON vBoUniformTag.UniformKey = vBoDocument.DocumentVersionKey ";
sql += "WHERE ( (vBoTag.AccessKey IS NULL OR EXISTS (SELECT 1 FROM AccessItem zai INNER JOIN UserToken zut ON zai.Grantee = zut.Grantee WHERE zai.AccessKey = vBoTag.AccessKey AND zut.UserKey = 'e982d078-994a-4bf9-b424-1010e64097d4' AND (zai.Permission&3)>0)) AND (vBoDocument.AccessKey IS NULL OR EXISTS (SELECT 1 FROM AccessItem zai INNER JOIN UserToken zut ON zai.Grantee = zut.Grantee WHERE zai.AccessKey = vBoDocument.AccessKey AND zut.UserKey = 'e982d078-994a-4bf9-b424-1010e64097d4' AND (zai.Permission&3)>0)))AND((vBoDocument.DocumentStatusCode = 40))";
sql += "and vBoTag.Name like '%i%' ";
sql += "and vBoDocument.AlternateName != ' ' ";
sql += "order by vBoDocument.CreatedOn";

This works for now, but I would love to swap it in for a proper business object, so I'll give your updated code a try when I'm given some extra time and I'll let you know how it goes.

Thanks again for your time

James
jharrison@visualantidote.com

____________________________________
Visual Antidote
www.visualantidote.com
view our free WCM tutorials!