views:

73

answers:

3

we have some data (list) stored in sharepoint. i can manually click "Actions"-> "Export to Spreadsheet" and then run a bunch of code on the Excel output.

I now want to do this on a daily basis from a C# application. Is there anyway to programatically automated that download steps that i am doing now. (the site DOES require authentication)

the "Export to Spreadsheet" fires off some javascript (so doesn't directly just point to a URL so i can read in a URL directly (i dont think)

A: 

if you are not limited to excel and can use other office products, MS-Access 2007 has a very good integration with sharepoint. you can write your macro and vb scripts to run on that with minor adjustments.

you can also use it as a transfer application, if you build a simple EXPORT TO EXCEL macro, and then set it to run periodically.

Kaneti
@Kaneti - i dont care about excel per say as i can get the data into excel after the fact, the issue is i need to programatically get the list data from sharepoint
ooo
if you work from within access (and link a new table to the sharepoint site), it will always keeps the sharepoint list data in sync. so you can just work directly from it.access also has a SQL interface so you can integrate your code to that
Kaneti
@Kaneti - i am looking for a C# programatic solution (not coupled with Excel or Access per say)
ooo
A: 

Basic approach: One you have created the spreadsheet with "Export to Spreadsheet" in SharePoint, the excel file holds a list which is linked to the sharepoint list.

This is a list object in Excel which allows for refresh from the same SharePoint list at a later date, make changes in excel and update the SharePoint list from these. So updating your download is really a refresh of the list which you originate in Excel

AlexJ
+1  A: 

I would recommend getting the data using SharePoint web services and then using NPOI to convert the data into an excel spreadsheet; Use web services so that you are not limited to running the app on the server and NPOI for reading/writing to excel.

Kit Menke
@Kit Menke - Kit, can you clarify when you say "use Sharepoint web services", is this something available out of the box to get data from a sharepoint list or do i need to do something special?
ooo
SharePoint web services are available out of the box (I added a link in my answer for some code on how to access the Lists.asmx service). Also, if you don't want to use web services you could always just use the SharePoint object model.
Kit Menke