Query and/or Search for SharePoint Document ID

Posted by Paul-Jan on Stack Overflow See other posts from Stack Overflow or by Paul-Jan
Published on 2010-06-04T07:08:47Z Indexed on 2010/06/14 8:32 UTC
Read the original article Hit count: 441

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about sharepoint

Related posts about sharepoint2010