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()
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