It would be really cool if I could save a Sharepoint List to an XML file on a Unix server. I see a bunch of articles but I can’t seem to get it to work.
First, go to the Sharepoint site with your list – in the list ribbon menu, click ‘Export to Excel’. If you’re on a Windows machine, don’t open the file with Excel. Save the file and then open it with a text editor. On a Mac, you will likely get a message saying that you need a sharepoint foundation compatible app – click okay, and the browser should open the file you need.
Line 3 of the file is the url you need:
1 |
https://my.server.com/folder/group/_vti_bin/owssvr.dll?XMLDATA=1&List={list-number}&View={view-number}&RowLimit=0&RootFolder=%2fops%2fag%2fLists%2fSubdivisions |
Using the url, here is the command to extract the xlm (all on a single line):
1 |
curl --ntlm -g -k -o file.html -u “user:password" https://server/path/site/_vti_bin/owssvr.dll?XMLDATA=1'&'List={list-number}'&'View={view-number}'&'RowLimit=0 |
Notes on this command line:
- I’ve removed everything after &RowLimit=0 just because I wanted the minimum needed for the url. It isn’t necessary otherwise.
- You must enclose the & symbols in quotes.
- You must include the -g flag. This turns off the “URL glowing parser.” I don’t know what this means, but it allows you to use square and curly braces ( {} [] ) in a url.
- The ntlm flag enables Windows authentication. I don’t know anything else about it. I don’t think it’s necessary if you’re doing this on a Windows machine.
- The o flag saves the file to the specified file name
- The u flag contains login credentials. In my case, I did not need to include the domain. you may need to.