0

The AllItems view of a document library shows the document version in the Version column, for example at:

http://mySite.com/sites/mySite/library/Forms/AllItems.aspx

But when I export the list to Excel, this column is not included. I also don’t see this column in the site settings at:

http://mySite.com/sites/mySite/_layouts/listedit.aspx?List=%7B628E04F4%2D77E9%2D45F5%2D94CD%2D3800916D5416%7D

I looked at the page’s code in Sharepoint Designer and didn’t spot anything relevant.

I looked at this answer but as I only have client-side access, that solution isn't useful.

Is there a way I can add this column to the exported Excel sheet?

1

Here's a no code solution.

Create a new calculated column, say DocVersion. In the formula box just type =[Version]. Change the Data Type of this column to Number instead of Single line of text. Add this column to default view or any custom view. Now, when you do Export to excel this column will have the version number.

Let us know if it worked.

4
  • This works--most of the time. In some cases it returns "0" even though there is a version number showing in Version, e.g. "15.0". – sigil Dec 5 '14 at 23:08
  • Interesting.....You can avoid this behavior after changing the data type from Single line of text to Number. I have updated the answer accordingly. – Amit Tyagi Dec 5 '14 at 23:43
  • It looks like the problem is that the server is slow to update this column, because the library has ~20,000 items. But I'll accept the solution because it works. – sigil Dec 6 '14 at 0:40
  • Unfortunately above solution displays the correct version number only up to the point where the document is edited (document itself or Sharepoint metadata of the document). If you edit the document the calculated field value is reset to "0" on edited document. If you redefine the calculated field e.g. by changing the data type or by changing the formula, it gets properly updated on all documents. However again when any document is edited the calculated field value is reset again to "0" on the edited document. – user48486 Nov 4 '15 at 15:49
0

after a long research via 1.000 of sites which try to solve this issue I found a workable solution.

1) Define a new policy, check "Enable Labels". Do not check the other two options Below it. In the "Label format" field, enter "{Version}" without "".

2) Open your excel file, which must be in the same library and check if the label will be mentioned in the document properties.

3) These properties can be read out via VBA

4) example code

Sub GET_ContentTypeProperties()
Dim rw, p
On Error Resume Next
rw = 1
Worksheets("NAME OF TABLE").Activate
For Each p In ActiveWorkbook.ContentTypeProperties
    Cells(rw, 1).Value = p.Name
    Cells(rw, 4).Value = p.Value
    rw = rw + 1
Next
End Sub

All of the content type properties including the "label" you created will be inserted. In my case it will be "Version: 2.1"

Hopefully you can use it.

Sascha

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.