Sharing Content Across Multiple Sites - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Sharing Content Across Multiple Sites

  • Sharing Content Across Multiple Sites
  • I am under a time crunch to find a solution to this issue, so a fast response would be appreciated.
    I am building a site in which multiple, independent instances will be created (for example, exampleSite01.com, exampleSite02.com).  Each of these sites will have their own Sitefinity database.  I want to share Events created on each of these sites across all the sites and display them on a calendar (RadScheduler).  So exampleSite01.com would be able to display all events created on exampleSite01.com and exampleSite02.com, and vise-versa.  How would I share this content across Sitefinity sites?

    Thanks.
  • Hello Geoff,


    The events module can be shared using the bellow steps:

    1) Create the main website which will create the events.
    2) Create secondary website which will pull events from the first one.
    3) Add a connection string in the second site which points to the database of the first one (section Data -> ConnectionStrings in Advanced Settings).
    4) Configure events data provider which pulls events items from the main website by adding connectionString parameter to the OpenAccessDataProvider parameter with value the name of the connection string from step 3. You can do this from Settings >> Advanced

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  • Thank you for the quick response, Ivan.

    It looks like this allows me to pull events from another Sitefinity site, but I need to also retain the ability to manage events from the local site database.  Ideally, exampleSite01.com would have read and write privileges to the Events stored on exampleSite01.com and exampleSite02.com. Also, exampleSite02.com would have access to the same Events.

    The application of this is that independent sites are going to exist for different regions. A nationwide site will have Events. A site for a particular city would have its own Events, but then also interact with the nationwide Events of the other site, so it would need access to the Events on both sites.

    Is there a way to use a connection string to manage Events from another site using the fluent API?  This would allow me to aggregate all the events from several sites and display them on a calendar, and hopefully edit/update the Events, if necessary.

    Thanks.
  • Hello Geoff,

    Thank you for getting back to us.

    This is option is also available. In step 4 instead of editing the default data provider for events in the second website you will simply create a new events data provider with the same settings as the default one, just with different name and add connection string to the main events site. Also you will have to change the applicationName value for the default events provider.

    Also please note that since you are going to share events you will also need to share taxonomies. This means that you will have to add a connectionString parameter to the default taxonomies provider.

    Greetings,
    Radoslav Georgiev
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  • Awesome.  Thank you, Radoslav.

    My next question is, how do I get access to these events through the fluent API?
    I would expect this to return all the events in Sitefinity:
    IList<Event> events = App.WorkWith().Events().Get().ToList();
    But it is only returning the Events from the default data provider.  I didn't see a way to specify which data provider to use in the fluent API.  How would I retrieve the events created with the other data provider pointing to the other site?

    Thanks.
  • Hi Geoff,

    You should try setting the provider name before you call WorkWith using Prepare:
    App.Prepare().SetContentProvider("NameOfYourProvider").WorkWith().Events();


    Kind regards,
    Radoslav Georgiev
    the Telerik team
  • Thank you.  You have been a huge help.
    I have one more question on this topic.  Is there a way to get a listing of the available Content Providers, or more specifically Event Content Providers?  This would allow me to iterate through the available content providers to gather all the events or to create an admin dialog to select from the available content providers, instead of hard coding the content provider name.

    Thanks.
  • In addition to my last question, I am beginning to have issues using custom event fields while using multiple event data providers.  I have created the same custom field for each event data provider.  In my case, it was named "Price" and was a Currency field.  When this field is created, a few things begin to happen:

    -The event names change from the event title to the event url name (e.g. "Event 01" becomes "event-01").

    -When I access the events programatically, events not from the primary data provider have a null title and the url name ("event-01") populates the description field.

    -I begin to periodically get null reference exceptions when interacting with the non primary data provider events through the sitefinity backend.

    When I remove the custom fields, the issues go away and I can interact with the events through the fluent API and the sitefinity backend.  Is anyone else able to reproduce these issues?

    Are these known issues and/or is there a different recommended path to using custom event fields while using multiple event data providers?

    Thanks.
  • Hi Geoff,

    Custom fields are supported per persistent type and not per provider. Actually, the user interface does not allow creating more than one custom field with the same name. Could you please describe the steps for creating fields with the same name in order to reproduce it locally?

    Regarding the question for getting all providers, you could use EventsManager ProvidersCollection static property.

    Greetings,
    Pepi
    the Telerik team
  • Thanks, Pepi, for the EventsManager.ProvidersCollection.

    To create the custom fields, I created 2 event data providers (OpenAccessDataProvider and OpenAccessDataProvider2).  OpenAccessDataProvider is the default event data provider. OpenAccessDataProvider2 points to my second Sitefinity site.

    I navigated to Content -> Events and selected OpenAccessDataProvider, then in the right sidebar, I selected "Custom Fields for event".

    I created a custom field named "Price" as a "Currency" type.  I left all other options as their default values.  I then saved changes.

    I went back to Content -> Events and repeated the process for the OpenAccessDataProvider2 tab.

    The UI did not prevent me from created this field for each data provider, but as soon as I created the custom field for OpenAccessDataProvider, the event names on OpenAccessDataProvider2 changed from event title (Event 01) to event url name (event-01).

    Thanks.
  • Regarding custom fields, I have multiple event data providers across multiple Sitefinity sites and need to create custom fields, such as a Price field, to be used across all events from all sites.  What is the recommended approach to accomplishing this?  Is there a way to share the custom fields across sites?  Do I need to recreate them on each site?

    Pepi, have you been able to duplicate the issue that I described in my last post?

    Thanks.
  • Hi Geoff,

    Actually, our QAs reproduced the following issue and here are the steps:
    1. Add two custom providers for Events (the second one points to another database)
    2. Create a custom field for the default provider. Note that this field is visible under the second provider and the UI does not allow adding it twice.
    3. Go and edit the events under the second provider. The result is that they throw "Object reference not set to an instance of an object" exception. Creating a new event also results in an error message. Note that this is not reproducible for the default provider events.
     
    The described problem was logged as a bug and its fix will be available in upcoming Q1.

    Greetings,
    Pepi
    the Telerik team
  • Thanks for keeping me up to date, Pepi.

    That sounds accurate from what I've seen.  So to make sure I'm understanding correctly, this issue will be resolved in the Q1 release, which is scheduled for April 4th?  After this release, I will then be able to use custom fields with multiple event data providers?  I have a project due very shortly after your scheduled release of April 4th and managing events are a core function of my client's site, so I want to make sure I have a planned solution to this issue.

    Thanks.
  • Hi Geoff,

    I confirmed that the issue described in my previous post will be fixed in Q1. The custom fields will work correctly with custom providers. This means that:
    1. Custom fields created for the default provider will be available in the custom provider as well
    2. Events under the custom provider will be properly saved/created

    I just want to add that Q1 is scheduled for 13th of April (the release is postponed by a week).

    Greetings,
    Pepi
    the Telerik team