An API that connects multiple Microsoft services, enabling data access and automation across platforms
If a file is deleted and then uploaded again, it is treated as a new file. That means it is no longer the same item as the original file, so the file ID can change.
If a file is updated by replacing it with a new file using the same name in a document library, SharePoint can keep it as the same document item when the file is checked out, replaced, and then checked back in. If versioning is enabled, SharePoint creates a new version and keeps earlier versions. That indicates an update/version operation does not create a new file item in the same way as delete-and-upload.
A practical distinction is:
- Delete + upload again: creates a new file item, so a different file ID is expected.
- Update/replace existing file: typically updates the existing document and creates a new version if versioning is enabled, rather than creating a brand-new item.
This matches the observed behavior where a renamed and re-uploaded file is treated as a new file rather than the original one.
References: