Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have am using this part of the API to get content of a specifc doctype
IContentType attendanceContentType = ApplicationContext.Current.Services.ContentTypeService.GetContentType("attendance")
I don't want all of them that exist in my system but those that are under a particular node instead.
Thanks
What about using something like this:
IContentType attendanceContentType = ApplicationContext.Current.Services.ContentTypeService.GetContentType("attendance")var items = ApplicationContext.Current.Services.ContentService.GetContentOfContentType(attendanceContentType).Where(c => c.ParentId == {specific Id})
That is close but not quite what I need.
The main issue is that the doctype I am looking for is not immediately under the parent. otherwise the .Where would work
Root
Location
Meeting
Attendee 1
Attendee 2
I am looking to get attendees for all meetings at a particular location
Thanks again
Ah, ok! How about trying this instead:
IContent node = ApplicationContext.Current.Services.ContentService.GetById({specific Id});
ApplicationContext.Current.Services.ContentService.GetDescendants(node).Where(c => c.ContentType.Alias == "attendance");
Perfect!!
Marty where abouts are you trying to get this is? a razor file? If so you will be better of going for IPublishedContent.
Charlie
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Getting Content of a certain DocType starting a specific node.
I have am using this part of the API to get content of a specifc doctype
IContentType attendanceContentType = ApplicationContext.Current.Services.ContentTypeService.GetContentType("attendance")
I don't want all of them that exist in my system but those that are under a particular node instead.
Thanks
What about using something like this:
IContentType attendanceContentType = ApplicationContext.Current.Services.ContentTypeService.GetContentType("attendance")
var items = ApplicationContext.Current.Services.ContentService.GetContentOfContentType(attendanceContentType).Where(c => c.ParentId == {specific Id})
That is close but not quite what I need.
The main issue is that the doctype I am looking for is not immediately under the parent. otherwise the .Where would work
Root
Location
Meeting
Attendee 1
Attendee 2
I am looking to get attendees for all meetings at a particular location
Thanks again
Ah, ok! How about trying this instead:
IContent node = ApplicationContext.Current.Services.ContentService.GetById({specific Id});
ApplicationContext.Current.Services.ContentService.GetDescendants(node).Where(c => c.ContentType.Alias == "attendance");
Perfect!!
Thanks
Marty where abouts are you trying to get this is? a razor file? If so you will be better of going for IPublishedContent.
Charlie
is working on a reply...