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 need to upload a file into a SharePoint 2010 document library that will go through some validation. I plan to use the MS Office Open XML SDK to open Excel and read values from cells.

I can think of three approaches to do this, and I would like to know if anyone has attempted this before?

Please note that I can use Visual Studio 2010, but not any third party workflow products such as K2/Nintex.

Aim:

To load an Excel file into a SharePoint list with custom .NET validation against an external database.

Approach 1: Event Receiver

Step 1: User loads Excel into SharePoint Document Library

Step 2: Event receiver calls external web services in .NET in order to validate the file

Step 3: File is accepted

Step 4: File is rejected with detailed message for the user

Advantage: Least amount of custom coding

Approach 2: Custom WebPart

Step 1: User loads Excel File through Custom Web Part

Step 2: Custom Web Part calls external web services in .NET in order to validate the file

Step 3: File is accepted, Custom Web Part will insert file into SharePoint Document Library

Step 4: File is rejected, error dialog presented to user

Advantage: More control of user experience

Advantage: SharePoint not involved until file has been validated

Disadvantage: Most amount of custom coding

Approach 3: Custom WorkFlow

Step 1: User loads Excel into SharePoint Document Library

Step 2: Custom Workflow is called, calls external web services in .NET in order to validate the file

Step 3: File is accepted

Step 4.1: File is rejected and removed from library

Step 4.2: Email sent to user with error message

Disadvantage: No real time feedback on validation

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Stick with the existing SP UserExperience as much as possible!

I have used Approach 1, and Approach 3 before. I would not use Approach 2, with carefull planning you can have just as much control of the UEx with Approach 1.

As for the resons for choosing one approach over another, if the Event Handler is going to take longer than 5 seconds to execute then use Worflow. Any longer than that then your user is going to be waiting too long for a response. You could also use an async method but you would not have the control of the UEx.

Antoher advantage of using workflow is that it is easy for a end user to attach the workflow to another document library without requiring any more custom feature recievers or application pages to attach an event reciever.

share|improve this answer
    
There is no way OOB SharePoint workflow will provide the solution for this use case. It has to be a custom workflow which will definitely make it more complex than the other 2 approaches. You can also provide users the ability to modify the Web Part properties to point it to any document library, if it is a requirement which clearly is not. –  Karthik Murugesan May 18 '11 at 2:38
    
I did not mention that this was an OOTB Sharepoint anywhere. Andrew was obviously refering to a custom developed Visual Studio workflow in his origional question, I was simply stating the various pros and cons. –  Clayton Firth May 18 '11 at 4:21
    
Thanks for the clarification. I was just confused because you mentioned if the custom code is going take more time to execute then use workflow, as in the workflow is not custom? Kindly go ahead and edit your answer to that effect if you see fit, I'll remove the down vote. –  Karthik Murugesan May 18 '11 at 4:45
    
Thanks Karthik, good point. I've updated my response to say Event Handler instead of custom code.. –  Clayton Firth May 18 '11 at 4:51
    
Many thanks for your answers! I was indeed trying to avoid Approach 2, so I think I am pointing in the right direction now. –  Andrew May 18 '11 at 7:28
add comment

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.