Replace existing file and upload as a new version in a checkout enabled document library

Rijo Rajan 0 Reputation points
2025-08-28T08:59:11.6166667+00:00

Hi Team,

My requirement is -

1)Users want to have the file to be checked out by default while uploading

  1. Users want to have the file replace the existing file and upload as a new version

I updated the versioning settings Require check out as 'Yes' and (1) is resolved.

However, Requirement (2) is not working (replace existing file and add as new version)

For example: There is an existing file ‘test6.pdf’ and when I upload the same file name, I get the error message as shown below. If check out is 'not' enabled, I will get a message asking me to replace the file and it will replace the file and add as a new version.

Since i need to have check out enabled by default, at this moment, when i get the error, I look for the other file with the same file name -> check out manually -> try to upload the new file again. However, this is not practical when dealing with requests for updates on 50 or more documents. Also, my document library has 30K files, and it is difficult to search the existing file to do a manual check out.

Please share any suggestions you may have and really appreciate it.

Thanks,

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tamara-Hu 1,865 Reputation points Microsoft External Staff Moderator
    2025-08-28T12:45:39.19+00:00

    Hello @Rijo Rajan

    Thank you for posting your valuable question on Microsoft Q&A forum. 

    Please understand that our forum is a public platform, and we will modify your question to cover your organization domain name in the description. Please notice to hide these personal or organization information next time you post error or some information to protect personal data.   

    You’re running into “by design” behavior in SharePoint when Require check out is enabled. When the library requires check out, others can’t overwrite a file until someone checks it out. Only after you check out → upload same name → check in does SharePoint store a new version. Microsoft also cautions that requiring check out is not ideal for co‑authoring and can slow collaboration—something to consider if your scenario doesn’t strictly need enforced locks.  

    For more information, please refer to: 

    You can Use Power Automate to Automate File Replacement: 

    Before create your flow, Ensure target library is configured: 

    • In the target document library (the one with your “real” files), confirm:  
      • Versioning is ON (Major versions at minimum). 
      • Require Check Out is Yes (since you chose Option 2 earlier). 
      • (Optional)Content approval if you need review before final visibility. 

    How to use Power Automate to Automate File Replacement:  

    Step 1: Trigger the Flow 

    • Access to Power Automate (flow.microsoft.com) > Sign in to your account
    • Click Create > Automated cloud flow
    • Use: 
      • Trigger: “When a file is created or modified” in SharePoint. 
      • Inside your trigger, choose your Site Address and Library Name 

    User's image

    Step 2: Get File (Properties only) 

    • Action: “Get file (properties only)” > SharePoint 
    • Use the file name from the trigger to search in the target document library. 

    User's image

    Step 3: Apply to Each File 

    If multiple files are uploaded: 

    • Add “Apply to each” loop to process each file individually. 

    User's image

    • Under Select an output from previous steps, type: "/" > Insert dynamic content > choose body/value from the Get files step 

    User's image

    User's image

    Step 4: Check Out Existing File 

    Inside the loop: 

    • Add “Check out file” > SharePoint  Use the Identifier from the file properties. (Refer to step 1) 
    • Under Id, type: "/" > Insert dynamic content > Choose ID under Get files step 

    User's image

    Step 6: Update Existing File 

    • Add: “Update file” > SharePoint 
    • Use the Identifier of the existing file 
    • Use the new file content from Step 5 

    User's image

    Step 7: Check In File 

    Add: 

    • “Check in file” > SharePoint 
    • Use the same Identifier 
    • Add a comment like “Updated via automated flow” 
    • Check in type: similar to your Versioning Settings. 

    User's image

    • Click Save 

    After Saving, you can try to upload the file again. You'll see 2 options below: 

    User's image

    You can use this image as a reference to your flow: 

    User's image

    Please feel free to reply if you need any further assistance. Thank you for your patience and understanding!


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. 

    User's image


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.