Tuesday, August 19, 2008

Custom ServerURL field in a SharePoint list

Well here's an odd one. I'm using a SharePoint list to store configuration info for a web service I'm using. I wanted the URL of the server to be a parameter, so I could switch between dev, model office & production easily. So logically enough I created a custom field called ServerURL to point to the server hosting the web service. Got some weird results:

Trying to use an SPWeb object that has been closed or disposed and is no longer valid.

Turns out ServerURL is an internal field - when I reference ServerURL0 then I get my own field. Reckon it's time to re-create that field with a different name!