Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a SharePoint intranet site where I need to allow users to upload certain documents. These documents need to be only PDF files for example.

What is the simplest way to restrict the document library to only PDF (just checking the extension PDF is fine) ?

share|improve this question

5 Answers 5

up vote 9 down vote accepted

there is no OOB solution for this. But you could create an eventhandler (event receiver) and triggers on item adding, that checks the file name and if it's not the correct file extension just cancel event. /WW

share|improve this answer
    
I agree, this is the best option I would say –  Jaap Vossers Jan 11 '10 at 9:57
    
After the event receiver cancels the event, how to notify the user in the UI that the operation failed? Also this means that I need to let the user upload the entire file (can be many MBs) and then finally reject it, right? –  Emad Jan 11 '10 at 10:05
    
Yea, the document has to be uploaded. You could do some smart stuff using JS on the newform.aspx if you would like to check it first though, but its not bulletproof –  Wictor Wilen MCA MCM MVP Jan 11 '10 at 12:48
1  
Maybe a combination if JS on the client and an event handler on the server. Btw if you are doing Event code, i recommend reading this article first regarding troubleshooting and oddities of event handling: msdn.microsoft.com/en-us/library/aa979520.aspx –  Anders Rask Jan 11 '10 at 23:08

If you prefer not to deploy any of your own custom code to your WFEs then you may want to consider a simple SharePoint Designer workflow as well.

Have a look at this article that describes something similar and can easily be adapted (it renames a file from a workflow when it contains sensitive information in the file name).

Providing feedback to the customer is indeed a problem. An event receiver allows you to provide slightly better feedback than a workflow, but only slightly. SharePoint 2010 allows event receivers to provide better feedback.

share|improve this answer

I know its not what you ask for, but for completeness i want to add that you can deny files by extension in Central Administration if you are using MOSS.

Manage blocked file types (Office SharePoint Server)

Anders Rask

share|improve this answer

You can create a workflow in SharePoint designer that moves non PDF files to another library, see http://www.documentmanagementworkflowinfo.com/sample-sharepoint-workflows/sharepoint-designer-workflow-move-document-one-library-next.htm for an example

share|improve this answer

Just Block all Other Extensions Except pdf. You Can Do this with the help of Sharepoint Central Admin->Security->Define Blocked File Types

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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