Wednesday, February 11, 2015

Sitecore :- How to create new language version for all items

Hi Friends,

Today we got  some requirement for the multilingual site, the requirement was to create a new language and set the version for all the items in the content tree through the code.

Here is the sample code to achieve this task.


 var homeItemA = Sitecore.Context.Database.GetItem(Landings.HomeItem);
            var languageA = Sitecore.Globalization.Language.Parse("en-SG");//new language version

            var master = Sitecore.Configuration.Factory.GetDatabase("master");

            var allItems = master.GetItem(homeItemA.Paths.FullPath).Axes.GetDescendants();

          

            foreach (var blog in allItems)
            {
                Item ca = master.GetItem(blog.Paths.FullPath, languageA);


                using (new Sitecore.SecurityModel.SecurityDisabler())
                {
                    try
                    {
                        if (0 == ca.Versions.Count)
                        {
                            ca.Versions.AddVersion();
                        }

                     
                    }
                    catch (Exception ex)
                    {
                        ca.Editing.CancelEdit();

                    }
                }
            }

Saturday, February 7, 2015

Sitecore - Best Sitecore Team Award and key highlights.




We have been working on one of the main projects and delivered all items on time, I was leading the team and it got the best team of the year for Sitecore delivery.


  1. Don’t step in with solutions too quickly. 
  2. Everyone can help you learn something.
  3. Keep communicate and ask for are you okay or need any help
  4. Keep trying
  5. Always try new things, It will keep you motivated/excited.
  6. Be authentic and honest for work progress.