Hi Folks,
I am using MOSS/Excel 2007.
I am trying to get updates in my Excel Web Access Webpart when Sharepoint list change. So, i am trying to do it with
Excel Web Service API's. However, I am not getting updates in Workbook. Below is my code:
xlService.Timeout = 600000;
xlService.Credentials = System.Net.CredentialCache.DefaultCredentials;
string lstrWorkbookPath = "http://server/sites/Practice/test/Shared%20Documents/test5.xlsx";
string sessionID = xlService.OpenWorkbook(lstrWorkbookPath, "en-US", "en-US", out status);
xlService.Refresh(sessionID, null);
byte[] workBookSnapshot = xlService.GetWorkbook(sessionID, ExcelWebServiceAPI.ExcelService.WorkbookType.FullWorkbook,
out status);
//status is coming null
status = xlService.CloseWorkbook(sessionID);
//status is coming null
BinaryWriter binaryWriter = new BinaryWriter(new FileStream(@"C:\SnapShot.xlsx", FileMode.Append));
binaryWriter.Write(workBookSnapshot);
binaryWriter.Close();
I
also have 1 connection in workbook which is exported to Data Connection Library. I also approve it as i am site coll. admin. on my site.
When i open workbook in C:\, i don't get updates. But, when i click on Refresh button (in Data menu) in workbook, i get updates. I need updates without clicking on Refresh button. Is there any problem with Session timeout? Please advise.
- Chintan