Skip to main content
Solved

Executing API 'CreateFile' failed with error number 32.

  • February 18, 2020
  • 2 replies
  • 1441 views

Freddy
Forum|alt.badge.img+16
  • Thinkwise Local Partner Brasil
  • 528 replies

Does anybody know a good way to catch and prevent the error, when a file for some reason is locked for reading and processing?

Executing API 'CreateFile' failed with error number 32.

Error code 32 is ERROR_SHARING_VIOLATION . So the mailer cannot read the attachment file because something else is reading it.

Besides the fact that you cannot really reproduce it until it happens, I cannot really find a way to catch this error upfront. I am using the file_exists function to check upfront if all documents exists, and even though all attachments can be found, at the time of sending the mail at occasions you get this error. 

The only solution I can think of now is to set the AccountRetryAttempts to 2 times to tackle this problem. But it's not the fanciest solution, anyone has experiences with this?

Best answer by Erik Brink

Hi Freddy,

Maybe think of a file location where users could only get a copy of the original file?

For example, from the GUI point of view there is a difference between the usage of controls of type File/Image Upload or File/Image Link. The "Link” control will open the original file directly. The "Upload” control will download a copy of it.

 

Do you know who else is accessing and locking the file at that moment? 

Regards, Erik

View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

2 replies

Erik Brink
Moderator
Forum|alt.badge.img+5
  • Moderator
  • 497 replies
  • Answer
  • February 26, 2020

Hi Freddy,

Maybe think of a file location where users could only get a copy of the original file?

For example, from the GUI point of view there is a difference between the usage of controls of type File/Image Upload or File/Image Link. The "Link” control will open the original file directly. The "Upload” control will download a copy of it.

 

Do you know who else is accessing and locking the file at that moment? 

Regards, Erik


Freddy
Forum|alt.badge.img+16
  • Author
  • Thinkwise Local Partner Brasil
  • 528 replies
  • February 26, 2020
Erik Brink wrote:

Do you know who else is accessing and locking the file at that moment? 

 

My educated guess was that the reporting service might not be entirely finished writing the file to the disk, but it's not very feasible, because the file_exists function that runs before doesn't give a similar error, which I would expect it to do. For now I just added a 1 second delay before sending the mail, and so far so good. 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings