+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / No luck with- Custom RSS provider for Events Module to display Start Date and End date

No luck with- Custom RSS provider for Events Module to display Start Date and End date

12 posts, 0 answered
  1. san
    san avatar
    61 posts
    Registered:
    20 Aug 2010
    02 Aug 2011
    Link to this post
    Hello,

    I started a post for displaying the start date, start time, end date and end time in the RSS feed generated by Sitefinity RSS provider for Events module. The RSS feeds generated for Events through Sitefinity don't have start date or end date information, it just shows publication date by default which is not useful as people would like to syndicate to the rss and would be useful to know the event start and end date rather than publication date.

    I have also looked in to the blog posting as suggested, but it was for the blogs module. 

    I started working on the code, but it seems that for the Events module there are no properties associated with start date, time and end date and time.I have searched all the forums but I have not been able to find any information on customizing RSS provider for Events Module to display start and end information.
    Can this be done in Sitefinity or it is not possible to accomplish this. Can someone please direct me to the correct example if it possible. 

    Thank you for all your time.

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    02 Aug 2011
    Link to this post
    Hi San,

    All content objects that the Rss shows are represented by RssItem. The RssItem does not have Start_Date and End_Date properties

    http://www.sitefinity.com/help/developer-manual/telerik.rss-telerik.rss.rssitem_properties.html

    There is a similar property that RssItem uses and this is Publication_Date.

    You can inject the Start_Date and End_Date properties of the event item into description by overriding SetDescription method of the channel

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. san
    san avatar
    61 posts
    Registered:
    20 Aug 2010
    02 Aug 2011
    Link to this post
    Hello Ivan,

    Thank you for letting me know, I haven been looking around for this.
    Could you please direct me to sample code for overriding the SetDescription method for injecting the dates.I am  not still able to access the Start_Date property of each item that i am passing. Please let me know.

    Thank you for your help.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    02 Aug 2011
    Link to this post
    Hi San,

    You need to create a custom class that inherits from Telerik.Events.Rss.RssChannelProvider

    public class EventsRssChannelProviderCustom : Telerik.Events.Rss.RssChannelProvider
    {
        public EventsRssChannelProviderCustom()
        {
        }

        protected override void SetDescription(Telerik.Rss.RssItem item, IContent content)
        {
            base.SetDescription(item, content);
        }
    }

    The change the base of SetDescription.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. san
    san avatar
    61 posts
    Registered:
    20 Aug 2010
    02 Aug 2011
    Link to this post
    Hello Ivan,

    Sorry,I did not understand your last line. "The change the base of SetDescription."

    I already have the same code, but as we can not get the start_date, end_date, end_time and start_time of the event i am having difficulty appending it to the description. Could you please provide me some suggestions.

    Thank you.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    03 Aug 2011
    Link to this post
    Hello San,

    As you can see the second parameter of the method is content item, so you can get the metadata from there using content.GetMetaData("Event_Start").

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. san
    san avatar
    61 posts
    Registered:
    20 Aug 2010
    03 Aug 2011
    Link to this post
    Hello Ivan,

    Thank your help. I am able to get the start time and end time as suggested but i am not able to change the description/ append it to the description of the event. The base.SetDescription(item, content); is taking only two parameters. I am using the code below and it seems that the variables are not being append to the description field.

     
    protected override void SetDescription(RssItem item, IContent content)
        {
             
           
     
     
            DateTime starttime = (DateTime)content.GetMetaData("Event_Start");
            DateTime endtime = (DateTime)content.GetMetaData("Event_End");
     
     
            item.Description = "Start Time: " + starttime + "End Time:"+ endtime +item.Description;
     
     
            base.SetDescription(item, content);
     
     
        }


    Could you please look at the code and let me know about the problem.

  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    03 Aug 2011
    Link to this post
    Hello San,

    You should not call the base when you want to modify it.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. san
    san avatar
    61 posts
    Registered:
    20 Aug 2010
    03 Aug 2011
    Link to this post
    Hello Ivan,

    I have removed the base.SetDescription(item, content); line.

    But, when if we just use:

    item.Description = "Start Time: " + starttime + "End Time:"+ endtime +item.Description;


    it is only printing the start time and end time with out the description, so the description for the event is not being displayed. Can you please suggest me how can i append this information to the description. 

    Thank you.
  10. san
    san avatar
    61 posts
    Registered:
    20 Aug 2010
    03 Aug 2011
    Link to this post
    Hello Ivan,

    I have tried everything I can, but I am not able to get the description/summary to be displayed. When I append the start and end date to item.Description, it display only the start and end date variables.



    protected override void SetDescription(RssItem item, IContent content)
        {
            DateTime starttime = (DateTime)content.GetMetaData("Event_Start");
            DateTime endtime = (DateTime)content.GetMetaData("Event_End");
      
            item.Description = "Start Time: " + starttime + "End Time:"+ endtime +item.Description;
     
        }


    I have tried using: string eventcontent = (string)content.GetMetaData("Summary"); 
    and appended this variable to item.Description along with start and end date varaibles, but still the event RSS item is not displaying the content/summary, it displays only the start date and end date. Is there any other method for content.GetMetaData to get the content/summary of the event so that i can append it to the start and end date and display it in the description field

    Please let me know. Thank you for your time.
  11. san
    san avatar
    61 posts
    Registered:
    20 Aug 2010
    04 Aug 2011
    Link to this post
    Hello Ivan,

    Could you please let me know , how I can access the description so I can append the the start date and end date to it. I have looked into the developer manual, but I could not find any solution. Please let me know.

    Thank you,
  12. san
    san avatar
    61 posts
    Registered:
    20 Aug 2010
    04 Aug 2011
    Link to this post
    At Last got it to work. Thank you for your help Ivan.

    Below is the code if someone is looking for it:
    protected override void SetDescription(RssItem item, IContent content)
        {
            DateTime starttime = (DateTime)content.GetMetaData("Event_Start");
            DateTime endtime = (DateTime)content.GetMetaData("Event_End");
            DateTime expirationdate = (DateTime)content.GetMetaData("Expiration_Date");
            string city = (string)content.GetMetaData("City");
            string street = (string) content.GetMetaData("Street");
            string state = (string)content.GetMetaData("State");
            string summary = content.Content.ToString();
            item.Description = " Start Time: " + starttime + " End Time: " + endtime + " Expiration Date: " + expirationdate + " City: " + city +
           " Street: " + street + " State: " + state + "<br/>" + summary;
        }
Register for webinar
12 posts, 0 answered