Friday, April 10, 2015

SharePoint Naming Conventions "Best Practice"


SharePoint makes life really easy with being able to create new sites, lists, libraries, columns, etc.  In fact, it makes the process too easy. A little knowledge can be dangerous and the ability to jump into creation in SharePoint leaves developers with some problems.

This topic came up recently in our SharePoint Document Management course.  Interestingly enough, it came as a question about whether SharePoint 2013 would make your URLs friendly automatically (also as a comment on site column creation from a developer in the class).  (Thanks to Louisa and Sean!)

When a user creates a new column, list, or library in SharePoint with spaces (or any special character for the matter) that space has to be converted to a string that will work as a URL.  For example, if I create a new site column of Document Serial Number with spaces, then my URL for this column will look like the following:

SharePoint is taking the characters used for the name at creation to create the internal URL name for the site column.  We can use this to our advantage to make cleaner internal names by creating our site column as DocumentSerialNumber. This will give us the following URL:
 
 
You will notice how the URL no longer contains the additional %5fx0020%5f that represents the spaces.  Once the site column is created, you can return to modify the column and change the name to include spaces.  The URL will remain as it was created, but the name visible to select in menus will be easier to read.  This adds a little bit of time to creation but will make URLs easier to understand and use. As a byproduct, this also will make developers love you.  After all, that's the ultimate goal right?  =P



No comments: