More in this section

Forums / Developing with Sitefinity / Telerik CMS and Events namespace missing

Telerik CMS and Events namespace missing

4 posts, 0 answered
  1. Kevin
    Kevin avatar
    38 posts
    Registered:
    06 Sep 2011
    28 Sep 2011
    Link to this post
    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);
            }
        }
    }

    On the "using Telerik.Cms.Engine;" and "using Telerik.Events;" I am getting a "type or namespace" "does not exist" error.  I checked the bin folder, and that doesn't contain the Telerik.CMS.dll either. 

    How do I correct this problem?

  2. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    29 Sep 2011
    Link to this post
    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,
    Lubomir Velkov
    the Telerik team
    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
  3. Kevin
    Kevin avatar
    38 posts
    Registered:
    06 Sep 2011
    29 Sep 2011
    Link to this post
    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?
  4. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    29 Sep 2011
    Link to this post
    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!
4 posts, 0 answered