EPiServer CMS 11 Useful SQL Queries – 2

Here is a set of few queries that we have been using in different investigations Get usages of EPiServer contents including pages and blocks Check Table size No contents have been added for following content types Looking into Activity Logs Unmapped Property List Get usages of EPiServer contents including pages and blocksSELECT  tct.Name,   tct.ModelType,   COUNT(tc.pkID) […]

Get Specific Elements Blocks from EPiServer Forms

A small extension to get the specific form elements block with all properties rather relying on  FriendlyNameInfo with the limited set of properties. EPi Form Extensions Gist Example: Custom form element block: public class HiddenExternalValueElementBlock : HiddenElementBlockBase{    [Display(Name = “Enable if its a special campaign”)]    public virtual bool MySpecialCampaign { get; set; }     [Display(Name = “Propperty 1”)]    public virtual bool Property1 { get; set; }     [Display(Name = “Property 2”)]    public virtual bool Property2 { get; set; } } Extension Methods: using EPiServer.Core;using EPiServer.Forms.Core;using EPiServer.Forms.Core.Models;using EPiServer.Forms.Helpers.Internal;using EPiServer.Forms.Implementation.Elements;using System.Collections.Generic;using System.Linq; namespace PixieDigital.EpiServer.Extensions{    public static class FormExtensions    {        public static IEnumerable<T> GetSpecificFormElements<T>(this FormIdentity formIdentity, bool filteredItemsOnly = true) where T : ElementBlockBase        {            return GetSpecificFormElements<T>(formIdentity.GetFormBlock(), filteredItemsOnly);        }         public static IEnumerable<T> GetSpecificFormElements<T>(this FormContainerBlock formContainerBlock, bool filteredItemsOnly = true) where T : ElementBlockBase        {            if (formContainerBlock != null && formContainerBlock.ElementsArea != null && formContainerBlock.ElementsArea.Items != null && formContainerBlock.ElementsArea.Items.Count() != 0)            {                var formElements = filteredItemsOnly ? formContainerBlock.ElementsArea.FilteredItems : formContainerBlock.ElementsArea.Items;                 foreach (var item in formElements)                {                    T element = item.ContentLink.GetContent((formContainerBlock as ILocale).Language.Name) as T;                    if (element != null)                    {                        yield return element;                    }                }            }        }    }} Usage: Guid formGuid = “xxx-xx-xxxx”;var formIdentity = new FormIdentity(formGuid, “en”);var hiddenElement = formIdentity.GetSpecificFormElements<HiddenExternalValueElementBlock>();//Use it for further processingvar formId = hiddenElement.FirstOrDefault().Content.ContentLink.GetElementName(); var definedElementName = hiddenElement.FirstOrDefault().Content.Name; var mySpecialCampaign = hiddenElement.FirstOrDefault().MySpecialCampaign;                        

Azure based architecture for serving EPiServer CMS As Content Hub

This architecture uses the Azure API Management to provide access to content from EPiServer for different channels. Contents are exposed via headless API and other Custom written APIs. Editors and admins will have secure access to EPIServer CMS. API Management is used to publish APIs to external, partner and channels, securely and at scale. Application Insights is used to detect […]

Serialize IContent to use in Angular like front technologies

(A self note) A generic service to convert IContent into an Expando Object, ExpandoObject  can be converted into JSON to use in Angular/React components.Find the code gist https://gist.github.com/khurramkhang/e8d4b9ef093fe30610be986efa352744 Limitations: not supporting multilingual not preparing friendly urls

Schedule Jobs revised

Schedule jobs has been revised in version 10.8. we have a new property Restartable on the ScheduledPlugIn attribute, that can be defined as following [ScheduledPlugIn(Restartable = true)] Jobs having property “Restartable=true” will make sure it can be re-run to completion in case of crashes before next schedule time. There are few considerations for developers before […]