I’m trying to create a Python script to migrate files from Alfresco to Nextcloud. My goal would be to transfer the files from Alfresco to Nextcloud and preserve the file date. I also would like to transfer all file comments including their creation date.
I’ve managed so far to export all Files and comments from Alfresco using their api. Now I’m looking for ways to import this into Nextcloud. I already found a way to create comments like this:
res = requests.request(“PROPPATCH”, url, auth=HTTPBasicAuth(user, password), data=data.encode(encoding=‘utf-8’))
It is also possible to set a specific date for comments, but first I had to add one line of code to the following file inside the nextcloud server to be able to do this:
/nextcloud/apps/dav/lib/Comments/CommentsPlugin.php Line 245:
$comment->setCreationDateTime(new \DateTime($data[‘creationDateTime’]), new \DateTimeZone(‘UTC’));
After that the date can be set by sending a unix timestamp with UTC timezone as a “creationDateTime” json variable. I don’t know yet if this additional line of will cause any side effects. Saving comments in the webpage still seems to work. But the line can simply be removed after importing.
Did this still work for you in the latest version? I think I’ve implemented this but it’s not changing the date/time of a file on the latest nextcloud for me.
Python 3.7.4, for the res var it gives me <Response [207]>