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

Forums / Developing with Sitefinity / Get content from outside sitefinity

Get content from outside sitefinity

2 posts, 0 answered
  1. Ricardo
    Ricardo avatar
    29 posts
    Registered:
    06 Nov 2012
    02 Jul 2013
    Link to this post
    Hello,

    I am having some issues and turning to the community for help.

    I am able to get some content through a different app, although I get a bit of a odd behaviour.
    I can actually get the shared content items no problem, but as what I am trying to do is getting all types of content, for some reason this does not work.

    For example, this works without a problem and gets me the shared control items (although I want the non shared ones as well).
     var controls = App
                            .WorkWith()
                            .ContentItems()
                            .Where(c => c.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live)
                            .Get();

    The odd part is that the following does not work as I am also unable to connect to anything related to pages.
    var pageNodes = App
                            .WorkWith()
                            .Pages()
                            .Where(pN => (pN.Page != null && pN.Page.Status == ContentLifecycleStatus.Live))
                            .Get();

    So I have tried different things within a widget and that worked fine: e.g.
     public static List<ControlData> GetContentItems(string pageTitle, string placeHolder)
            {
                var pageManager = PageManager.GetManager();
                var page = pageManager.GetPageNodes().Where(p => p.Title == pageTitle).SingleOrDefault();
                var controls = page.Page.Controls.Where(c => c.PlaceHolder == placeHolder).ToList<ControlData>();
                
                return controls;
            }
    The code above returns all the controls if used within a widget, but that code simply does not work within the external app. All the references seem to be correct. Is there  a limitation on the architecture of sitefinity to get this externally?

    As anyone seen this type of behaviour? Any examples/help would be much appreciated as I am really stuck.

    Many thanks for your help as I am really stuck!

    Ricardo






  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    30 Nov 2016
    04 Jul 2013
    Link to this post
    Hello Ricardo,

    Sitefinity API can`t be executed from external application that is not sitefinity the API needs the configuration files from App_Data/Sitefinity/Configuration folder, sitefinity services in Sitefinity/Services folder, web.config, basically all sitefinity related files that execute the web services and communication with the database where the data is stored. I am not sure if you have sitefinity assemblies placed for example in console application or another C# project from where the API is executed.

    The concrete approach is to create a web service that utilizes sitefinity API and executes it in sitefinity then sends the result to another application.

    Regards,
    Stanislav Velikov
    Telerik
    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
2 posts, 0 answered