Skip to main content

Posts

Export Sitecore users to a .csv file

Export Sitecore Users to a File Here is a piece of code which I have written to export Sitecore users to a .csv file. This code reads the list of Sitecore users using UserManager's GetUsers method. See if it helps you. using Sitecore.Shell.Framework.Commands; using System; using Sitecore.Web.UI.Sheer; using System.IO; using Sitecore.SecurityModel; using System.Text; using Sitecore.Diagnostics; namespace SitecoreCustom.Web.Extensions.Commands { public class ExportSitecoreUsers : Command { string filepath = string.Empty; public override void Execute(CommandContext context) { try { CreateFile(); if (!string.IsNullOrWhiteSpace(filepath)) SheerResponse.Download(filepath); } catch (Exception ex) { Log.Error(ex.Message, ex); SheerResponse.Alert("Error Occurred: Please try again"); } } /// /// Create csv file with list of users. /// private void CreateFile()
Recent posts

Custom Fields in Sitecore (Custom DropLink, DropTree, MultiList, TreeList and Required Field Validator)

Custom Fields in Sitecore Just thought to share few of the custom Sitecore fields that I have created for one of the sample project. This may help the community memebers to easily incorporate them into their project if they need any of them. Here are few. 1. Custom DropLink using Sitecore.Data.Items; using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; using System.Text; using System.Web; namespace SitecoreCustom.Web.Extensions.CustomFields { public class CustomDropLink : Sitecore.Shell.Applications.ContentEditor.LookupEx { protected override void DoRender(System.Web.UI.HtmlTextWriter output) { this.ExcludeItems(); base.DoRender(output); } private void ExcludeItems() { Item item = Sitecore.Context.ContentDatabase.GetItem(base.ItemID); var LinkedField= Sitecore.StringUtil.ExtractParamete

Sitecore 9.3 Installation | Common Issues and Resolutions

Recently, I have installed and setup Sitecore 9.3 on another machine. I faced similar/same kind of issues which I faced earlier. Thought, it would be helpful to the Sitecore Community if I capture and document them along with resolution steps I which took and be successful in settting up. Here are few of them I could document them. 1. Failed to start service 'Sitecore Marketing Automation Engine - sitecore93xconnect.dev.local-MarketingAutomationService (sitecore93xconnect.dev.local-MarketingAutomationService)'. Solution : This issue occurs because of non-self-signed certificates, hence please follow the below steps to resolve your issue. Execute below PowerShell script to find out if there are any non-self-signed certificates: 1. Open the PowerShell Console (Admin mode recommended) 2. Execute below command Get-Childitem cert:\LocalMachine\root -Recurse | Where-Object {$_.Issuer -ne $_.Subject} 3. If it shows any results listing any non-self-signed certificates

Sitecore JSS - Custom Rendering Content Resolvers

In Sitecore, while working for real-time projects, you may get scenarios where you would see a need to customize you rendering output to serialze. Sitecore provides three different ways of customizing your rendering output with Sitecore JSS. They are as below. • Use JSS GraphQL Support - Using Integrated GraphQL queries • Use Out-of-the-box Rendering Content Resolvers - Using Sitecore JSS built-in Rendering Content Resolvers • Implementing a Custom Rendering Content Resolvers by inheriting RenderingContentsResolver Why Customization? In Sitecore development, many times we encounter scenarios to deal with hierarchical item structures like multi-level menu, product category, product sub-category, product details, forms etc., and even, in case where there is a need to combine the Sitecore data with any non-Sitecore data. In these types, Sitecore JSS is not able to serialize item structures with sub-hierarchies into JSON. Sitecore Jss allow us custiomize in

Define your own Custom GraphQL schema in Sitecore GraphQL

As more and more usage of Sitecore JSS with Javascript frameworks like React JS, Vue.JS and Angular JS, it is very important know that GraphQL is becoming mandatory for Enterprise Applications. In an Enterprise Application, querying different API with different kinds of integration of back-end system is very important. Sitecore GraphQL plays a very important role in this regard. If you are new to Sitecore GraphQL and wanted to know how to set it up , Click Here for the link where I have documented step by step approach to set up on Sitecore. Let's proceed further. What is Graphql Schema? Schemas describe the way that data is organized and constructed. A GraphQL schema defines the types and the fields available on each type, which can include references to other types. You can use a schema provider to add self-contained pieces of a schema.  If you want to add a new root query and your type system does not depend on any other schema provider’s types, you must select a