While Searching for documents in a SharePoint site, it is possible to determine whether the document is a folder or not. The following code snippets illustrates the scenario:
// Check if a document library elements is folder or not
foreach (DataRow row in table.Rows)
{
var isFolder = row["IsContainer"] == null || row["IsContainer"] == DBNull.Value ?
false : Convert.ToBoolean(row["IsContainer"]);
}
Again, we can check whether a folder is OneNoteBook or not.
if ( isFolder)
{
if (row["ProgID"].ToString() == "OneNote.Notebook")
{
row["DocIcon"] = "../Images/OneNoteBook.png";
}
else
{
row["DocIcon"] = "../Images/folder.png";
}
}
That's it...............:)
No comments:
Post a Comment