Is there a way using any of the umbraco backoffice API's whereby one can read a history of the values of a certain property?
E.g. imagine a password field for a certain document type, can I read in c# a history of the different values that this property has been set to?
The data seems to be in the cmsPropertyData table but would prefer to access via an offical api.
You should be able to use the Content Service to do this. You can call the GetVersions(id) method it has that exposes all the previous content versions. You can then select your property data from each previous version.
Looking at the umbraco source code for ContentService.GetVersions(int id) I notice that it ends up using a cache in the repository layer:
It passes true to the ProcessQuery method: withCache = true
return ProcessQuery(sqlFull, new PagingSqlQuery(sqlIds), true, includeAllVersions:true);
Is there are way that we can avoid using the withCache option? In other words I want to be able to call the ContentService.GetVersions(int id) knowing that it will go straight to the database each time.
Programmatic access to property history
Is there a way using any of the umbraco backoffice API's whereby one can read a history of the values of a certain property? E.g. imagine a password field for a certain document type, can I read in c# a history of the different values that this property has been set to? The data seems to be in the cmsPropertyData table but would prefer to access via an offical api.
You should be able to use the Content Service to do this. You can call the
GetVersions(id)
method it has that exposes all the previous content versions. You can then select your property data from each previous version.Thanks - this is what I was looking for and it seems to work well.
Occasionally however I notice that this method returns null for some of the property values, but then it's OK again. Seems to be random.
Looking at the umbraco source code for ContentService.GetVersions(int id) I notice that it ends up using a cache in the repository layer: It passes true to the ProcessQuery method: withCache = true
return ProcessQuery(sqlFull, new PagingSqlQuery(sqlIds), true, includeAllVersions:true);
Is there are way that we can avoid using the withCache option? In other words I want to be able to call the ContentService.GetVersions(int id) knowing that it will go straight to the database each time.
is working on a reply...