cancel
Showing results for 
Search instead for 
Did you mean: 

changing the Creation Date in Alfresco

hayleyg
Champ in-the-making
Champ in-the-making
Hi

Is there any way to change the date a document was created?  I have uploaded some old documents which of course show the date when I uploaded them.  This is not beneficial as I want to be able to exclude older documents from a search by giving them a date pre 2000 (as an example).

Great if you could help.
1 ACCEPTED ANSWER

afaust
Legendary Innovator
Legendary Innovator
Hello,

you can set the CREATED date to an expliicit value via the NodeService methods only if you disable the behaviour for cm:auditable aspect. This requires you to write some code in Java for the Alfresco Repository tier. Some test cases in Alfresco already demonstrate how this may be done, e.g. DiscussionRestApiTest

Regards
Axel

View answer in original post

12 REPLIES 12

afaust
Legendary Innovator
Legendary Innovator
Hello,

you can set the CREATED date to an expliicit value via the NodeService methods only if you disable the behaviour for cm:auditable aspect. This requires you to write some code in Java for the Alfresco Repository tier. Some test cases in Alfresco already demonstrate how this may be done, e.g. DiscussionRestApiTest

Regards
Axel

stevericker
Champ in-the-making
Champ in-the-making
Axel,

Is is safe to assume then that some coding would be needed to preserve the creation dates when files are uploaded (vs the current default of it being the date the file was uploaded)?  I've looked through some old posts and JIRA entries, and can't sort it all out.

In this post (https://forums.alfresco.com/en/viewtopic.php?f=14&t=7792&start=45), mrogers says "No. You can set creation date on newer versions of Alfresco…"  But it's not clear how.

In this JIRA entry, "Original modification date is lost when files are copied into Alfresco via CIFS"  (https://issues.alfresco.com/jira/browse/ALF-10686), the issues was identified as a bug, and seems to have been resolved, but, again, it is not clear how.

Here were some other JIRA entries that seem to discuss this:
https://issues.alfresco.com/jira/browse/ALF-3569 ("Alfresco repository CIFS driver not setting timestamps.")
https://issues.alfresco.com/jira/browse/ALF-15281 ("FTP/FTPS: With preserve timestamps turned off, the modification date does not change.")
https://issues.alfresco.com/jira/browse/ALF-5239 ("WebDAV shows incorrect creation date")
https://issues.alfresco.com/jira/browse/ALF-12350 ("Incorrect modified date if a folder is copied into another directory")

I've tried uploading from the browser, dragging and dropping from the browser, and via webDAV, and the behavior seems to be the same (date becomes the upload date).  It would be great if this could be changed to the original file creation date without a lot of coding.

Thanks for any clarification.

- Steve

stevericker
Champ in-the-making
Champ in-the-making
Sorry one more post that seemed relevant (but not good news):

https://forums.alfresco.com/en/viewtopic.php?f=11&t=20943 ("preserving creation date and modified date")

afaust
Legendary Innovator
Legendary Innovator
Hello,

this does not require "a lot of coding", but Java coding will be necessary. Otherwise you are stuck with the default behaviour, which is appropriate for 99% of the time.

Regards
Axel

stevericker
Champ in-the-making
Champ in-the-making
Thanks.  At least I know it's not a simple parameter changes somewhere.

As an aside,for us, it'd be nice not to have it default to the upload date because we're synching our Share documentlibrary files with DropBox (using open source sync software right now).  Stuff uploaded to DropBox or Share gets automatically synchronized, but the sync logic compares files by date stamp on the files.  So stuff put in DropBox (where the files are stamped with their creation dates) gets synched to Alfresco (now the files get stamped with upload dates) automatically.  A moment later, the synch logic thinks there're newer files in Alfresco and sends them back to DropBox (now the files are stamped with the upload dates).  Just a bit unwieldy.

anth0
Champ in-the-making
Champ in-the-making
Hi,

I'd definitely like to know what kind of code would be needed to do this. I also need to retrieve creation and modification dates from uploaded documents automatically. So each time a user upload a document, Alfresco gets the created/modified dates from the document's metadata instead of the time of upload.

I don't mind writing a bit of code but being new to Alfresco I'm a little bit lost here to find how I could achieve that.

I'm not asking for a complete working code but just some advices on where to look at. Do I need to create a custom extracter? Custom action? How to create something that will be executed on each document while being uploaded?

I already know that I need to get my hand on the policyBehaviourFilter objet and disable audit aspect. What I don't know is how and where to retrieve this object from and how to integrate my code in Alfresco's workflow.

Thank you in advance!

douglascrp
World-Class Innovator
World-Class Innovator

mehe
Elite Collaborator
Elite Collaborator

Maybe you could use a workaround and create your custom "originalCreationDate" Field and set this to the desired date value. Default value of this new field would be the value of "creation date"... just thinking...

afaust
Legendary Innovator
Legendary Innovator

I don't know why this old thread was resurrected by ‌. But you simply need to disable the behaviour for the aspect QName cm:auditable via the policy behaviour filter bean, and then you can provide your own values for cm:creator/cm:modifier and cm:created/cm:modified.