2 thoughts on “OData $expand not working – SharePoint REST API

  1. I think you may be misrepresenting the power of this FieldValuesAsText command or conflating it with what $expand uaually does. FieldValuesAsText gives you one and only one property of a complex item and you seemingly do not get to determine which property it is. For instance, for a URL field, I may want the Description property (especially if I am looking for the status of a workflow). I do not want the actual URL. I see no way to pull the Description property of a SP.FieldUrlValue. Do you? If you can demonstrate that then clearly the misunderstanding is on my side.

    Just to be clear, your article is indicating that $expand=Field/Property functionality is now replaced by FieldValuesAsText and I disagree.


    • Actually no. I have also mentioned in the article that, unless there’s an obligation to use the getitems API, the recommended approach would be to use the items API defined here, https://piyushksingh.com/2017/08/31/retrieve-lookup-managed-metadata-and-person-or-group-data-sharepoint/. Even in my example, defined in the link, I have demonstrated to expand two distinct properties of the same Author field. So, we do have a choice to expand any given property. And this is how a REST call should work.

      However, the issue here is that, the standard $expand does not work on the getitems API (defined above in the post), which is strange considering, it’s still very much a REST call! But unlike the items API, getItems allows you to post CAML request. So, it has it’s advantages as well. Hence, in such a scenario, we can leverage FieldValuesAsText, which covers most of the test cases, if not all.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.