Sharepoint Library Created and Modified Dates

Copper Contributor

Hello.

 

I have a question about Files Created dates and retention Policies.

If when i create my site y upload lots of files to a library at the same time, the file created date shows as the date the file was loaded - if there is a Retention policy applied that is to keep the file (for exmaple) 5 years, if i cannot modify the Created field on the library to show the correct date, how will the policy work correctly then?

is there a way to change the Created Date (without having to ad a new column for every library)

 

thank you

14 Replies

@MVC_User 
Hi,
Is there a legal requirement to use the created date and not the modified date?
You may want to consider using tools that retain the original create/modify date.

Paul | SLIM Applications

I have the same issue - did you find a solution to this problem?

Thanks 

Kelvin

@Kelvin Kirby 

You can use the rest endpoint 

api/web/getfilebyserverrelativeurl('<absolute path to document>')/listitemallfields/ValidateUpdateListItem()

 

to update fields like "created" and "created by"

This works great from Power Automate

UpdateCreated.png

@SvenSieverding 

 

How can I apply this for updating the Created with another date field, i.e. Fieldname Created - Field Value WFCreated - my flow like this runs successfully but the outputs have an error message "

"Enter a date and time like this: 23/02/2012 14:25" - I'm a novice at http, but I guess I need to convert the timezone, but have no idea how to do this?  
It seems like the data from your WFCreated column is in another format than the rest endpoint expects...

You should try to convert the value using one or more of the power automate expressions like

formatDateTime(<Date>,'dd/MM/yyyy hh:mm')

or with a timezone conversion

convertTimeZone(<Date>,'UTC','Eastern Standard Time','dd/MM/yyyy hh:mm')

What is the exact input in your "Send an HTTP Request to SharePoint" Action?

@SvenSieverding 

 

This is what I have in the HTTP request:

 

claire2020_0-1665738324578.png

tx

@claire2020 Writing column name directly like this will not work. Try configuring your flow as given below: 

ganeshsanap_1-1665744500454.png

 

Use body like: 

 

{
    "formValues": [
        {
          "FieldName": "Created",
          "FieldValue": "@{formatDateTime(item()['WFCreated'], 'dd/MM/yyyy HH:MM')}"
        }
      ],
    "bNewDocumentUpdate": true
}

 


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

@ganeshsanap Thank you so much, I'm very new to working with flow and http requests, and that worked almost perfectly - it updates the 'created' date, but it's a day behind - here is the screenshot, so where WFCreated is 17th, it puts the created date as 16th?  I'm guessing it's time zone related, but I'm not sure how to put this in the http body - thank you for your help

claire2020_0-1665749216583.png

 

Where exactly in the world are you?

Your date is most likely not in the correct zimezone format. so try this formula

@{convertTimeZone(item()['WFCreated'],'<Your Time Zone>','UTC','dd/MM/yyyy HH:MM')}

<Your time zone> is your local time zone....

I use "W. Europe Standard Time" as a value for my timezone, you can get yours from https://www.ge.com/digital/documentation/meridium/V36160/Help/Master/Subsystems/AssetPortal/Content/...
(from the column "Standard Time Zone Name")

If that does not work, then also try switching the timezone parameters:

@{convertTimeZone(item()['WFCreated'],'UTC','<Your Time Zone>','dd/MM/yyyy HH:MM')}

@claire2020 Try using convertToUtc or convertTimeZone function instead of "formatDateTime" function in body.


Please consider giving a Like if my post helped you in any way.

@ganeshsanap thank you, I have used that and it works, so thank you for all your help, very much appreciated

@claire2020 You're welcome, very glad it worked for you!


Please consider giving a Like if my post helped you in any way.

@claire2020 
The Power Automate approach is one that works for you. Good to hear.

Another approach is to extract the create and modify dates from the files itself (not the OS). Most common file formats such as docx, xlsx, pptx, doc, xls, ppt, pdf, jpg, png, msg, eml, ... contain the create and modify date within the files.

For example,

Example of metadata in PDF fileExample of metadata in PDF file
If these values are extracted during uploading into a SharePoint column then this offers a better approach for applying retention labels based on the actual create/modify dates and not the OS dates.

Note: there are file formats such as zip, txt that do not have the capability. 

Hello @claire2020,

Does it work with an item in SharePoint instead of a file?