Call to SPGetFieldValue returns 0 on invalid FieldName.

Discussions related to integration with SoftPro Standard or SoftPro Enterprise editions.
Post Reply
at2k21
Posts: 17
Joined: Wed Aug 16, 2017 5:33 pm

Call to SPGetFieldValue returns 0 on invalid FieldName.

Post by at2k21 »

Making a call to SPGetFieldValue passing "" or even "nonsense" for chFieldName parameter returns 0 as the result. According to the documentation it should return a result < 0. Has this changed and not been updated in the documentation? Is there a way to know if a field name is invalid compared to a valid one that has an empty string as the value?
Gil McNeill
Posts: 16
Joined: Mon Oct 06, 2008 9:29 am

Re: Call to SPGetFieldValue returns 0 on invalid FieldName.

Post by Gil McNeill »

The documentation is wrong for that function. SPGetFieldValue returns the length of the data in the field. If you pass in a bad field name it will return zero. I'll put a bug in to get that fixed so that the API returns < 0 value for a bad field name.

SPSetFieldValue (on the other hand) will return an error if you pass in a bad field name.You will get a -104 error code in that scenario.
Gil McNeill
SoftPro Software Engineer
Post Reply