Just trying to get some perspective about how to retrieve data from umbraco via the API method. I believe we are using umbraco 4.9.x.
Basically there is a data type called DiaryEventItems, and I use the following code to access this:
// Get the ID of the data type
DocumentType DocTypeDiaryEvents = DocumentType.GetByAlias("DiaryEventItems");
// Loop through those items using a foreach at present
foreach (Document DiaryEvent in Document.GetDocumentsOfDocumentType(DocTypeDiaryEvents.Id))
{
// Do whatever I need to
}
So this works well.. I get back the collection/rows of "DiaryEventItems", however I get ALL DiaryEventItems from the umbraco instance of course.. i.e. for all sites. So obviously there are methods to get the site root node ID and perhaps work down the tree to get the actual document type I need, however is there some way of doing this which is similar to the above code?
Any help appreciated thanks!