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

Forums / Sitefinity SDK / Sharing Content Across Multiple Sites

Sharing Content Across Multiple Sites

29 posts, 0 answered
  1. Geoff
    Geoff avatar
    89 posts
    Registered:
    02 Mar 2011
    14 Mar 2011
    Link to this post
    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.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 Sep 2016
    15 Mar 2011
    Link to this post
    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!
  3. Geoff
    Geoff avatar
    89 posts
    Registered:
    02 Mar 2011
    15 Mar 2011
    Link to this post
    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.
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    16 Mar 2011
    Link to this post
    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!
  5. Geoff
    Geoff avatar
    89 posts
    Registered:
    02 Mar 2011
    16 Mar 2011
    Link to this post
    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.
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    21 Mar 2011
    Link to this post
    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
  7. Geoff
    Geoff avatar
    89 posts
    Registered:
    02 Mar 2011
    21 Mar 2011
    Link to this post
    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.
  8. Geoff
    Geoff avatar
    89 posts
    Registered:
    02 Mar 2011
    22 Mar 2011
    Link to this post
    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.
  9. Pepi
    Pepi avatar
    981 posts
    Registered:
    16 Sep 2016
    24 Mar 2011
    Link to this post
    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
  10. Geoff
    Geoff avatar
    89 posts
    Registered:
    02 Mar 2011
    24 Mar 2011
    Link to this post
    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.
  11. Geoff
    Geoff avatar
    89 posts
    Registered:
    02 Mar 2011
    29 Mar 2011
    Link to this post
    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.
  12. Pepi
    Pepi avatar
    981 posts
    Registered:
    16 Sep 2016
    30 Mar 2011
    Link to this post
    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
  13. Geoff
    Geoff avatar
    89 posts
    Registered:
    02 Mar 2011
    30 Mar 2011
    Link to this post
    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.
  14. Pepi
    Pepi avatar
    981 posts
    Registered:
    16 Sep 2016
    31 Mar 2011
    Link to this post
    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
  15. Daniel Lewis
    Daniel Lewis avatar
    27 posts
    Registered:
    23 Sep 2009
    11 Apr 2011
    Link to this post
    Everything working great in this scenario EXCEPT the taxonomy....

    Added connectionString property and get this when navigating to taxonomy in Backend

    Server Error in '/' Application.

    Object reference not set to an instance of an object.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error: 

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace: 

    [NullReferenceException: Object reference not set to an instance of an object.]
       Telerik.Sitefinity.Taxonomies.Web.UI.TaxonomySidebar.SetPanel() +79
       Telerik.Sitefinity.Taxonomies.Web.UI.TaxonomyBasePanel.CreateCustomCommandPanels(String viewMode, IList`1 list) +121
       Telerik.Sitefinity.Web.UI.Backend.ControlPanel`1.GetCommandPanels(String viewMode) +185
       Telerik.Sitefinity.Web.UI.Backend.ControlPanel`1.get_CommandPanels() +59
       Telerik.Sitefinity.Web.UI.Backend.ControlPanel`1.InitializeControls(Control viewContainer) +45
       Telerik.Sitefinity.Taxonomies.Web.UI.TaxonomyBasePanel.InitializeControls(Control viewContainer) +16
       Telerik.Sitefinity.Web.UI.ViewModeControl`1.CreateChildControls() +147
       System.Web.UI.Control.EnsureChildControls() +181
       System.Web.UI.Control.PreRenderRecursiveInternal() +59
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4184
  16. Geoff
    Geoff avatar
    89 posts
    Registered:
    02 Mar 2011
    17 May 2011
    Link to this post
    Now that 4.1 SP1 has been released, I have to return to this thread.  In 4.0 SP1, custom fields did not play well with multiple content providers.  I was not able to upgrade to 4.1 because of several of the bugs, so 4.1 SP1 is the first release where I have been able to test this.

    Can someone point me to documentation regarding using custom fields with multiple content providers and also, hopefully, answer my questions below?  Thanks.

    I set up SiteA and SiteB.
    SiteA contains ProviderA (pointing to SiteA) and ProviderB (pointing to SiteB).
    SiteB contains ProviderA (pointing to SiteA) and ProviderB (pointing to SiteB).

    I set up custom fields on SiteA for ProviderA.  When I switch to SiteA ProviderB, the custom fields automatically appear there as well.  Is this expected behavior?

    If an event is created on SiteA for ProviderB, does this event get persisted in the database for SiteA or SiteB?
    If SiteB does not contain the custom fields defined in SiteA for ProviderB, where does this metadata go?

    When I create an event on SiteA for ProviderB, the event does not show up on SiteB for ProviderB.  This previously worked and I was able to create and share content across sites.  Can anyone else reproduce this behavior?

    Thanks.
  17. Ivan Pelovski
    Ivan Pelovski avatar
    43 posts
    Registered:
    24 Sep 2012
    19 May 2011
    Link to this post
    Hi Geoff,

    There is no documentation about this scenario, but we will add such.

    I set up custom fields on SiteA for ProviderA.  When I switch to SiteA ProviderB, the custom fields automatically appear there as well.  Is this expected behavior?
    Yes, it is expected behavior, because a custom field is valid for the whole type not only for a provider. So every provider for events will use the existent custom fields.

    If an event is created on SiteA for ProviderB, does this event get persisted in the database for SiteA or SiteB?
    The event for ProviderB is persisted in the database for SiteB together with the data of the custom fields for events defined in SiteA.

    If SiteB does not contain the custom fields defined in SiteA for ProviderB, where does this metadata go?
    If you create a custom field in SiteA then the metadata about this field will be persisted in the database for SiteA. Though the data of the custom field will be persisted as a table column in SiteA and SiteB as well. In order for SiteB to see the data stored in its database you have to create a custom field with the same name and type in SiteB.

    When I create an event on SiteA for ProviderB, the event does not show up on SiteB for ProviderB.  This previously worked and I was able to create and share content across sites.  Can anyone else reproduce this behavior?
    Would you make sure that the ProviderB for SiteA and ProviderB for SiteB share the same application name?

    Regards,
    Ivan Pelovski
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  18. Geoff
    Geoff avatar
    89 posts
    Registered:
    02 Mar 2011
    19 May 2011
    Link to this post
    Thanks for your explanations.  That helps me a lot in understanding how the system is supposed to work.

    Regarding the applicationName value, the applicationName values of ProviderA and ProviderB on both SiteA and SiteB are all set to "/Events", which I believe is the default value.  I assumed a common value for SiteA ProviderB and SiteB ProviderB was necessary for both sites to see the events.  Maybe this is incorrect on my part.

    Thanks.
  19. Mark
    Mark avatar
    147 posts
    Registered:
    01 Jun 2010
    23 May 2011
    Link to this post
    Just to clarify from your last post Ivan, has documentation for this scenario been added yet?

    We're trying to display events and their custom fields from SiteA and SiteB onto SiteC. From what I understand this is possible, is this correct?
  20. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    24 May 2011
    Link to this post
    Hi Mark,

    The documentation is still in progress. It is possible to use custom fields with multiple website. Are you experiencing any problems?

    Regards,
    Radoslav Georgiev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  21. Geoff
    Geoff avatar
    89 posts
    Registered:
    02 Mar 2011
    24 May 2011
    Link to this post
    Does anyone from Telerik have feedback regarding my last post on the applicationName value of the configured data providers?

    -Thanks
  22. Ivan Pelovski
    Ivan Pelovski avatar
    43 posts
    Registered:
    24 Sep 2012
    25 May 2011
    Link to this post
    Hello Geoff,

    Yes, you assume right that SiteA ProviderB and SiteB ProviderB need a common value in order for both sites to see the events. If you still experience problems to get the events shared by both sites than would you consider sending us the event config files of the sites. The files are named EventsConfig.config and are located at ~/App_Data/Sitefinity/Configuration.

    All the best,
    Ivan Pelovski
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  23. Geoff
    Geoff avatar
    89 posts
    Registered:
    02 Mar 2011
    26 May 2011
    Link to this post
    To remove any issues that could be caused with using a site upgraded from 4.0, I created two new Sitefinity 4.1.1405.0 sites (SiteA and SiteB).  I setup the second data providers for each site to point to the opposing site.  This can be seen in each site's corresponding EventsConfig.png file attached to this post.

    For SiteA, both data providers show up in the Events section (shown in SiteA.jpg), however only one of the two created events on SiteB show up for SiteA::SiteBDataProvider.

    For SiteB, the second data provider (pointing to SiteA) is not showing up.  You can see from the corresponding EventsConfig.png file, that this second data provider is configured.  Does something specific need to be done to get this second data provider to show up?  If so, why did this not need to be done on SiteA to get the SiteBDataProvider to show up?

    Thanks.
  24. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 Sep 2016
    26 May 2011
    Link to this post
    Hi ,

    1. Have you added connection string inside SiteB that points to SiteA using DataConfig?
    2. Have you added connectionName parameter to the provider that points to SiteA? If this parameter is not added the provider won't appear.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  25. Geoff
    Geoff avatar
    89 posts
    Registered:
    02 Mar 2011
    26 May 2011
    Link to this post
    applicationName data provider parameter on each site is set to "/Events".
    connectionString data provider parameter on each site is set to a connection string pointing to the other site's database.
    Those are the only 2 parameters I set on each data provider.

    According to Ivan Pelovski, 'applicationName' should be set to the same value on all data providers in my scenario, so I believe "/Events"" is correct.

    I created these sites specifically for this test, so they are brand new sites with minimal configuration changes.  Also, both sites are configured the same way.  That's what makes the differing behavior confusing to me.

    What is the "connectionName" parameter?

    I know you said there is not yet documentation outlining configuration of this scenario.  Is there documentation available that discusses the possible parameter values and what they do?

    Thanks.
  26. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 Sep 2016
    26 May 2011
    Link to this post
    Hello ,

    When we initialize the provider we need two parameters - provider name and connection name

    All the best,
    Ivan Dimitrov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  27. Geoff
    Geoff avatar
    89 posts
    Registered:
    02 Mar 2011
    26 May 2011
    Link to this post
    Is "connectionName" different than "connectionString"?

    As shown in the screenshots previously attached, one of the sites knows it has 2 data providers, the other site does not and only displays the default provider.

    The site that shows both providers only shows one of the two events available through the second data provider.  The fact that any of the events appear makes me believe that a connection is made, but why does only one show up and why does this only work on one of the sites when they are both configured in the same manner (pointing to the opposing site)?

    Thanks.
  28. Neven Dinev
    Neven Dinev avatar
    43 posts
    Registered:
    26 Sep 2016
    02 Jun 2011
    Link to this post
    Hi Geoff,

    Apologies for the delayed answer.

    I've recreated the setup locally. The problem you are experiencing is symmetric and this happen because each site caches its own data. Here is one solution that you can apply: Go to Administration>Setting>Advanced>Data and set EnableDataCaching=False. Then save and restart your application.

    You need to use connectionString in the definition of the second provider(on both sites)
    Do not forget to reset both applications.

    Kind regards,
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  29. Allen
    Allen avatar
    71 posts
    Registered:
    04 Aug 2007
    19 Jan 2012
    Link to this post
    Ok.  I hate to sound like a dim bulb, but here goes...

    I have followed the directions for setting up another provider. (BTW - I am in 4.4).  I have reviewed the images from Geoff on 5/26, and I have tried to follow the winding thread, but I am still having some trouble.

      I do have a connection string configured in the data section (that wasn't clear at first.  I kept thinking that the actual connection string value was what was needed in the provider parameter).  I have configured an additional provider (I am doing this for content blocks instead of events), I have put the name of my configured connectionString parameter of my provider and I have reset my site.  I have logged in, gone to content blocks and I see the new provider.  However, I don't see any of the content from my other site.  Instead, shows me "Create a content block."  What could I be doing wrong?


    Here is my config:

    <contentConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type" config:version="4.4.2117.0">
        <providers>
            <add title="Old Site Data" type="Telerik.Sitefinity.Modules.GenericContent.Data.OpenAccessContentProvider" connectionString="Connect2OldSite" enabled="True" name="OldSite" />
        </providers>
    </contentConfig>

    Yes, my connection string is correct. (In case you were going to ask ;)

    Also, I don't ever want to add content from new site to old site.  In fact, I am simply connecting so I can use code to migrate various bits of the data to new site.

    Any suggestions?



29 posts, 0 answered