More in this section

Forums / Developing with Sitefinity / Create blog post under specific user permissions

Create blog post under specific user permissions

1 posts, 0 answered
  1. Jorge
    Jorge avatar
    1 posts
    15 Jan 2011
    29 Apr 2011
    Link to this post
    Hello, I am trying to create a blog post using the sitefinity API. For this purpose I created a webservice. Everything works fine, but all the blog posts are created by the "admin" user. Now I want to be able to specify the user credentials of the user that should be the owner of the blog post, but I couldn't find a way to do this.

    I am using sitefinity 3.7.2136, and this is the code I use to create the blog posts:

    public bool WritePost(string blogName, string postTitle, string postHtmlContent, string postAuthor, DateTime publicationDate)
        var manager = new BlogManager();
        var blogs = manager.GetBlogs();
        var blog = (blogs.Cast<IBlog>()).First(b => b.Name.Equals(blogName));
        var postContent = manager.Content.CreateContent("text/html");
        postContent.ParentID = blog.ID;
        postContent.Content = postHtmlContent;
        postContent.SetMetaData("Author", postAuthor);
        postContent.SetMetaData("Title", postTitle);
        postContent.SetMetaData("Publication_Date", publicationDate);
      catch (Exception)
        return false;
      return true;
1 posts, 0 answered