I have a business requirement of changing the date of 'created' column/field of selected document/s in a document library(it has to be changed to current system date). This has to be done by adding a custom button to the ribbon and providing authorization to the button. Please let me know if this is possible?
1 Answer
Yes, it should be possible. See this article as reference, and sample code here. In that sample a custom field was developed to achieve the same goal, but you can easily translate that into a ribbon component (button) as well.
yourFile.Item["Created"] = DateTime.Now;
yourFile.Item.UpdateOverwriteVersion();
The sample allows only site admins (Web.CurrentUser.IsSiteAdmin
) to use the field.
See this related thread too.