Telerik CMS and Events namespace missing
I'm in the process of creating a custom class for exporting and importing from the Eventsmodule. Here's the code for it...
using System;using System.Collections;using System.Collections.Generic;using System.ServiceModel;using System.ServiceModel.Channels;using Telerik.Cms.Engine;using Telerik.Events;namespace Telerik.Sitefinity.Services.Migration public partial class MigrationExportService : IMigrationExportService public Message GetEventsList() List<MigrationItemContentDefinition> output = new List<MigrationItemContentDefinition>(); foreach (KeyValuePair<string, ContentProviderBase> provider in m_AllProviders) // Check if the provider is DefaultEventsProvider if (provider.Value is Telerik.Events.Data.DefaultEventsProvider) string providerName = provider.Key; EventsManager eventsManager = new EventsManager(providerName); if (provider.Value.AllowLocalization) foreach (var culture in m_Cultures) if (culture != m_DefaultCulture) System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo(culture); IList eventsList = eventsManager.GetEvents(); AddGenericContentGuidToList(eventsList, output, providerName, culture); else IList eventsList = eventsManager.GetEvents(); AddGenericContentGuidToList(eventsList, output, providerName, String.Empty); MessageVersion ver = OperationContext.Current.IncomingMessageVersion; return Message.CreateMessage(ver, "GetEventsListResponse", output); public Message GetSingleEvent(Message eventDefinitionParam) MigrationItemContentDefinition param = eventDefinitionParam.GetBody<MigrationItemContentDefinition>(); EventsManager eventsManager = new EventsManager(param.ProviderName); if (!String.IsNullOrEmpty(param.Language)) System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo(param.Language); IEvent eventItem = eventsManager.GetEvent(param.Id); MigrationEvent result = new MigrationEvent(); result.RecurringRule = eventItem.RecurringRule; GetSingleGenericContentItem(result, eventItem.ContentItem, param.ProviderName, param.Language); MessageVersion ver = OperationContext.Current.IncomingMessageVersion; return Message.CreateMessage(ver, "GetSingleEventResponse", result); Hi Kevin,
Telerk.Cms.* and Telerik.Events are namespaces from Sitefinity 3.x. Sitefinity 4.x has completely revamped API with completely different namespaces. Thus unless you have both sets of the assemblies in your /bin folder you can't create code that uses both APIs. But this is highly unrecommended.
Kind regards,Ok... I actually discovered this yesterday. My apologies for not updating this thread accordingly.
Now since this code is for Sitefinity 3.x, can you point me in the right direction for Sitefinity 4.x?
the content managers are still available in 4.x, they are just in a different namespace:
Telerik.Sitefinity.Modules.Events;
Telerik.Sitefinity.Modules.News;
etc
you might also need to reference the models:
Telerik.Sitefinity.Events.Model;
however using the Fluent API is a nice way to quickly and intuitively get events out without having to instantiate content managers.
An example of both methods for querying event items is here: http://www.sitefinity.com/40/help/developers-guide/sitefinity-essentials-modules-events-querying-events.html
and here is an example of creating events: http://www.sitefinity.com/40/help/developers-guide/sitefinity-essentials-modules-events-creating-events.html
hopefully these two examples will help you accomplish your task...
hope this is helpful!