I'm currently building some applications that will connect to a WCF acting as a middleware between these external apps and a Document Management System. This means that I have doubts choosing the DMS (SharePoint, Alfresco, or custom made in a SQL Server Data Model). The DMS is intended to store large amounts of documents because there are at least 4 applications that will consume the WCF (one of the applications about 1TB of documents every 3 months)

One of the main constraints is that after calling the WCF and then SharePoint Web Services to insert documents, the Access to those documents has to be immediate (so I cannot use Search Service).

My idea here was to activate the Doc ID feature in the site collections, in some way the WCF would do some query by the Unique Doc ID (I don't know if this is possible) and then, the WCF would retrieve a JSON or something like that to the applications with the Document ID as one of the values of the JSON string (metadata, site collection name, etc as other values of the string)

Alfresco, for instance, has some web services that retrieve somethig like the NodeLeafID so you can store in the external Apps data models and don't need to call Search Services.

Does anybody know how can achieve something like this?

  • I don't understand why you can't use the doc URL as an ID for it.
    – Evariste
    Commented Dec 23, 2015 at 18:33
  • Will this application last its required lifetime or will it move to a Cloud? Commented Dec 23, 2015 at 20:04
  • @Evariste, I cannot use de doc URL because the external applications shouldn't know where the document is placed at (for security reasons). Commented Jan 4, 2016 at 9:18
  • @DannyEngelman most probably will remain in an on premises environment. Commented Jan 4, 2016 at 9:21

1 Answer 1


You can create your own unique Id by combining (e.g. concatenating) the GUID of the sub-site, the GUID of the doc lib and the Id (int) of the item.

For exemple, you upload a document to http://WebApp/sites/site01/subsiteA/TheDocLib.
You can then get the Id of subsiteA, the Id of TheDocLib and last the Id of the file you've just uploaded:

  • Id of subsiteA: {EFA3433B-50FA-46CA-BD13-FFE89BE696BD}
  • Id of TheDocLib: {170F4DC4-695D-4D6C-8A66-29F7CEA054C}
  • Id of the file item: 13

This would give something like EFA3433B50FA46CABD13FFE89BE696BD170F4DC4695D4D6C8A6629F7CEA054C413. That's your unique Id for a given doc.
When that Id is presented later, you can easily access the document with the (server or client-side) object model. First you split it to get back all 3 Ids (32 chars, 32 chars, remaining digits compose the item Id integer), and (e.g. with CSOM), you can easily open the Web by its Id, open the list by its Id, and get the item #13.

  • That is a good answer. But lets say that I've organized the Doc libraries by folders. Can I get the ID independently of the folder? Do you know any opensource solution or code to achieve this? Commented Jan 4, 2016 at 9:40
  • In a given document library, files (items) have unique Ids (integers) independently of folders: so you don't have to consider folders when you build your Ids. You can then retrieve the file by its Id without knowing its parent folder. You only need to know its parent doc lib.
    – Evariste
    Commented Jan 4, 2016 at 9:49
  • The last thing. Have you tested this with a large Farm with hundreds of millions documents? My client is ver worried about SharePoint performance. He wants fast response time when retrieving the document from the external application. Or do you have any reference guide (apart from MSDN articles that I have already visited but didn't help me) Commented Jan 4, 2016 at 10:05
  • The main concerns would be about the DB size (see technet.microsoft.com/en-us/library/cc262787.aspx#ContentDB). IMO the number of documents is not really the problem (see technet.microsoft.com/en-us/library/cc262787.aspx#ListLibrary). Retrieving documents by their Ids is generaly not a problem, it's even the fastest way. However, if you use SharePoint to only store documents (no collaboration, no search, even no UI in your case!), maybe you should reconsider its usage...
    – Evariste
    Commented Jan 4, 2016 at 10:09
  • Yeah that is precisely my headache. I could build up a DB schema for DMS and store the documents in SQL Server with File Stream and File table. My client's main concern is performance and he is worried about SharePoint is the suitable solution but I don't have experience building custom Document Management Systems (no versioning needed, nor check in-out). We currently have SP 2010 and want to create a 2013 Farm only for Document Management purposes. What do you think? Custom .NET App with custom DB model or SharePoint?. The deadline for this DMS is end of February 2016. Many thanks again Commented Jan 4, 2016 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.