Here is the solution:
string fileUrl = dt.Rows[0]["Path"].ToString();
using (SPSite site = new SPSite(fileUrl))
{using (SPWeb web = site.OpenWeb())
{ SPFile file = web.GetFile(fileUrl); if (!file.Exists)throw new ApplicationException("Could not find document");
return file;}
}
No comments:
Post a Comment