Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I have something like this:
SPQuery query = new SPQuery();
query.Query = "<OrderBy><FieldRef name=\"MyTerm\" /></OrderBy>";
I can sort on normal fields, but it refuse to sort on my managed metadata field.
One thing I've noticed in 2010 is that the OrderBy won't work if you're not returning the field name explicitly in the query.ViewFields property. So try adding:
query.ViewFields = "<FieldRef name=\"MyTerm\" />";
to your code.
Maybe you can try to write 'name' as 'Name'.
Does the column allow multiple values?
Required, but never shown