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'd like to make a form for users on SharePoint that copies needed files to current directory. User should be able to choose file type(in fact I have 2 files and both are excel), then when submitted, needed file should be re-named according to user input and copied. To be precise, I have 2 excel files as template, user will choose one of them by radio button. When submitted, a copy of chosen template will be copied to user's folder, meanwhile file name will be changed to whatever user wrote on form. Thanks

share|improve this question
1  
In your question you don't specifically say which part of this process you are having problems with. My answer assumes basic knowledge of building custom ASP.NET forms as pages or web parts in SharePoint and I've covered the topic specifically asked in the question title. If any section requires further explanation please ask in detail what you need help with and I'll do my best to answer the questions you have. –  SpartanDonut Nov 2 '12 at 14:35

1 Answer 1

On your custom ASP.NET page or web part you would have something similar to the following:

// Your method that uses custom business logic to get the list item needed
// This will likely either be based off of a value on the form and utilize CAML or lookup to a configuration list of some sort    
SPListItem item = GetSourceFileListItem(); 

// List Items that are documents have a valid file property - add your own error checking as necessary
SPFile file = item.File;

// Your method that gets the destination URL of where the file should be copied to based on your specific business logic
string destinationUrl = GetDestinationUrl(); 

file.CopyTo(destinationUrl);
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.