Tuesday, March 18, 2008

How to fetch blocked Files in sharepoint using object model ?

Here is a function that return a string which contins all blocked files in sharepoint. The string contins extension of files with a seperator passed to function as parameter.

Class used to fetch the blocked file is :- WebApplication

public static string getBlockedFileExtensions(char chrSeperator)
{
Collection collBlockedFile = SPContext.Current.Site.WebApplication.BlockedFileExtensions;
StringBuilder sb = new StringBuilder();
foreach (string strExt in collBlockedFile)
{
sb.Append(strExt);
sb.Append(chrSeperator);
}
return sb.ToString();
}

No comments: