So today I am starting a new series on SharePoint Best Practices. This may seem like a fairly simple topic but, I have come to learn that it is an important one. I am not talking about best practices in setting up and configuring SharePoint or how to best develop a solution in SharePoint. I am instead wanting to discuss best practices in your day to day usage of SharePoint. Too many times I have worked with experienced clients that have a decent knowledge of how to do things in SharePoint, but don’t think of the little things that make these best practices. This is where this series is coming from. Today I am going to cover site columns.
Site Columns
Site columns are simply metadata that are available anywhere within your site or subsequent sub sites. A site column can hold nearly any type of data. From text to numbers to currency. You can even create site columns based on data in another list, an internal data set called Managed Metadata or even a built in set of choices. Here’s a list of all the options you can get now in SharePoint Online and on-prem:
SharePoint Best Practices – Site Columns
When To Use Site Columns
The biggest question up first is when should you use a site column and when should you use a list column (BTW, even if they are in a library they are still to be considered list columns because metadata on a document is actually part of a list item object). In my opinion the only type of column that may not be a site column is a column that can be pre-populated with data. So think Choice, Lookup and Managed-Metadata. The reason why we would consider these to be created outside of the site level is if the data to be contained within the columns needs to be limited to a certain sub set of users. In all my years working with SharePoint I honestly have only seen this happen a handful of times. So other than that if you are adding a column to a list\library create it as a site column. The reason is simple. You never really know when you are going to need the same column within another list or library within you site or sub sites. Why take the chance of duplicate data down the road. I have seen so many status or category columns in the same site that all contained the same data but were recreated over and over again because they were created as list columns.
Creating The Site Column
Creating site columns is really easy. Simply click on the setting cog and select site settings. Then on the settings page click on Site Columns under Web Designer Galleries
Then just click on Create.
Now we get to the important part. Never ever create your site column with spaces. From a power user point of view it doesn’t seem like a big deal, but if you are developing any code against these site columns those spaces become a pain. Here’s why. When creating from the GUI the name you initially set your column as also sets the internal name of the column. Many times when accessing data within those columns you need to use the internal name. Here’s where the pain comes. An internal name cannot have spaces. Let’s say the name of your column is Manager Rejection Comments. The internal name is actually going to now be Manager_x0020_Rejection_x0020_Comments. In the URL also shows this full length name or in some cases will replace spaces with “%20”
When I create my site columns I actually create them with no spaces (capitalising the letters are fine). After the column is created I simply edit the column and change the display name to what I want. This method also allows you to shorten the internal name as well. For example, you could initially create the column above like this: MgrRegCmmts. And then update it to Manager Reject Comments after. This will shorten any dev you may need to do and make your life just a little bit easier.
Next up: Content Types.
Thanks for reading!
Comments