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'

migrated from stackoverflow.com May 8 '15 at 16:46

This question came from our site for professional and enthusiast programmers.

  • Looks similar to a question that has been answered before: sharepoint.stackexchange.com/questions/86067/… – Ransher Singh May 8 '15 at 16:59
  • But in that question, the user knew the library. – wjervis May 8 '15 at 17:35
  • You need to make sure the managed property DocID is queryable. – Bunzab May 8 '15 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 Jul 20 '15 at 14:00
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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