Friday, November 17, 2017

Sitecore 9 QuickStarts - Getting Started With xConnect

The best place to get started with XConnect is using Martina's documentation. It walks you through your basic XConnect console application.

Once you have this console app building start taking a look at the Jason Wilkerson blog articles on XConnect. Although tempting, do NOT start with Jason's articles. It is important that you get Martina's application working first and then start adding functionality from Jason's articles. The reason is that Martina's will do all the client certificate stuff properly and that is what you want for production.

I started myself with this console app and am now using Jason's blog articles myself.  My hope is to build out a repository on GitHub along with a series of articles on how to integrate XConnect with a variety of other applications in hopes this will save others time doing this.  If you are building an integration maybe we can collaborate and then add it to the repository for others to use.

When you create your project in Visual Studio 2017, if it defaults to creating your console app as 4.6.1 and you switch to 4.6.2 you may get an error about the root node.  If you do it is a bug in the conversion.  Check your app.config file and make sure it is formatted like this.  In my case it removed the configuration node and put startup within appSettings.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
  </startup>
  <appSettings>
    <add key="xConnectCertificateThumbprint" value="082FF77F7C87A93A3C5FE88CFB3DAB730DEF331A"/>
  </appSettings>
</configuration>

If you do not see the 4.6.2 option in Visual Studio 2017 then you need to install the developer pack


Monday, November 13, 2017

The Glass is Half Empty - Why can I not get all children of type Image from the media library folder?

So here is the problem.  I have a component where the user assigns a media folder for say a photo gallery.  Now I simply want to pull in all images from beneath this folder. I was tempted to do this but it always returns null.

imageFolderItem.Children.OfType<Image>()

But why?  Well according to Sitecore Poutine (Corey Smith AKA Sitecorey) the Image represents an Image field not the Sitecore Image template.  So to accomplish this you would simply do the following:

Go to the definition of Image and copy the class.  Make your own class but call it ImageItem.
Now set the TemplateId to be the Id of the Image template in Sitecore.

    /// <summary>
    /// This is an item based on the image template. If you are after the field use Image.
    /// </summary>
    [SitecoreType(TemplateId = "{F1828A2C-7E5D-4BBD-98CA-320474871548}", AutoMap = true)]
    public class ImageItem : IgnitionViewModel
    {
        //
        // Summary:
        //     Gets or sets the alt.
        public string Alt { get; set; }
        //
        // Summary:
        //     Gets or sets the border.
        public string Border { get; set; }
        //
        // Summary:
        //     Gets or sets the class.
        public string Class { get; set; }
        //
        // Summary:
        //     Gets or sets the height.
        public int Height { get; set; }
        //
        // Summary:
        //     Gets or sets the H space.
        public int HSpace { get; set; }
        //
        // Summary:
        //     Gets the SRC.
        public string Src { get; set; }
        //
        // Summary:
        //     Gets or sets the V space.
        public int VSpace { get; set; }
        //
        // Summary:
        //     Gets or sets the width.
        public int Width { get; set; }
        //
        // Summary:
        //     Gets or sets the media id.
        public Guid MediaId { get; set; }
        //
        // Summary:
        //     Gets or sets the title.
        public string Title { get; set; }
        public Language Language { get; set; }
    }

Now your call can look like this:

     imageFolderItem.Children.OfType<ImageItem>());

And my Symposium 2017 Selfie pictures are returning.













I wish I had found this article a couple hours ago so if you have written one on this issue and have a better description on what the issue is and how to solve it comment here.  Hopefully this will help someone else with the issue.

Wednesday, November 8, 2017

Sitecore 9 QuickStarts: Installing Sitecore 9 In Development Environment

Installing Sitecore 9

Now that you are back from Sitecore Symposium and the announcement has been made you are likely wanting to get started installing it.  This article will help you get it set up and offer tips on places where you could run into issues.

WARNING: The focus of this blog on the local developer environment install and getting you started. If you are installing in any other environment you will want to follow a different set of instructions. If you need help with that let me know I would be glad to help personally or direct you to someone whom can help.

Just like my you are probably lazy and will want to follow the Lazy Way to Install Sitecore 9 and that is right. However before following the lazy way you need to download the right version. As of this article it is the Sitecore 9 Initial Release.


Once you have the Sitecore 9 downloaded, you will want to use Jeremy's Gist script.  This article explains how the Low Effort SOLR Install script works.

SPECIAL NOTE FOR Windows 8 or 10: If you have not already you will need to enable the Local Admin account. After you have done this you can create a local admin account for SOLR to run under as well as set up app pool users.

If you are new to SOLR, please be aware that SOLR is a Java technology so you will required to Install Java to run it. If after install SOLR will not start then you probably have to install Java. You can confirm this by opening a command prompt (Run as Administrator and then CD SOLR\solr-6.6.2\bin changing the version if you have a newer version of SOLR.  Then type solr start. You will get the error saying:

error: java.exe not found

If java is installed and still get the error check the path in your environment variables JAVA_HOME. Mine was set to the wrong path, an older version of Java.

You can confirm SOLR is running by going to the admin https://solr:8983/solr if you changed your port then this may be different but if you stuck with the defaults it should show the SOLR admin

Save yourself some time and get the pre-requisites installed:


  • Install Microsoft Web Platform Installer
  • Search for "Web Deploy 3.6 For Hosting Servers" make sure it is this version because if it does not say For Hosting Servers it will bite you later.
  • Install SIF. To do so open Windows Powershell ISE (Run as Administrator)
  • In console at the bottom run Register-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2
  • Then run Install-Module SitecoreInstallFramework 
  • Then ensure you have the latest by running Update-Module SitecoreInstallFramework


Once you have SOLR installed and the pre-requisites then follow the Lazy Way to Install Sitecore 9 I used the Rock Paper Scissors UI mentioned in the article as it will generate the scripts and run them if you would like.

When I installed the first time, I unchecked the checkbox so it would run automatically but then ran into issues with permissions writing to the host file. A better approach is to set the permissions on the host file then open Windows Powershell SPE (Run as Administrator) then in the command window enter this command:

Set-ExecutionPolicy RemoteSigned

After that then run the generated script.  This worked well for me. I have now copied Jeremy Davis' script along with Kam's to my R2D2 Unit for transport to any dev machine that needs it in the future.



Possible Issues and Troubleshooting

First Time Install

I mentioned a couple things inline in the install section but there are a few other things that may help you will resolving issues.

ISSUE: Error requesting 
http://xp0.sc/sitecore/admin/PopulateManagedSchema.aspx?indexes=all: The remote server returned an error: (500) 
POSSIBLE RESOLUTION: Check event log and in my case it said "Login failed for user 'collectionuser'. Reason: Could not find a login matching the name provided. [CLIENT: <local machine>]"  Now in my case I had to add that user to my database and ensure it had access to the proper permissions. If you are using another user for the collection user then you need to edit the connectionstring.config however note that there are now 2 connectionstring.config files.  The first in in App_Config but the other is in \App_data\jobs\continuous\IndexWorker\App_config\ConnectionStrings.config make sure you change both.

ISSUE: Error hitting xconnect in browser:
Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list
Now there is the normal spot in "Turn Windows Features On" for .NET 4.7 however there is also the other spot that is not as obvious place under "Turn Windows Features On" under "Internet Information Services > World Wide Web Services > Application Development Features" Navigate there and check ASP.NET 4.6

Re-Running The Install


Now if you ran the install and it failed, upon running it a second time you may run into other issues.
The first error you will get is:

 You must remove all users with password before setting the containment property to NONE.

The issue that the users cannot be deleted by the SIF process. the fix then open SQL Management Studio and delete the SQL Server user from the databases that were created. This stack exchange post describes it in detail.

If you need help installing Sitecore 9 let us know and we will be glad to help out. I myself have only installed it in a local dev environment at this point but I am sure I will be doing it in a cloud capacity before you know it as well.

If you are looking for a mentor to connect with you on a regular basis for Sitecore or any other technology, Read Watch Create can arrange an introduction. Email me at chris.williams@readwatchcreate.com and I can arrange for mentoring sessions at a reasonable rates.



Friday, September 1, 2017

The Sitecore Alphabet

The inaugural Alabama Sitecore User Group is September 13th and Corey Smith, Sitecore Architect and MVP, will be there to discuss Sitecore MVC from A-Z

This brought to mind the Sitecore Alphabet.  I will start with a few terms per letter and we can build this as we go, helping us all learn more about Sitecore and the various elements, features, terms and events in the community.

Hope this helps you on your learning journey down Alphabet Street.


Below is a list of terms for each letter.  Eventually they will all be linked.

A

B

C

D

E

F

  • FakeDb
  • FXM

G

  • Globalization
  • Glass Mapper
  • GitHub

H

  • Habitat
  • Helix
  • Hackathons
  • Html
  • HedgeHog - Known for TDS and RAZl listed seperately
  • Houston Sitecore User Group
  • Hyderabad Sitecore User Group

I

  • India Sitecore User Group
  • Ignition
  • Information Architecture

  • Jaipur Sitecore User Group
  • Jordan Sitecore User Group

K

  • Kansas City / Overland Park Sitecore User Group

L

  • Lehigh Valley Sitecore User Group
  • London Sitecore User Group
  • Los Angeles Sitecore User Group
M

  • Mauritius Sitecore User Group
  • Melbourne Sitecore User Group
  • Mikwaukee Sitecore User Group
  • Minneapolis Sitecore User Group
  • Mumbai Sitecore User Group

N

  • Nederland Sitecore User Group
  • Nagpur - India Sitecore User Group
  • New England Sitecore User Group
  • New York Metro User Group
O

  • Orlando Sitecore User Group
  • Ottawa Sitecore User Group
P

  • Pakistan Sitecore User Group
  • Philadelphia Sitecore User Group
  • Portland Sitecore User Group
  • Poland Sitecore User Group
  • Pune Sitecore User Group
Q

  • Quebec Sitecore User Group
  • Queen City Sitecore User Group
R

  • Romania Sitecore User Group
S

  • Serbia Sitecore User Group
  • Spain Sitecore User Group
  • Sri Lanka Sitecore User Group
  • Switzerland Sitecore User Group
  • Sydney Sitecore User Group
T
U

  • UAE-Dubai Sitecore User Group (SUGUAE)
  • Ukraine Sitecore User Group
V
W
X
Y
Z

Friday, July 28, 2017

Introducing the Sitecore Commerce Mentoring Guild

There are a lot of us learning Sitecore Commerce and we are all at various stages.  The core thing we share is we are all learning it.  To help us all get ramped up on it quickly and efficiently, Eric Stafford and I have established a Sitecore Commerce Mentoring Guild Page and a Sitecore Commerce Mentoring Guild Group.

The page will feature some notes, posts, and events where we can share public information.  The group allows us a place to ask each other questions, provide some info on what we are working on, where we are struggling and things we can use to help.

As more people join and we gain more momentum, I would love to have a github where we could share snippets, powershells, and more advanced stuff together on it.

Eric and I have created the initial spark.  We look forward to the community creating the fire that will push us with much force into the new era.

Also if you are on Sitecore Slack then please add the #ecommerce channel.

Tuesday, June 20, 2017

How To Check If An Item Has Publishing Restrictions

If you have items that are appearing in master and in web but on the website you get a 404 then you may want to check publishing restrictions. Here is how you do it.



  1. Log into the Sitecore Admin
  2. Click on Content Editor
  3. At the top Click on View then ensure Standard Fields is checked

  4. Now on find the content item you are having issues with and click on it.
  5. On the right hand panel scroll down and you will see a publishing section. Expand it and make sure there are no values set on these fields. If there are dates it will only display within that range.

  6. Now the other thing to check is at the very bottom of this section. If this checkbox is published then it will not publish ever.

  7.  Now the other place to check is Workflow Section. If this item is in a workflow state it will not display either but in this case it should not be in the Web database either.

If the item exists in master and not in web then the other thing you can try is publish the parent node.  When publish finishes you can expand the details on the dialog and it will tell you if something was pushed or not.

If you are still experiencing this issue feel free to email me at chris.williams@readwatchcreate.com and I will assist as much as I can. 


Tuesday, May 23, 2017

Exporting the username and custom properties from Sitecore using Powershell

I found a great article on exporting users from Sitecore and it did 90% of what I needed. It showed how to export the custom properties but what was missing was the username.  Read the article for more details on how the export works as it is a really good article.

I am simply going to give you the additional field in bold below as this will give you the username in the form {domain}\{user} eg. sitecore\admin:

$property = @(
"Name",
@{Name='Email';Expression={ $PSItem.Profile.GetCustomProperty('Email') }},
@{Name='FirstName';Expression={ $PSItem.Profile.GetCustomProperty('FirstName') }},
@{Name='LastName';Expression={ $PSItem.Profile.GetCustomProperty('LastName') }},
@{Name='Title';Expression={ $PSItem.Profile.GetCustomProperty('Title') }},
@{Name='Company';Expression={ $PSItem.Profile.GetCustomProperty('Company') }},
@{Name='Country';Expression={ $PSItem.Profile.GetCustomProperty('Country') }},
@{Name='ZipCode';Expression={ $PSItem.Profile.GetCustomProperty('ZipCode') }},
@{Name='Department';Expression={ $PSItem.Profile.GetCustomProperty('Department') }},
@{Name='Street';Expression={ $PSItem.Profile.GetCustomProperty('Street') }},
@{Name='City';Expression={ $PSItem.Profile.GetCustomProperty('City') }},
@{Name='Phone';Expression={ $PSItem.Profile.GetCustomProperty('Phone') }},
@{Name='Username';Expression={ $PSItem.Profile.GetCustomProperty('Username') }},
)

# Gets not disabled extranet users, next select all custome properties and save all properties to CSV file
Get-User -Filter 'extranet\*'  `
    | Where-Object { $_.Profile.State -ne 'Disabled' } `
        |  Select-Object -Property $property `
            | Export-CSV -Path "$apppath\extranet-enabled-uc.csv" -notype -encoding "unicode"
       
Download-File  "$apppath\extranet-enabled-uc.csv"


Hopefully you will find this helpful. Thanks Robert Senktas for the article it helped get me 90% there. If you have tips tricks or resources you would like to share please let me know and I will post them here.