Forums

 
  Support Forum  Modules  Engage: Publish  Programmatically add tags to an article
Previous Previous
 
Next Next
New Post 2/25/2009 1:02 PM
Resolved
  jjk1977
14 posts
10th Level Poster


Programmatically add tags to an article 

Hi all,

First of all my compliments on the engage publish module. It's a good module which can be configured to my needs.

I'm writing an articles import routine to import my old articles database in the Engage Publish tables. As suggested on this forum I'm using a DNN module written in C# for this task, which enables me to programmatically add the articles. I'm pretty far along, but I'm struggling with importing tags at the moment .

What I want is to import keywords from my old articles database as tags in Engage Publish. However I have no clue how to pull this off in code.

I'm hoping someone can provide me with a code example on how to add tags to new / existing articles programmatically. I would really help me out!!

Kind regards,
JJK1977

P.S. Apologies for my poor English. I'm not a native english speaker.

 
New Post 2/25/2009 1:32 PM
  Chris Hammond
1115 posts
1st Level Poster


Re: Programmatically add tags to an article 
Modified By Chris Hammond  on 2/25/2009 2:33:40 PM)

Sorry the forum hosed my post. I'll clean it up


Directory of Training Programs, DotNetNuke Corporation
 
New Post 2/25/2009 1:34 PM
  Chris Hammond
1115 posts
1st Level Poster


Re: Programmatically add tags to an article 

Alright, let's try this again

If you're trying to parse a comma seperated list you can use the following methods, this assume you already have an Article object called "a"

foreach (Tag t in Tag.ParseTags(post.mt_keywords, portalId))
{
    ItemTag it = ItemTag.Create();
    it.TagId = Convert.ToInt32(t.TagId, CultureInfo.InvariantCulture);
    a.Tags.Add(it);
}

That will look up a tag in the database, if it doesn't exist it will add it to the database, and then return the proper information to be added to the article.tags collection.

Hopefully that helps, if not please let me know.

 

 


Directory of Training Programs, DotNetNuke Corporation
 
New Post 2/25/2009 1:46 PM
  jjk1977
14 posts
10th Level Poster


Re: Programmatically add tags to an article 

Thanks Chris. I will try this immediately.

Sorry for posting in the wrong topic. I couldn't make any sense of your answer, but now I see why

 
New Post 2/25/2009 2:13 PM
  jjk1977
14 posts
10th Level Poster


Re: Programmatically add tags to an article 

Problem solved!

Thanks for your help.

 
Previous Previous
 
Next Next
  Support Forum  Modules  Engage: Publish  Programmatically add tags to an article

Purchase

Please click here to buy now.
Payment will be processed via credit card or PayPal.

Please click here to buy now.
Payment will be processed via credit card or PayPal.

Test Drive!

Want to find out how it works? Visit our demo site to see the modules in actions!

Want to find out how it works? Visit our demo site to see the modules in actions!

Subscribe

Sign up for our newsletter and get the latest product updates!

Sign up for our newsletter and get the latest product updates!

Online Support

Powered by DotNetNuke