There are some situations when two different users of SharePoint upload same document with two different names. This mostly happens when both of them do not know that someone else has already uploaded same document earlier. SharePoint displays the “[View duplicates]” link when it finds duplicate items for a given search result.
On clicking the “[View duplicates]” link, you will notice that SharePoint searches the duplicate items by creating a keyword query of “duplicate:Full Document Url”
To make our life easier, I have created a Feature which will add a context menu item in ECB and will allow user to directly find duplicates for any item, from the context menu, without first going to the search page.
To get the idea, here is a snapshot of what you will get once our feature is activate:
User will just click on View Duplicates option and will get all the duplicate documents for the selected document.
Implementation:
- Create a folder named ViewDuplicates under FEATURES folder of your SharePoint installation.
- Create a file called Feature.xml under ViewDuplicates folder.
- Paste the following code in Feature.xml:
- Create a file called Elements.xml under ViewDuplicates folder.
- Paste the following code in Element.xml:
- Install the feature by executing stsadm -o installfeature -name ViewDuplicates
- Activate the feature by executing stsadm -o activatefeature -name ViewDuplicates -url <YourSiteCollectionUrl>. Replace <YourSiteCollectionUrl> by the url of your site collection.
- Now, you will get “View Duplicates” option with every document. Click it and Enjoy!
<?xml version="1.0" encoding="utf-8"?> <Feature Id="960206DD-D07E-4b64-AD8A-3E48D7527060" Title="View Duplicates" Description="This feature allows user to view duplicate copies of the selected document." ImageUrl="CALVIEW.GIF" Version="1.0.0.0" Scope="Site" Hidden="FALSE" xmlns="http://schemas.microsoft.com/sharepoint/"> <ElementManifests> <ElementManifest Location="elements.xml"/> </ElementManifests> </Feature>
<?xml version="1.0" encoding="utf-8" ?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <!-- Per Item Dropdown (ECB) Link --> <CustomAction Id="ViewDuplicates.ECBItemMenu" RegistrationType="List" RegistrationId="101" ImageUrl="/_layouts/images/GORTL.GIF" Location="EditControlBlock" Sequence="300" Title="View Duplicates"> <UrlAction Url="javascript:function findDuplicates(){var itemUrl='{ItemUrl}'; var fullUrl=location.protocol+'//'+location.host+itemUrl; window.location.href='/Search/results.aspx?k=duplicates:"'+ fullUrl + '"'};findDuplicates();"/> </CustomAction> </Elements>
Thanks, nice and useful