I have a requirement for a group of users in a SharePoint site to be allowed to upload documents larger than the default 50MB - i.e. 100MB. All other users must keep this 50MB limit however.

During the document upload event, is it possible to override the farm level if the current user is in a specified group or has a specified custom permission? Otherwise could I set the farm level upload limit to 100MB and then prevent uploads from users with a 50MB limit during the document upload event?


Your main problem as I can see it is that the limits for document upload are set in various places. The lowest level at which you can set this limit is across a web application as it is defined in the web.config file. There are other areas above that scope such as the IIS metabase and machine.config files, but Web Application is the lowest scope AFAIK.

Even if you set this though it can not be over ridden on a user by user basis.

The only way I can think would be to write an event receiver which checks the file size of the document and the user attempting the upload and compares this with a seperate list containing users and a value for the file size which they can upload. Assuming the user has a value in this list greater or equal to the file size they are attempting then this would be allowed otherwise the event is cancelled.

There is some information on creating an event receiver here - great author ;-) http://www.simple-talk.com/dotnet/.net-framework/how-to-create-event-receivers-for-windows-sharepoint-services-3.0/

You would need to set your Web Application settings to the largest allowable file size and bear in mind that even if you set your list value higher than this for a given user IIS will reject the request.

  • Is that a complete list of event receivers? Whilst doing this check as part of a list itemadding event would work, the practicality of adding this event receiver to all existing and all new lists would make it a pain. Is there no site or web scoped event I could hook into that is fired when a user uploads a document? – Jonny May 13 '10 at 16:28
  • Your event receiver is added only to lists which use a specific list template. E.g. the document library. – Charles Lee May 13 '10 at 19:07
  • <Receivers ListTemplateId="101"> would be in yuor element manifest. Look at the article again. – Charles Lee May 13 '10 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.