When creating a blog post, you must perform the following:
Check whether the blog post already exists.
Before you create the blog post, you must check whether a blog post with the same ID already exists.
Create the blog post.
If the blog post does not exist, you create a new blog post with the specified ID.
Specify the parent blog of the blog post.
Specify to which blog the blog post belongs.
Set the required properties.
When creating a new blog post, it is recommended to set at least the following properties:
You can also set any other properties (e.g. Author, Summary, etc.) in this step.
Save the blog post.
Save all changes that you have made to the blog post.
Publish the blog post.
Finally, you publish the blog post using the workflow manager.
The example below shows you how to create blog post with predefined ID.
NOTE: The ID argument is assigned to the master version of the blog post. For more information about the different versions of a blog post, see For developers: Content lifecycle.
The following code creates a blog post with the specified ID, Title and Content.
First, you get an instance of the BlogsManager class. You check whether a blog post with the same ID already exists. To create the blog post, you call the CreateBlogPost method of the BlogsManager class. You can create a blog post with either predefined or auto-generated ID depending on which overload of the method you use. The method returns the master version of the blog post. Then, you set the properties of the master version. It is recommended to set at least the following properties: Title, Content, UrlName, LastModified, PublicationDate, DateCreated. To save the changes, you call the SaveChanges method of the manager. Finally, to publish the blog post, you call the MessageWorkflow method of the WorkflowManager class and pass the required parameters.
First, you check whether a blog post with the same ID already exists. Then, if it does not exist, you create the blog post by calling the CreateBlogPost method of the singular facade of the parent blog. The ID argument is assigned to the ID master version of the item. To set the properties of the blog post, you call the Do method of the facade. Then, you save the changes. Finally, to publish the blog post, you call the MessageWorkflow method of the WorkflowManager class and pass the required parameters.
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important
Copyright © 2022 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.
Powered by Progress Sitefinity