Thanks. This seems to work.
Also, I had a look at the Appium source so it seems the supported attributes are "content-desc" with "name", which gives the content-desc if set and "text" attribute value if "content-desc" is not set. Other supported string attributes to query as far as I see are "text" and "className". And a whole bunch of boolean attributes are supported as well. It seems Appium supports most of the attributes available in UIAutomators UIObject so I guess I just got confused with the attribute naming of content-desc here.
Maybe some basic API doc would be nice to document all these. But I got this one sorted now, so thanks..
Teemu