Using the SDK in a standalone application
Hello Lupi,
Thank you for using our services.
Since you need to access data of a Sitefinity website in another application you will have to use web services. What you have to do is to create web services which will access this data, serialize it and return it. Then you need to host those services on your Sitefinity website and then add Service References to those services in your application. Then you will call the webservice to get your data and return it. Bellow are linked couple of samples which explain how to create webservices which use Sitefinity API. The samples are for 3.x version however the principle is the same in Sitefinity 4.0. The idea is that your webservices are running in the context of the Sitefinity website and all providers are initialized in the context of this website.
Enable loading of CMS pages through an AJAX Web Service
Use the Content Manager API in a Web Service
Regards,
Radoslav Georgiev
the Telerik team
Hummmm,
The team is preparing some Sitefinity 4.0 REST API examples. I'm as anxious as everyone else to dig into this.
Hi,
I also need to access Sitefinity 4 database from my standalone application.
Is web service my only option or there is another way (code samples would really help).
Thanks,
Neb
Hi Neb,
Hi Lino,
Thanks for a quick reply.
To give you more details, I have a standalone application that has a couple of "Latest news" pages whose content I need to populate from our Sitefiniti 4 database. That is really all my application need from CMS.
I originally planed to use the sample provided in Sitefinite 4 developers guide:
public void FindNews(string newsTitle, string author) NewsManager manager = NewsManager.GetManager(providerName); NewsItem item = manager.GetNewsItems() .Where(t => t.Title == newsTitle) .Where(t => t.Author == author) .Where(t => t.Status == ContentLifecycleStatus.Live) .Single();but not sure how to instantiate/create a providerName.
Hello Neb,
Thank you for getting back to us.
As Lino has pointed out the Fluent API or even the native one has to be used in the context of the Sitefinity project (website) and not in the context of your standalone application. If you call the managers or Fluent API from your application the providers will return null.
The providerName variable in the above sample is of type string you can pas for example "News". Please note that this code will work if called in a web service hosted on your Sitefinity website. For more information on how to implement your own services you can take a look at this article: Implementing your own WCF REST service.
Best wishes,
Radoslav Georgiev
the Telerik team
The link to how to implement your own REST services 404s.
Hi,
Further information about implementing your own RESTful WCF services can be found in the following Sitefinity documentation section.
Kind regards,
Stefani Tacheva
the Telerik team