Query and/or Search for SharePoint Document ID
- by Paul-Jan
We have the sharepoint 2010 environment with Document ID's enabled.
Given (part of) a Doc ID, we want to programmatically retrieve the document(s) matching that ID. The problem seems to be that this column is rather special, in that it might need special handling.
Using an SPSiteDataQuery, fetching the _dlc_DocId field as part of the viewfields works fine. However, including it as part of the where query never results in any documents being fetched.
Using the Search API has gotten us nowhere at all.
Has anyone pulled this off, or any suggestions on how to tackle this problem?
[Update] Looks like DocumentIdProvider.GetDocumentUrlsById might be used for this purpose. If necessary, the matching SPListItem can then be found by querying on the URL. However, the MSDN documentation doesn't document the documentId arugment properly, so I'm unsure whether partial ID's are allowed and in what format.