2

How can I retrieve a SharePoint list item using just the document ID? I am accessing a SharePoint 2013 server (with document IDs enabled) remotely from a .NET application. I do not know which site or library the item exists in...only have the document ID. I would like to use the SharePoint REST service if possible although I will consider any solution that works.

I've tried using the following URLs, but the results always contain 0 items:

http://server/_api/search/query?querytext='ABC-19-29575'
http://server/_api/search/query?querytext='docid:ABC-19-29575'
http://server/_api/search/query?querytext='documentid:ABC-19-29575'
4
  • Looks similar to a question that has been answered before: sharepoint.stackexchange.com/questions/86067/… Commented May 8, 2015 at 16:59
  • But in that question, the user knew the library.
    – wjervis
    Commented May 8, 2015 at 17:35
  • You need to make sure the managed property DocID is queryable.
    – Bunzab
    Commented May 8, 2015 at 23:12
  • Did you get an answer for this yet? I have the same issue. If you have any answer, please post it. Thanks, Bill
    – user44360
    Commented Jul 20, 2015 at 14:00

4 Answers 4

1

I did sort of find a solution to this issue. What I ended up doing was to create an HttpWebRequest to the Doc ID URL and retrieve the HTTP headers. I had to disable AllowAutoRedirect so I could get the "Location" header which contained the path I was looking for. Sometimes this would not always work and I would need to create another HttpWebRequest to the redirected URL where I use RegEx to extract the path contained within the XML.

2

I have it turned on as a column in one of my views the address follows this

/managedpath/sitecollection/_layouts/15/DocIdRedir.aspx?ID=ABC-19-29575

Don't know how that converts to REST or if it will work if you don't know the site collection.

In search schema the managed property name is dlcDocIdOWSTEXT. There is another managed property called DocId, but that is a completely different value.

0
  1. Ensure you have the Document ID site collection feature enabled for the relevant site collection(s).

NOTE: For existing documents, you will have to wait until the timer job runs after the feature has been enabled - before you will see document ID's.

  1. Create a searchable, filterable, & query-able managed property mapped to the crawled property titled: "ows__dlc_docid". See this thread for details/screenshots. Once your content has been crawled after the document ID assignment and managed property creation, you should see results via the search interface or API using the following:

[Managed Property Name]:ZMHZ4F7HWUFU-281895529-13

0

I know this is a really old question, but I found it while I was struggling with the same issue... According to https://www.petri.com/using-document-ids-sharepoint-online you can use DlcDocId to query by Document Id. I use it in the CSOM like

var keywordQuery = new KeywordQuery(ctx);
keywordQuery.QueryText = "DlcDocId:FF6CNQQPKMYZ-371695361-1";

and it's working fine!

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.