When I open an Excel file stored on Sharepoint, I have the option to open it Read Only or in Edit mode. If I open it Read Only, Excel opens up and I see “Server Workbook To modify this workbook, click Edit Workbook”. I need to retrieve this Excel file through an ASP.NET application, yet still have this Server Workbook functionality.
In fiddler, I see that when opening up in Sharepoint, a POST is made to SharepointSite/_vti_bin/_vti_aut/author.dll with method=getdocument as one of the parameters sent and the filename as another.
Do I need to repeat that POST via an ajax call or is there an easier way (as I suspect there is)?
After reviewing this post and finding that he just followed the javascript and called function editDocumentWithProgID2, I did almost that very thing. I just switched from that function to the ViewDoc javascript function.
This required that I add the link to the Sharepoint javascript file Core.js on my page:
Now after clicking the link, the spreadsheet pops up and has the “Server Workbook” with the “Edit Workbook” button
I wouldn’t really recommend anyone copy it, since it is pretty brittle and will break if/when we upgrade to Sharepoint 2010, and that it couples the ASP.NET and Sharepoint sites. It does the job that we need it for right now, however.