簡體   English   中英

讀取位於 Sharepoint 中的 excel

[英]Read excel located in Sharepoint

我已經在 Stackoverflow 中進行了搜索,發現使用 Interop.Excel 的示例很少。

我使用的是 Office 2016,Interop.Excel 面向 2013。我想從我的 C# 應用程序讀取位於 Sharepoint 路徑中的 excel 文件。 用戶將從應用程序更改單元格值,它應該在 Sharepoint 文件中更新。

我檢查了幾個 ClosedXML 樣本,但這些樣本是訪問本地文件而不是 Sharepoint。

// Starting with ClientContext, the constructor requires a URL to the
// server running SharePoint.

ClientContext context = new ClientContext("https://{site_url}");

GroupCollection siteGroups = context.Web.SiteGroups;

// Assume that there is a "Members" group, and the ID=5.
Group membersGroup = siteGroups.GetById(5);

// Let's set up the new user info.
UserCreationInformation userCreationInfo = new UserCreationInformation();
userCreationInfo.Email = "user@domain.com";
userCreationInfo.LoginName = "domain\\user";
userCreationInfo.Title = "Mr User";

// Let's add the user to the group.
User newUser = membersGroup.Users.Add(userCreationInfo);

context.ExecuteQuery();

我希望示例代碼有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM