Monday, January 16, 2012

Could not get Managed metadata or lookup field values through SharePoint 2010 REST web service

SharePoint 2010 provides a new RESTful web service to integrate with SharePoint data. When we use it to integrate with list data, we are not able to get managed metadata fields. After researching through different scenarios, we have concluded that REST interface could not get any lookup fields including user and group fields, normal lookup fields, or managed metadata fields. Indeed user fields and managedmetadata fields are look up fields.


We have created a customized list named “SOAP” with four columns. Title as string, Sponsor as user, ManagedMetadata as local term store fields, and descriptions as string. We have two list items added as in the following screenshot.


Please Sponsor is the looup fields as indicated in the following screenshot.
When we try to access this SOAP list through REST web service, we are not getting either Sponsor or ManagedMetadata values. Instead we are getting the lookup index values. Here are two ways either from REST returned xml or SharePoint Designer Data Source. Here are details.

1. Verify from REST ATOM returned xml data. Here are the steps to reproduce this.
  • Configure to display REST data in xml format. For IE version 8 go to Tools –> Internet Options –> Content tab –> Feeds and web slices Settings.  In this dialog, clear the Turn on feed reading view check box as indicated in Randy's post.
  • Invoke REST to display result http://sbx08/sites/Harry/_vti_bin/listdata.svc/SOA
 You will see result in xml in the following screenshot. The list item 1 Sponsor displayed as index "1" and Managedmetadata also displayed as index.
2. Verify from SharePoint designer Data Source values. Here are steps.
  • Open site http://sbx08/sites/Harry with SharePoint designer
  • Add REST Web service to the Data Sources similar to add SOAP web service
  • Add a data view web part to the page using the data source 
Please note you need to enter user name and password in order to make REST data source work. The correct for my site is show in the screenshot.

I have inserted the REST data source into one page and here is the result from REST data source as in the screenshot. You will see it does not return Sponsor or Managedmetadata values. They are lookup index instead.
The same list will return both Sponsor or Managedmetadata values through SOAP web service interface as in the following screen shot using designer.
There are several attempts from different people try to resolve this through API or LINQ. However, it would be extremely difficult for end users to utilize REST web service if we could not get back managed metadata or any lookup fields.
 If you have any suggestions, please let me know.

No comments:

Post a Comment