5

I have a project in which we want to extract the SharePoint generated Document ID from the persistent URL: https://SITE_COLLECTION_URL/_layouts/15/DocIdRedir.aspx?ID=ABCDEFGHIJKL-11-1

It appears as though the DocID is usually 17 characters. Is that ALWAYS the case?

4

"Document IDs consist of two parts, a prefix (that is randomly generated per site collection by default) and two sets of numbers. An example Document ID looks like this: J2W3DN6QF6XW-2-10. The first number is the ID of the list that the document was first created in and the second number is the ID of the item in that list. The prefix can be specified per site collection and can easily be changed from the Document ID settings page."

Source: Document ID in SharePoint Server 2010


According to that description, only the minimal length of a default document ID is for sure, which is 16 (e.g. ABCDEFGHIJKL-1-1).

The actual length depends on the number of items in your library and the number of libraries on your site.

You can also modify the prefix yourself and choose a string of 4 to 12 characters which would decrease the possible minimum length to 8 (e.g. ABCD-1-1).

0

You shouldn't need to worry about the length of the ID for extraction. The querystring is a key/value pair and can be parsed in a lot of ways. Here's a JavaScript example:

`

// JavaScript query string

getQueryString = function() {
            var result = {}, queryString = location.search.substring(1),
                re = /([^&=]+)=([^&]*)/g,
                m;

            while ( m = re.exec( queryString ) ) {
                result[ decodeURIComponent( m[ 1 ] ) ] = decodeURIComponent( m[ 2 ] );
            }
            return result;
        }

`

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.