Important notice

Please note that this blog is discontinued here. All the posts are also coppied to my new blog at http://boris.gomiunik.net.
Important: Due to large amount of comment spam further commenting has been disabled here. If you wish to send me a comment, plase look up the same post on my new blog and leave comment there. Thanks!

3/03/2008

How SharePoint stores field names

In my one of my previous posts I've received a good comment from Mike that got me talking quite a lot about SharePoint List / Document Library Field Names. So it's better to dedicate a post to it. First I'll explain some exceptions and then show how to quickly get a sharepoint field name.

You can't change SharePoint field name

Once you create a field, you can't change the "SharePoint" name for it. Im using this sometimes when creating lists. I'll create a field called FirstName and then rename it to First Name. Like that I have no complications with spaces or any unstandard characters. So now (compared to previous post) I can filter with FilterField1=FirstName. 

 

Title field

No matter which list you create (except survey), there will always be one Title field no matter how we have it named. We can recognize this title field as the one that is linked to the item (with edit menu)

No matter what you rename this field to, this field will always be "SharePoint" named Title.

Field names for Out-of-the-box lists

Lists that are already included in the templates (like for example Contacts) have different "SharePoint" names than "Display" names. For example: In a Contacts list we can see a field called Fax Number, but "SharePoint" name for it is WorkFax. How to discover real names? Skip to the end of this post and read more.

Spaces and special characters in field names

Spaces in field names get converted to _x0020_. 0020 represents the Unicode character code. If you'd like to know any other, I've found this very good web character convertion tool. Just enter character into Characters field and you'll find the code in Hexadecimal code points but make it a 4 digit number (for example 20 for space should be 0020).

When using those special characters in URL, the underscore (_) gets converted to %5F

So how the heck to know SharePoint field names?

You COULD mess around with all the specialities and translations and conversions that I've mentioned untill now, but there's an easier way:(two actually):

1. Sort the List / Document Library and check in URL for SortField parameter value.
 


2. Go to List / Document Library Settings, click on the name of the column to modify it and in URL find the last parameter value
 

 

And ofcourse if you need to use the field name in other places than URL (like in SharePoint designer), don't forget to convert %5F to underscore.

P.S. - Yes, I know there is also a way to see SharePoint Field Names in SharePoint Designer (mouseover a field name in Data Source Details), but in this post I wanted to focus on work without it.

Oznake ponudnika Technorati:

8 comments:

Anonymous said...

Nice article. I have faced exactly the same problem of discovering the 'real' field names myself some time ago. I have created a tool which helps me reflecting the Content Types and all propertied of their fields. You can download the tool at: http://blog.mastykarz.nl/2007/08/24/imtech-fields-explorer/. I'm curious what do you think about it.

Regards,

Waldek Mastykarz

Boris Gomiunik said...

This tool looks great! Is it possible to modify the properties also or just explore?

Anonymous said...

So far exploring only. I like the idea of being able to deploy the custom assets I have created in a structured and repeatable way. That's why I use the tool to explore the properties and I created Features of them.

Anonymous said...

Thanks, It was small nice and useful article,I had problem with "Content type" field and suddenly i found it without space and I know what was my problem. Thanks.
Other problem, If you know please help me:
when I wrote edit menu feature for task list, after installfeature it works for all task list but I need it to work in a task list.

Renato said...

The visible column name is called DisplayName and the "SharePoint" column name is called InternalName. This is evident if you define site columns using xml column definition files and deploy them as features. And why would you do that? Well, besides easier deployment you can set the value of the DisplayName as a resource file link which enables you to localize display names into several languages. When installing feature to a site, the site locale is used to choose the proper translation of the column.

Dan Meineck said...

Wouldn't it be nice if in a View of a Document Library or List you could actually specify a View specific display name for each column...

Unknown said...

Hi,

I m using infopath form library in WSS 3.0. I want to rename the column name "Name". I can rename other columns except "Name". Kindly suggest.

Anonymous said...
This comment has been removed by a blog administrator.