Yet again a QUEST is solved. How can we know the
Source of a record in a library in
Platform: Office 365 (But I believe this will work on SharePoint 2013 on premise as well)
Scenario: There are more than 50 site collections and
Record Centre is one of them. From the
Site collections we are dumping documents as records in
Record Centre. And in the view of a library in
Record Centre we would like to know the source of the record(i.e. from which site collection it has come from).
To understand the approach let us assume a normal
site collection and a
record centre site collection. And From a
normal site collection we will be sending documents to
record centre site collection.
- Things to do at Site collection: First we need to activate the
Document ID service feature. Goto site settings > Site Collection Features > Activate Document ID Service
- Update Document ID settings: We can set the prefix of the
Document ID generated for each site collection to maintain uniqueness. Goto
Site Settings >
Site Collection Administration >
Document ID Settings
Performing above steps when ever a document is uploaded it will have a unique
Document Id. Refer below screen shot.
If we try to break the Id
N3SITE-424387581-13 we can notice that
- N3SITE: is the prefix which we have in
Document ID settings.
- 424387581: Is the random number generated by SharePoint.
- 13: is nothing but the normal
ID of a document.
13 are quite easy to understand and they are in our control to identify which
site collection. But
424387581 puzzle us, and also from
site collection which library it belongs we would also like to know that.
424387581 is nothing but the unique Id given to a document library. but from where we got to know it?
Cracking down curious case of
424387581: Open your office 365 site collection in
SharePoint Designer. From ribbon control click on
Site Options which is a
property bag. Find the property
docid_msft_hier_listidx, this contains the unique id for all the document libraries.
<?xml version="1.0" encoding="utf-16"?>
This solves our problem of identifying the Document Source.
On Record Centre: On a view of a record library which contains records having
Document ID, we can place a link which will open a new window passing
Document ID in query string.
and on that window we can write our own logic first to break down the Document ID to get the prefix and identify which Site Collection is it. And second query that site collection's property bag using JSOM and check
424387581 belongs to which document library.