我想读取在itemadded事件上传的excel文件。我需要通过阅读上传的Excel表单来更新文档库的元数据列。但我得到以下错误,阅读excel附件itemAdded事件
这里是我的代码,
SPItem item = properties.ListItem;
string workbookpath = "http://server/sites/dev/Published%20documents/Test.xlsx";
ApplicationClass excel = new ApplicationClass();
excel.Visible = false;
Workbook excelWorkBook = excel.Workbooks.Open(workbookpath, 0, true, 5, "", "", false, XlPlatform.xlWindows, "", true, false, 0, true, false, false);
Sheets sheets = excelWorkBook.Worksheets;
Worksheet worksheet = (Worksheet)sheets.get_Item(1);
Range range = worksheet.get_Range("A1", "A1");
item["Status"] = (string)range.Cells.Value2;
item.Update();
base.ItemAdded(properties);
出于测试目的,我硬编码的Excel文件的路径。
但SPItem没有“SystemUpdate()”方法。如何使用它 ? – Rishi