using (SPSite oSite = new SPSite(http://Sharepoint2010:100/Testing))
{
using (SPWeb oWeb = oSite.OpenWeb())
{
string fileName = "Test Reports.docx";
string documentLibraryName = "Test Reports";
string fileUrl = string.Format("{0}/{1}/{2}", oWeb.Url, documentLibraryName, fileName);
SPFile file = oWeb.GetFile(fileUrl);
string workfowStatus = "Approved";
//code when all the approvers approve delete this file and move it under folder called pdf
if (file.Exists)
{
Console.WriteLine("File {0} exists in the site", file.Name);
if (workfowStatus == "Approved")
{
file.Delete();
}
}
else
{Console.WriteLine("File Not Found");
}
}
}
{
using (SPWeb oWeb = oSite.OpenWeb())
{
string fileName = "Test Reports.docx";
string documentLibraryName = "Test Reports";
string fileUrl = string.Format("{0}/{1}/{2}", oWeb.Url, documentLibraryName, fileName);
SPFile file = oWeb.GetFile(fileUrl);
string workfowStatus = "Approved";
//code when all the approvers approve delete this file and move it under folder called pdf
if (file.Exists)
{
Console.WriteLine("File {0} exists in the site", file.Name);
if (workfowStatus == "Approved")
{
file.Delete();
}
}
else
{Console.WriteLine("File Not Found");
}
}
}
No comments:
Post a Comment