Takes a SPFolder reference and the string file name to search for.
private static SPFile FindFileWithCAML(SPFolder folderToSearch, string fileName)
{
SPQuery query = new SPQuery();
query.Folder = folderToSearch;
query.Query = @"
";
SPListItemCollection listItemsCollection = folderToSearch.DocumentLibrary.GetItems(query);
foreach (SPListItem item in listItemsCollection)
return item.File;
return null;
}
No comments:
Post a Comment