-
Notifications
You must be signed in to change notification settings - Fork 232
Sharepoint 2013 REST API limitations with site columns #178
Comments
We are targeting REST as much as possible so if there is a gap in the API you can submit a user voice request to let the team know. I haven't looked at this but perhaps there is something we can add to help ease getting these fields in REST - but it looks from that article you linked that we would need to make requests for those fields separately. I am not sure that is the best solution as we wouldn't know what type of fields you really wanted and would be very hard to make generic. Likely the best option is to make the request using the html value as shown for those fields. You could chain the operations together with .then() and aggregate the result on a single object. This is a good candidate for a sample rather than an update to the core library - but open to options. |
@patrick-rodgers it works, i found this columns on FieldValuesAsHtml, Thanks! |
Does anyone have a code sample for this? |
This is a huge ommission from the MS team, after all the REST API can return a Publishing HTML field without a problem, the workaround only works when you're after a single item, if you're looking for a list of items (which includes a Publishing Image column) you're out of luck. |
It really is. I have just sussed it though. Shame as this is a major performance hit.
|
I could found the |
I've found a way to do this without multiple REST calls, though its a bit schloppy. First the REST call: Then to get at the PublishingRollupImage in the response items you have to parse out the MetaInfo field value which contains all field values separated by the e.g.
|
Awesome stuff. I will try this out myself. |
I have tried this, but I am not getting the MetaInfo object returned:
|
Does the REST url PnP creates look correct? |
$pnp.sp.web.lists.getByTitle('Pages').items
.select("Title", "ID", "Country", "ArticleStartDate","FileRef", "Brands", "CaseStudyCategory", "FieldValuesAsText")
.filter(RedPlane.CaseStudies.Search.getFilter())
.expand("FieldValuesAsText")
.get().then(function(items) { ... }); @MarkStokes-outlook try this one! |
MetaInfo seems to be pretty heavy the more content you have in each item. If you're building something that's a very average news widget where you just display title, image and some small bit of extra info its probably a bad use case to download its entire PublishingPageContent for example. I will insist about the omission here mentioned by @phillipharding, if we want to eagerly load these properties just make the API do so already, its been years [wasn't even possible via REST for a long time]. |
This thread helped me a lot, and eventually enabled me to get the Publishing RollupImage with the FileRef and Title fields I was able to create a news slider..(not exciting I know) anyway heres the complete code for those looking to use pnp.js directly:
|
Category
[ ] Enhancement
[ ] Bug
[X ] Question
Expected / Desired Behavior / Question
Suport all kind of field type
Observed Behavior
I'm using PnP-JS-Core and i need get some fields, but according to this link, i can't.
Sharepoint 2013 REST API limitations with site columns
They don't come with the response stuff, in others project's i get then with CSOM, at this time i really will need use CSOM?
I could not find any docs about this _api limitation on MSDN
Thanks!
The text was updated successfully, but these errors were encountered: