Bạn có thể viết một số mã tùy chỉnh để thực hiện. Bạn có thể sử dụng SharePoint API nếu bạn ở trên cùng một máy chủ hoặc sử dụng WebServices
Đây là mã mẫu giả sử bạn biết url của thư viện tài liệu và bạn đang tải tài liệu lên thư mục gốc. Bạn sẽ phải thêm Microsoft.SharePoint.dll làm tham chiếu đến dự án ASP.NET của bạn
using (SPSite siteCollection = new SPSite(url))
{
using (SPWeb spWeb = siteCollection.OpenWeb())
{
SPList spList = spWeb.GetList(url);
string fileName = "XXXX";
FileStream fileStream = null;
Byte[] fileContent = null;
try
{
string docPath = XXXX; //physical location of the file
fileStream = File.OpenRead(docPath + fileName);
fileContent = new byte[Convert.ToInt32(fileStream.Length)];
fileStream.Read(fileContent, 0, Convert.ToInt32(fileStream.Length));
spList.RootFolder.Files.Add(spList.RootFolder.Url + "/" + fileName, fileContent, true);
spList.Update();
}
catch(Exception ex)
{
}
finally
{
if (fileStream != null)
{
fileStream.Close();
}
}
}
}
Bạn cũng có thể sử dụng SPFolder.Add (url, Stream, ghi đè) thay vì đọc toàn bộ tệp vào bộ nhớ (có thể dẫn đến vấn đề hiệu suất nếu bạn định tải lên các tệp lớn) – Marek