public bool checkDocumentList(string strFileName)
{
SPSite siteCollection = null;
SPWeb topLevelSite = null;
bool blnFound = false;
string strDocLibraryLink = System.Configuration.ConfigurationManager.AppSettings["SPDocumentLibrary"].ToString();//"http://*********/Documents/";
siteCollection = new SPSite(strDocLibraryLink);
topLevelSite = siteCollection.AllWebs[ConfigurationManager.AppSettings["TopLevelSite"].ToString()];// siteCollection.AllWebs["Corporate/DealDesk"];
SPList list = topLevelSite.Lists["Documents"]; //topLevelSite.Lists["Approved Documents"];
foreach (SPListItem item in list.Items)
{
if (strFileName.Equals(Convert.ToString(item["File Name"])))
{
blnFound = true;
break;
}
}
siteCollection.Dispose();
topLevelSite.Dispose();
return blnFound;
}
Check Duplicate Document
Check Duplicate Document Sharepoint Document Library
Object model code
Sharepoint Object model code
Sharepoint