views:

25

answers:

2

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)?

A: 

rather than simulating the a browser function, which may break in the future, the preferred method is to either use the sharepoint object model or the sharepoint web services to retrieve the file.

you can use the lists webservices for your check in/out functions if that is what you are referring to. http://msdn.microsoft.com/en-us/library/lists.lists_members%28v=office.12%29.aspx

unless I misunderstood your question.

brian brinley
@brian, I get your point about it breaking in the future, but I wasn't sure how to reproduce that functionality with the lists webservice.
DougJones
A: 

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.

<a onclick="javascript: ViewDoc('http://mysite/myfile.xlsx', 'SharePoint.OpenDocuments');"...

This required that I add the link to the Sharepoint javascript file Core.js on my page:

<script src='http://mysite/_layouts/1033/core.js' type="text/javascript"
        language="javascript"></script>

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.

DougJones