Create a New Post Manually

Oct 28, 2012 at 3:40 AM

I'm writing a utility which will run regularly and consume an rss feed from another blog.

I'm trying to figure out how to programically post from a c# application.

I found in the App_Data\posts folder xml's of my varous posts, but it doesn't appear to be as simple as adding an xml for my new post there.

Can you provide some guidance?

Oct 28, 2012 at 3:54 AM

It never fails, when I ask, I find the answer minutes later.

According to another post (http://blogengine.codeplex.com/discussions/240596), I simply need to add a space or some kind of minor change to the Web.config file and the blog will read in the new files.

 

Just in case there's a better answer, please confirm.

Coordinator
Oct 28, 2012 at 5:16 AM

Take a look at "SaveQuickPost" method in this class. All you need from there is how to create new Post object, assign properties and save it. Saved as published, it will appear right away.

Oct 28, 2012 at 3:23 PM
Edited Oct 28, 2012 at 3:26 PM

That is helpful rtur, thanks.  I'll likely be using that in my second version of the utility since i already built and tested the other one.

If anyone is interested, here's a link to my VS2010 console project.  I use this exe and windows scheduled tasks to execute every morning at 4am. 

It consumes an IBM DeveloperWorks RSS feed.  They are served via https and it makes the process of acquiring RSS more difficult.  Anyways, now that we have the RSS objects, i save them out to XML after confirming the RSS item doesn't already exist in the app_data\posts folder.  Then I append a space to the Web.config file. 

https://dl.dropbox.com/u/41985632/RSS%20Blog%20Poster.zip

Note:  I have a main site with a virtual directory called "blog".  This basically means i have to delete the web.config from the blog directory after moving a bunch of items to my main apps web.config.  This is how I was able to integrate the blog engine with my MVC4/Razor main app.