-
Notifications
You must be signed in to change notification settings - Fork 2
Blogs
You want to interact with your blog and create entries that will be published at a given date and time? The Blog
and the BlogEntry
class are providing functions for using your own blog (that is bound to your user profile) and enable functions such as publishing entries.
In order to access your Blog, you can use the User.Blog
property. Please note that the ID of the blog is only needed for updating blogs from other users. If you wish to publish entries, all you need is a valid session.
Note: Blog IDs are always equal to the owning user's profile ID
// Create your entry and provide the content being displayed
var myEntry = new BlogEntry("Very cool content", "You can also set the title");
// Publish the entry on the 2nd of September this year at 21:30
myEntry.Publish(session,
new DateTime(2014, 09, 02, 21, 30, 0),
BlogEntry.Settings.Private | BlogEntry.Settings.AllowComments | BlogEntry.Settings.ParseURL);
In this particular example, flags (BlogEntry.Settings
) are set to allow comments by other users and parse URLs that appear in your content by default. Additionally, the Private
flag is set to hide this entry for normal users that do not belong to the staff.
You want to publish the entry now and need a quick and fast function overload?
myEntry.Publish(session);
There you go, the code will publish myEntry
now with the default flags.
While using the publish function, you most likely won't need to know anything about the flags since the AllowComments
flag and the ParseURL
flag are set by default.