Forum Discussion
Tarundeep
Nov 30, 2018Copper Contributor
Can I fetch ContentType as one of the selected fields in pnp SPFX Caml query
User will provide a list of URL's from Site pages, then I need to know the ContentType of each Site Page provided by the user. Is this possible, I am trying to do something as below but it's not showing the ContentType
<ViewFields>
<FieldRef Name='Title' />
<FieldRef Name='ImageLogo' />
<FieldRef Name='ContentType'/>
</ViewFields>
3 Replies
Sort By
- AlexselivCopper ContributorTo be able to use item.ContentType.Name or comparison item.ContentType.Name == "Some contentype", ViewFields should contain:
<FieldRef Name='ContentTypeId' />
Thanks to this blog:
https://gp23.com.au/2017/03/28/csom-contenttype-and-caml-queries/ - Thomas BermanIron Contributor
Are the other fields returning correctly, or is the entire query not working?
- TarundeepCopper Contributor
Hi Thomas,
Other fields are showing up perfectly. It's only with the Content Type. :-(