开发者

Simulate retrieving Excel file from Sharepoint

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 th开发者_开发百科is 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.

<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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜