More in this section

Forums / General Discussions / SF 4.1 Blog Publish Date

SF 4.1 Blog Publish Date

6 posts, 0 answered
  1. Boas
    Boas avatar
    13 posts
    Registered:
    30 Sep 2008
    18 Apr 2011
    Link to this post
    Hi

    I created a small sitefinity site for my sons blog.
    Now i want to manually migrate his postings to the new blog.
    How can I set manually the publish date ?

    in SF3 there was a box to set the public post date, but i can't find anythin in SF 4.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 Apr 2011
    Link to this post
    Hello Boas,

    You have to use the fluent or standard API.

    http://www.sitefinity.com/40/help/developers-guide/sitefinity-essentials-modules-blogs.html

    After the item is created, you need to get it for editing and set the PublicationDate property.

    sample

    protected void SetPublicationDate()
         {
             var fluent = App.WorkWith();
           
             //set publication date
             var publicationDate = DateTime.UtcNow.AddDays(-10).AddYears(-2);
      
             //get the required blog
             var post = fluent.BlogPosts().Where(p => p.Title == "fda").First();
      
             post.CheckOut()
                 .Do(n => { n.PublicationDate = publicationDate; })
                 .CheckIn()
                 .Publish()
                 .Do(n => { n.PublicationDate = publicationDate; })
                 .SaveChanges();
      
         }

    We have logged a task about this issue and we are going to work on UI implementation.

    All the best,
    Ivan Dimitrov
    the Telerik team

  3. Boas
    Boas avatar
    13 posts
    Registered:
    30 Sep 2008
    19 Apr 2011
    Link to this post
    Cool thanks

    is it a bad idea to just send an SQL Update comman to the SQL Server ?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    19 Apr 2011
    Link to this post
    Hello Boas,

    I suggest that you should use the API , because of the relations to many tables.

    All the best,
    Ivan Dimitrov
    the Telerik team

  5. Brandon
    Brandon avatar
    50 posts
    Registered:
    30 Jul 2009
    19 Apr 2011
    Link to this post
    would this same thing need to be done with the news items and when they are published? for instance we use news items and set some of them to a category called press releases. the problem i see is when i added about 30 manually in the same day they all have that publish date and i cannot easily change it.

    3.7 had a feature to edit this portion...will this be included anytime soon?
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    19 Apr 2011
    Link to this post
    Hi Brandon,

    The same applies for news. I know that there was UI in 3.x and this is why we logged a task for extending Sitefinity 4.0 UI with fields that will allow you to change the PublicationDate value.

    Greetings,
    Ivan Dimitrov
    the Telerik team

6 posts, 0 answered