Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > How to import Forums View modes: 
User avatar
Member
Member
tomasz.kosinski-tatukgis - 9/7/2009 3:32:57 AM
   
How to import Forums
I have a quite big existing forum which I want to import into Kentico. I tried to understand the API logic related to forums but w/o big sucess. Can you you give me a hint how to do this?

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 9/15/2009 2:50:26 AM
   
RE:How to import Forums
Hello,

Actually you can create your own script for that using our API. Please see following example for creating a forum group, forum and post:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


using CMS.Forums;
using CMS.CMSHelper;


public partial class CMSTemplates_CorporateSiteAspx_testDominikPForum : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Create new forum group
ForumGroupInfo fgi = new ForumGroupInfo();

// Set properties
fgi.GroupDisplayName = "My group";
fgi.GroupName = "MyGroup";
fgi.GroupSiteID = CMSContext.CurrentSiteID;

// Insert into database
ForumGroupInfoProvider.SetForumGroupInfo(fgi);

// Create new forum
ForumInfo fi = new ForumInfo();

// Set properties
fi.ForumGroupID = fgi.GroupID;
fi.ForumName = "MyForum";
fi.ForumDisplayName = "My forum";
fi.ForumModerated = false;
fi.ForumSiteID = fgi.GroupSiteID;
fi.ForumOpen = true;
fi.ForumAccess = 0;
fi.ForumThreads = 0;
fi.ForumPosts = 0;

// Insert in database
ForumInfoProvider.SetForumInfo(fi);

// Create new post
ForumPostInfo fpi = new ForumPostInfo();

// Set properties
fpi.PostForumID = fi.ForumID;
fpi.PostSubject = "Some subject";
fpi.PostUserName = CMSContext.CurrentUser.UserName;
fpi.PostTime = DateTime.Now;
fpi.PostApproved = true;


// Update database
ForumPostInfoProvider.SetForumPostInfo(fpi);
}
}


Please note that you will need to import users as well (or use preexisting one) - in terms of each post needs to be connected with appropriate user.

Please more details about our API: http://devnet.kentico.com/downloads/kenticocms_api.zip

Best Regards
Ondrej Vasil

User avatar
Member
Member
ken.walpurgis-atalasoft - 11/3/2009 8:21:19 PM
   
RE:How to import Forums
I have had some success getting the forum posts into Kentico. One thing that i am running into is linking all the threads together. I tried setting the PostParentId but that does not seem to work.

So none of the forum posts are "linked", so each of them has 1 post.

Is there another way to have the posts be in threads?

thanks.

User avatar
Member
Member
Tomek - 11/4/2009 7:44:46 AM
   
RE:How to import Forums
On my side this solved the problem:

childpost.PostParentId = masterpost.PostID

User avatar
Member
Member
ken.walpurgis-atalasoft - 11/4/2009 9:55:46 AM
   
RE:How to import Forums
thank you very much, that pushed me in the right direction.

User avatar
Member
Member
JohnSD - 7/28/2010 1:47:40 PM
   
RE:How to import Forums
Hi Ondrej,
I downloaded this zip file and it seems that the .chm help file is broken. when I click on any of the menu items, I get the error "Navigation to the webpage was canceled" in the left view pane.

I also tried downloading the API reference from the documentation page on the website http://devnet.kentico.com/Documentation.aspx and I got the same error messages when looking at the documentation.

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 8/2/2010 7:25:19 AM
   
RE:How to import Forums
Hello,

there is tip on how to trouble shoot this issue here: http://devnet.kentico.com/Documentation.aspx:

If you cannot open the CHM files, please try these steps:

1. Right-click the CHM file, and then click Properties.
2. Click Unblock.
3. Double-click the CHM file to open the file.

If it doesn't help, please see this FAQ for more tips.

Best regards
Ondrej Vasil

User avatar
Member
Member
JohnSD - 8/2/2010 11:29:35 AM
   
RE:How to import Forums
Thx, clicking "unblock" worked.