0
첨부 파일로 모든 유형의 파일을 가질 수있는 SharePoint 일정 이벤트가 있습니다. 파일 내용에 액세스하거나 다운로드 할 수있는 방법이 있습니까? 이 파일의 합계를 계산해야합니다.SharePoint 이벤트 첨부 파일에 액세스
첨부 파일로 모든 유형의 파일을 가질 수있는 SharePoint 일정 이벤트가 있습니다. 파일 내용에 액세스하거나 다운로드 할 수있는 방법이 있습니까? 이 파일의 합계를 계산해야합니다.SharePoint 이벤트 첨부 파일에 액세스
string siteURL = "http://yourserver/yourpathtothesite";
using (SPSite site = new SPSite(siteURL))
{
using (SPWeb web = site.OpenWeb())
{
string listName = "Events";
SPList calendarList = web.Lists[listName];
// get whatever item you are interested in
SPListItem item = calendarList.GetItemById(1);
foreach (String attachmentname in item.Attachments)
{
String attachmentAbsoluteURL = item.Attachments.UrlPrefix + attachmentname;
// To get the SPSile reference to the attachment just use this code
SPFile attachmentFile = web.GetFile(attachmentAbsoluteURL);
// To read the file content simply use this code
Stream stream = attachmentFile.OpenBinaryStream();
StreamReader reader = new StreamReader(stream);
String fileContent = reader.ReadToEnd();
}
}
}
출처 : http://www.dotnetking.com/TechnicalComments.aspx?LogID=352
당신은 당신의 질문에 태그를 다시 지정해야 및 SharePoint 2007 또는 2003 있지만 둘 사이의 구별. –