Blogging and News Syndication Software

Blogger API, RSS API, Atom API, and more.
posts - 17, comments - 14, trackbacks - 26

My Links

News

Tortuga Components / Software Tools Home

See Also: Chilkat Software

Article Categories

Archives

Post Categories

Recommended

MetaWeblog API .NET: EditPost

C# sample code using the Tortuga MetaWeblog .NET API to edit an existing blog post.
The Tortuga Beta .NET Component can be downloaded from MetaWeblog .NET
The download contains an .NET class library (DLL) that needs to be referenced from your C# or VB.NET project.

// Use the Blogger 1.0 API to get the Blog ID
Tortuga.Blogger1 blogger1 = new Tortuga.Blogger1();

blogger1.Login = "tortuga";
blogger1.Password = "password";
blogger1.ServiceUrl = "http://www.squarespace.com/do/process/external/PostInterceptor";

bool success = blogger1.GetUsersBlogs();
if (!success || (blogger1.NumBlogs == 0)) return;

string blogId = blogger1.GetBlogId(0);

Tortuga.MetaWeblog mwlog = new Tortuga.MetaWeblog();
mwlog.Login = "tortuga";
mwlog.Password = "password";
mwlog.ServiceUrl = "http://www.squarespace.com/do/process/external/PostInterceptor";

// Download the 10 most recent posts
int nPosts = mwlog.GetRecentPosts(blogId, 10);

// The most recent post is at index 0, the oldest post is at index nPosts-1
// This example will change the title of the most recent post.
string newTitle = mwlog.GetRecentPostTitle(0) + " ABC";
string postId = mwlog.GetRecentPostId(0);
string postContent = mwlog.GetRecentPostDescrip(0);
bool publish = true;

success = mwlog.EditPost(postId, newTitle, postContent, publish);
if (success) 
{
	MessageBox.Show("Success!");
}
else
{
	MessageBox.Show("Failed to edit post");
}

Print | posted on Sunday, September 25, 2005 12:53 PM |

Feedback

No comments posted yet.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 

Powered by: