Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Dynamically create a thread in the DNN Forums moduleDynamically create a thread in the DNN Forums module
Previous
 
Next
New Post
2/26/2009 1:11 PM
 

HI,

I have been looking around the internet trying to find an example where someone has dynamically created a new thread within a DNN forum.

My project calls for calling DNN from a webservice and passing over some info so that I can create a new thread. Specifically, I would also need to create roles, users for the role, create a new thread and then assign the role to the thread.

Can somone point me in the right direction for this? I am just learning DNN so I need any help possible.

Thanks, Ken

 
New Post
3/2/2009 2:47 AM
 

There are a couple of ways that you could do this.

1.) You could simply do what you need, and monitor the SQL statements that are used, and then replicate the process.  (Not necessarily recommended)

2.) You could add references to the module, and use the methods provided in it's controllers to do everything.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
3/12/2009 9:58 AM
 

HI Mitch,

I created a C# class library that calls the DNN Forums module so that I can create a role, add user to the role, create a forum and then added the role to the forum.

To test this I created a ASP.NET website so that I can call the compiled DLL. I have referenced it in my project and when I run it I get the following error:

Cannot register or retrieve components until ComponentFactory.Container is set

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Cannot register or retrieve components until ComponentFactory.Container is set

Source Error:

Line 5:      Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Line 6:  
Line 7:          Dim obj As New DNNAdminBridge.Admin
Line 8:          obj.Entry(TextBox1.Text)   'pass in the portal name - should be DNN
Line 9:  

Source File: c:\inetpub\wwwroot\DNN\TestWebSite\Default.aspx.vb    Line: 7

Stack Trace:

[InvalidOperationException: Cannot register or retrieve components until ComponentFactory.Container is set]
   DotNetNuke.ComponentModel.ComponentFactory.VerifyContainer() +57
   DotNetNuke.ComponentModel.ComponentFactory.GetComponent() +12
   DotNetNuke.Security.Roles.RoleProvider.Instance() +10
   DotNetNuke.Security.Roles.RoleController..cctor() +5

[TypeInitializationException: The type initializer for 'DotNetNuke.Security.Roles.RoleController' threw an exception.]
   DotNetNuke.Security.Roles.RoleController..ctor() +0
   DNNAdminBridge.Admin..ctor() +44
   _Default.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\DNN\TestWebSite\Default.aspx.vb:7
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

Any thoughts on how to fix this?

Thanks, Ken

 
New Post
3/12/2009 10:28 AM
 

Hey Ken,

I recently did exactly what you are talking about for one of my customers. The answer lies somewhere between the two suggestions that Mitch gave you. The API for adding posts is a bit tricky due to the nature of the DNN forums module. I would caution you to to not over think it. Let DNN do what it can for you. I had lots of issues with caching. the posts would be added to the database, but not be displayed in the forums You have to call a function  that clears all the cache.

If you need anything let me know and I will try to help you out as I am able.

Kind Regards,

John

 


Cheers!
John Valentine
http://www.webinnovationsystems.com
 
New Post
3/12/2009 11:38 AM
 

It looks like you are running your code from a test page that isn't a DNN installation with proper web.config configuration and proper context initialization.

If you want to run your code in a test page, you will have to properly manually initialize all the DNN contexts you will need.

Have you tried running this code from a test DNN module, inside a DNN installation?

 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Dynamically create a thread in the DNN Forums moduleDynamically create a thread in the DNN Forums module


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out