cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kadd
Resolver III
Resolver III

Copy file error : String was not recognized as a valid datetime ??

Hello,

 

Hope you are all doing great.

 

I created a workflow that was working fine till yesterday. I copy a file from a site to another using the action "Copy file".

I put the current site, the file to copy, the destination and destination folder... everything was working ...

 

But today, I get errors. nothing is working anymore.

 

the error is :

 

String was not recognized as a valid DateTime.CallStack -- at system.DateTimeParse.Parse(String s,DateTimeFormInfo dtfi, DateTimeStyles styles) ..... etc...

 

I have no date time, i'm just copying a file and things were working before !

 

Site regional settings are set to belgium, even if i change back to english US...the error is still there.

 

Would someone have any idea how to solve this ?

 

Thanks a lot !!

6 REPLIES 6
NiloferA
Super User
Super User

Hello @Kadd ,

Could you please post screenshots of your Flow actions and also one of the Runs where it failed with detailed Error?

Kadd
Resolver III
Resolver III

Hi @NiloferA 

 

thanks a lot for your answer

 

so, the action is 

fig1.png

 

the actions right before this are the trigger and the initialisation of the variable, which is text.

There is nothing else...no date, nothing...

 

in the flow i get this

 fig2.png

 

and the error is 

 

String was not recognized as a valid DateTime. CallStack --    at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)

   at Microsoft.SharePoint.SPListItem.SetValue(String strName, Object value, SPField field, Boolean protectFields, Boolean skipValidation)

   at Microsoft.SharePoint.SPListItem.set_Item(Guid fieldId, Object value)

   at Microsoft.SharePoint.Deployment.ListItemSerializer.UpdateFieldData(SPListItem listItem, SPLoggerObject loggerObject, ImportObjectManager objectManager, Guid docId, String fieldName, String value, String value2, Guid gFieldId, Boolean& bCreated, Dictionary`2 brokenFields)

   at Microsoft.SharePoint.Deployment.ListItemSerializer.UpdateFieldDataInternal(SPListItem listItem, SPLoggerObject loggerObject, Guid docId, Boolean& bCreated, SPContentTypeId contentTypeId, ImportObjectManager objectManager, Object listItemFieldsData)

   at Microsoft.SharePoint.Deployment.ListItemSerializer.UpdateFieldData(SPListItem listItem, SPLoggerObject loggerObject, Guid docId, Boolean& bCreated, SPContentTypeId contentTypeId, ImportObjectManager objectManager, Object data)

   at Microsoft.SharePoint.Deployment.ListItemSerializer.SetObjectData(Object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)

   at Microsoft.SharePoint.Deployment.XmlFormatter.CallSetObjectData(Object obj, SerializationInfo objectData, ISerializationSurrogate surrogate, ISurrogateSelector selector)

clientRequestId: 977a312b-6c65-4ade-a30f-368e4e788f94

serviceRequestId: 977a312b-6c65-4ade-a30f-368e4e788f94

 

thanks a lot !

Hello @Kadd ,

Lets check a few things!

  1. Have you tried copying any other file apart from the one which is giving you error?
  2. What type of file are you copying? .docx, xlsx, pdf, etc?
  3. Does your file have any dates within it's content?
  4. Can you try copying the file to some other Library and see what happens?

Let me know your findings.

Kadd
Resolver III
Resolver III

Hello @NiloferA ,

 

Sorry for the late reply, i've been pretty busy yesterday.

 

1. Yes I tried with other types of files ... docx, xlsx, pdf ... those are the 3 types of documents we are working on.

 

2. the type of file i'm working on at the moment is a docx .... but i also tried with other types and it's not working either

 

3. Date within it's content ? in the text of the body ? some of them yes but they are manually written. I also tried with a blank file and files with no date inside ...no luck. However, I have a metadata Date field...which is used as a next revision date... but it's there from the beginning, even when the workflow was created and it's working for more than a month with and without a date in.

 

4. it works within the same site but not when i copy the file to another. and regional setting are identical on both sites.

 

Thanks

Kadd
Resolver III
Resolver III

@NiloferA 

 

I found a workaround... instead of copying the file, i recreate it at the destination and this works.

 

But the problem i have now is that it doesn't replace the file if it already exists. the workflow just crashes.

So i have to go to the library and delete manually before launching the workflow...which then becomes a bit useless...hmm...

Hello @Kadd ,

If that's the case then you can do the following

  1. Add a Delete File action and try to delete the file first
  2. Then add the Create File action
  3. Click on the ellipsis icon on the top right of the Create File action
  4. click on Configure run after
  5. Check the option that says "When Delete File Fails", and the option "When Delete File succeeds" will already be checked and hit Save

This will ensure that, if the File exists, delete it and then create a new one, if it does not exists then Delete File will encounter an error but still continue to the next action and simply create a new one

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,242)