Tuesday, July 14, 2009

Tip - howto retrieve non-required Lookup column via List webservice

When running my deployed Silverlight application on a remote test server, I ran into a runtime problem. Debugging (since I deployed to a remote test server without Visual Studio support, I needed to resort using 'System.Windows.Browser.HtmlPage.Window.Alert'...), I discovered that the cause was a missing column in the returned XElement result of the GetListItemsAsync List webservice call. The missing column is a lookup to information in another list, and non-required. And moreover, this column is not included in the default view (it is in my local development environment, therefore I did not experience the problem earlier). So there's the explanation why it is not included. The solution is to explicitly specify via the ViewFields parameter to include this field in the result. However, even then I did not get the column included (?) The cause of this is that not all items in the list have a value for this non-required field. And for that you have to cope by specifying that the viewfield may be nullable:

No comments:

Post a Comment