none
Restrict image and video upload to document library RRS feed

  • Question

  • 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

    Friday, December 23, 2011 5:43 AM

Answers

  • 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
    • Marked as answer by leotheram Friday, December 23, 2011 6:43 AM
    Friday, December 23, 2011 6:39 AM

All replies

  • 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
    • Marked as answer by leotheram Friday, December 23, 2011 6:43 AM
    Friday, December 23, 2011 6:39 AM
  • 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..
    Friday, December 23, 2011 6:44 AM