Scenarios
When we upload the existing document in the Document Library by unchecking the override existing file,we get a SharePoint OOTB exception saying "A file with the same name already exists and it was last modified by i:o#.w|domain\username."
In this case we have to trim the i:o#.w| which is SID or represents type of authentication used.
Refer to the below screenshot for a clear understanding of the requirement.
Figure 1: Requirement
Figure 2: After
Solution
Step 1: Open the site collection in browser. Go to SiteSettings, MasterPage and then check the selected Site Master Page and System Master Page.
Figure 3: Site collection
Step 2: Open the site in SharePoint Designer. Go to All Files, _catalog, then masterpage.
Figure 4: Designer
Step 3: Open any one of the selected master page in step 1 in advance mode.
Step 4: Add the following script before </head> tag. Check screenshot for reference.
- <SharePoint:ScriptLink ID="ScriptLink_CustomUploadpage" name="~sitecollection/Style Library/Scripts/CustomUploadScript.js" runat="server" LoadAfterUI="true" Localizable="false"/>
Figure 5: Screenshot for reference
Step 5: Repeat step 4 for the other master page selected in step 1.
Step 6: Come to browser and open style library by going to site content, then style Library.
Step 7: Upload the CustomUploadScript.js file to script folder in style library.
Figure 6: Script
Step 8: Test and Verify.