I'm using REST to retrieve some information from a document library. There are some managed metadata fields attached to the items I'm returning. I've found that if the managed metadata column is a single pick then REST only returns the ID number not the actual label for the term. (Multipicks work as expected).

To work around that I'm following this blog which says to use the getitems endpoint, CAML query, and POST to retrieve list data with correct managed metadata fields. And it works! Ugly as the work around is it is so good so far.

The problem is that I need to retrieve both the Document ID and MyManaged columns.

If I don't include any in my CAML query I get all kinds of information including the document id, but not MyManaged.

If I include viewfields like so:

"<ViewFields>" +
    "<FieldRef Name='MyManaged' />" +
    "<FieldRef Name='Title' />" +
    "<FieldRef Name='OData__dlc_DocId' />" +

I get MyManaged properly expanded with a readable label, but the Document ID is nowhere to be found. (And yes that is the correct name for the document id.)

Any idea how to get the columns returned by default AND include custom ones?

Or a different way to get properly expanded managed metadata labels?

1 Answer 1


D'oh. That isn't the correct name for the document id when using a CAML query.

"<ViewFields>" +
  "<FieldRef Name='MyManaged' />" +
  "<FieldRef Name='Title' />" +
  "<FieldRef Name='_dlc_DocId' />" +


Thank you goes to OneOff who answer this thread.

The value is returned at OData__dlc_DocId, but that isn't how you ask for it. Really Microsoft?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.