Restrict image and video upload to document library
Hi, Is there anyway we can restrict the user from uploading image and video into document library. If I apply the restriction to certain extension at Central Administration that restriction will be placed across all library including picture and video library. My intention is just to place restriction on document library only. Regards, Leo
December 23rd, 2011 12:26am

Hello Leo, If you need this to be done on a particular Document Library, then you need to create a Event Receiver for the library. Check this link to get more information. You need to have a handler for ItemAdding(), and in this method check for the file extension. If file is found to have a video or image extension, then cancel the event (using properties.Cancel = true), and stop the item upload. Ram Prasad Meenavalli | MCTS SharePoint 2010 | MCPD SharePoint 2010
Free Windows Admin Tool Kit Click here and download it now
December 23rd, 2011 1:44am

I knew how to use event receiver. But what I wonder is if I use event receiver.. if the user upload using Windows Explorer .. would the event receiver prompt any error or not? It might not.. because our user like to use Windows Explorer to upload files..
December 23rd, 2011 1:49am

Leotheram, If you want to block file upload (Images and Videos) to Document Library, you will need to create event handler. In Event handler, when you call "itemadding" event, cancel that event e.cancel=true; Also, if you want to restrict uploading file types in your Site, yo can do this from Central Admin. Steps - Open Central administrative page, and go to "Central Administration > Operations > Blocked File Types", there you select your Site and add the extension file you want to Block. Thanks
Free Windows Admin Tool Kit Click here and download it now
December 23rd, 2011 4:12am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics