Please specify what version of the library you are using: [ 1.2.8 ]
Please specify what version(s) of SharePoint you are targeting: [ 2013 ]
I am looking for a method which supports below items:
So far I tried, getItemsByCAMLQuerywhich supports 1 & 2 but only returns lookup ids not the expanded values.
renderListData does not support item 1.
Am I missing something. What are my options in PnP for this?
In the getItemsByCAMLQuery method, you also have another parameter, expands which basically appends $expand to the query.
Using that, I was able to get lookup and managed metadata terms. I dont have 2013 OnPrem with me, so i tested it in SPO and it gets me the necessary data for lookups and managed metadata fields. It might work on 2013
sp.web.lists.getByTitle("Documents").getItemsByCAMLQuery({
ViewXml: "<View />",
FolderServerRelativeUrl:"/sites/testSiteCollection/Documents/TestFolder"
}, "FieldValuesAsText").then(d => {
console.log(d.FieldValuesAsText);
});
Thanks @gautamdsheth , this works well in SP 2013 too. Additionally, I had to set odata=verbose, as default minimal metadata was not providing FieldValuesAsText properties.
pnp.setup({
sp: {
headers: {
"Accept": "application/json; odata=verbose"
}
}
});
Most helpful comment
In the
getItemsByCAMLQuerymethod, you also have another parameter,expandswhich basically appends$expandto the query.Using that, I was able to get lookup and managed metadata terms. I dont have 2013 OnPrem with me, so i tested it in SPO and it gets me the necessary data for lookups and managed metadata fields. It might work on 2013