Modules > Content rating > Content rating internals and API:
Getting document rating
Getting document rating
The following code example demonstrates how you can get rating of a document using the API.
[C#]
using CMS.DocumentEngine; using CMS.CMSHelper; int nodeId = 241; double rating = 0.0f;
// Get the document TreeProvider tree = newTreeProvider(CMSContext.CurrentUser); TreeNode node = tree.SelectSingleNode(nodeId, CMSContext.PreferredCultureCode);
// Get its rating rating = node.DocumentRatingValue / node.DocumentRatings;