Thursday, August 23, 2007

Programmatically retrieve Blocked File types in SharePoint

File types blocked by SharePoint can be retrieved using the SharePoint Object Model. The SPWebApplication.BlockedFileExtensions property will provide the file extensions that are blocked in SharePoint. This property returns a collection object that represents files that cannot be uploaded or downloaded in SharePoint.

SPWebApplication webapp = SPWebApplication.Lookup(new Uri("http://servername:9000"));
foreach (string str in webapp.BlockedFileExtensions)
{
lbBlockedFileTypes.Items.Add(str);
}

Thursday, August 23, 2007

Programmatically retrieve Blocked File types in SharePoint

File types blocked by SharePoint can be retrieved using the SharePoint Object Model. The SPWebApplication.BlockedFileExtensions property will provide the file extensions that are blocked in SharePoint. This property returns a collection object that represents files that cannot be uploaded or downloaded in SharePoint.

SPWebApplication webapp = SPWebApplication.Lookup(new Uri("http://servername:9000"));
foreach (string str in webapp.BlockedFileExtensions)
{
lbBlockedFileTypes.Items.Add(str);
}