25
Jan

While working on the Timer job I talked about in my previous post, I also had a problem retrieving the value of a particular field.

I needed to get the value from a field called ‘Company’, but when I tried to get the value for Company through my code it brought back the value for the field ‘Position’.

In my case, I found out this was because these where not the original field names. In SharePoint a field has an internal name. This internal name of a field is set to the fields title when it is originally created and never changes.

There is an easy way to find a field’s internal name without resorting to code. If you sort a list by a field, the url will contain the fields internal name as the ‘SortField’ Parameter.

When I sorted the list by ‘Company’ I found it had an internal name of ‘Linktitle’:

http://…/All%20Open%20Items.aspx?SortField=LinkTitle&SortDir=Asc

and when I sorted by Position:

http://…/All%20Open%20Items.aspx?SortField=Company&SortDir=Asc

This explains why the code was returning the Position and not the Company.

I changed the code to pick up the value of field ‘LinkTitle’ and everything now works fine.

VN:F [1.9.2_1090]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.2_1090]
Rating: 0 (from 0 votes)

Comments are closed.

-->