3

I've got a webpart which reads several values from a list, while developing local I've got a column "Due Date", but when I upload my webpart to SharePoint online (Office 365) we have a German version and the column is called "Fälligkeitsdatum" so my code doesn't work (without changing the columnname in the source everytime).

How can I read the column independent from language? Is this possible with guid?

1

Use SPField.InternalName.

You can see what the Internal Name in several ways, such as in List Settings, or in AllItems (url when sorting by a field).

Internal Name of "Due Date" in Tasks list is DueDate.

| improve this answer | |
1

Yes you should use the GUID

The GUID of a lot of the BuiltIn Fields are abailable in SPBuiltInFieldId regarding Due Date use SPBuiltInFieldId.DueDate

| improve this answer | |
  • Could you provide a sample? I can't get it to work: Invalid field name. {c1e86ea6-7603-493c-ab5d-db4bbfe8f96a} – Aljoscha Husp Sep 28 '12 at 12:41
  • Sounds like you are passing in a GUID as a string and not as a GUID object. You can convert a string to a GUID using Guid fieldId = new Guid(guidAsString); – SpartanDonut Sep 28 '12 at 12:47
  • Unfortunatly not :-( SPBuiltInFieldId.DueDate is already a Guid. – Aljoscha Husp Sep 28 '12 at 12:55
  • Ohhhh sorry the mistake was that I used DueDate, but as I'm using a tasklist I needed to use TaskDueDate. Your code works perfect thanks :-) – Aljoscha Husp Sep 28 '12 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.