.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to Programmatically Upload the files based on the current location in the document library?

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :SharePoint

how can programmatically to upload a file to document library based on the current location for example when i was inside the subfolders and click on the custom button in ribbon it should upload file to current location entered to document library not hardcoding the subfolders name 

Thanks in advance

View Complete Post

More Related Resource Links

Reg File Upload control to upload files from document library


In Field Upload control if we click browse button it allow us to search file in our hard disk but now as per my requirement as soon as user clicks ‘Browse’ button it should point to the document libraries and their files in site.Let me know how could i achieve this?

Thanks & Regards,


failed to upload multiple files to a document library!


I have a document library. I have upload a lots of files by upload multiple documents function several days ago. When I tried to upload some files today. It always failed if I drag a folder into the upload multiple documents dialog.

Drag a folder with any number of files in it to the upload multiple documents dialog. Failed.
Drag files into the upload multiple documents dialog. Sucess.
Create a folder manually, then upload files into the new folder. success.

Anybody have some clues for this problem. Why today I always failed to upload files when I drag a folder?

Thanks very much.

Upload a File to a SharePoint Document Library - Part I

The following helper class demonstrates a few techniques that allow documents to be uploaded to a SharePoint document library programmatically without using the API or a custom web service. You don't need to specify a document library name, and it will create any folders specified in the URL as required. File meta data will be updated if any properties are passed.

overwrite the files in document library from Explorer View ?

Hi Everyone, Suppose I have a document library which can be opened using the explorer view, what happened if someone uploads to this library by drag n drop into the library with same filename? What would be the final story of the file which is overwritten through drag n drop from Explorer view ? Thanks./* Infrastructure Support Engineer */

Indexing Document library which contains .RTF files

Hi All, I've just craeted a document library objects in my SharePoint site and then i imported several hundreds .RTF files into it, how and when can i perform search and compare of this files against each other ? Does MOSS 2007 SP2 Enterprise supports indexing .rtf files ? Thanks, AWT/* Infrastructure Support Engineer */

Moving files from one document library to another problem.

Hi, I have a strange problem with trying to move a number of files progammatically from one document library to another. I have a workflow running in sharepoint, which throughout the progress of the workflow, updates a word document stored in a document library, titled "CR".  Within the CR library there may also be a folder title "CR X" where x is the number of the document.  This folder contains any files which have been attached to the CR document.  I.E, excel files, pictures etc. When the workflow completes, the document should be moved to another document library called "Archived" which has a folder named after the year, i.e 2010, which inside that, contains a folder called the name of the document.  All the attached documents should also be moved to this folder. So for example, a document structure could be parentweb\parentsite\CR\CR 2.doc parentweb\parentsite\CR\CR 2\image.jpg parentweb\parentsite\CR\CR 2\image2.jpg Should, when the workflow completes end up looking like: parentweb\parentsite\Archived\2010\CR 2\CR 2.doc parentweb\parentsite\Archived\2010\CR 2\image.jpg parentweb\parentsite\Archived\2010\CR 2\image2.jpg. I have got the first part working fine, where the document is moved to the archive directory.  But I cannot move all the attachment files.  The loop I have to get the files and move them will wo

Upload documents to Sharepoint 2010 Document library

Is there a way to upload documents to an SP 2010 document library with Custom Actions or Workflows?  I have a requirement of taking the contents of several directories (older data files) and uploading them to Sharepoint.  Not sure which actions actually perform this operation.  Any help most greatly appreciated.

New / Upload / Actions / Settings / View menus on a document library are hidden

I have a Document library. On the View Page (All Documents) for the Document library, I do not see the menu bar with the "New / Upload / Actions / Settings / View" menus. It looks like one of the users with owner permissions did something to cause this behavior. No custom code exists on the page. I am not sure how this menu bar can be hidden. Can someone please clarify. I am a site collection administrator.

Document library hiding pdf files' tool bar

Hi all, I have a requirement that the Sharepoint pdf documents should have the toolbar hidden in order to prohibit users from downloading and printing the file. The only way I can do this is to create a content editor web part, using HTML to open the pdf file and add '#toolbar=0' after the pdf file name. I am wondering if I can also add '#toolbar=0' to the Sharepoint document library's pdf files? Thanks!

Customizing Send To Other Location Functionality for a document library item in Moss 2007

Hi All i have a requirment to customize the Send To Other Location funtionality. while using OOTB Send to Other Location option for a document library item we have  selection like Prompt the author to send out updates when the document is checked in? <input id="ctl00_PlaceHolderMain_ctl01_ctl01_RadShouldUpdateYes" name="ctl00$PlaceHolderMain$ctl01$ctl01$ShouldUpdate" type="radio" value="RadShouldUpdateYes" /><label for="ctl00_PlaceHolderMain_ctl01_ctl01_RadShouldUpdateYes">Yes</label> <input id="ctl00_PlaceHolderMain_ctl01_ctl01_RadShouldUpdateNo" checked="checked" name="ctl00$PlaceHolderMain$ctl01$ctl01$ShouldUpdate" type="radio" value="RadShouldUpdateNo" /><label for="ctl00_PlaceHolderMain_ctl01_ctl01_RadShouldUpdateNo">No</label> how we can set this option in my custom coding based on the user selection. i am not able to understand the functionality of the above option. can any one please explain the above option and let me know how to set this option programmtically in my custom code.   Thanks in Advance  muthu

Querystring to determine what Document Library Folder's files to list?

First of all, any webpart that alllows you to list documents in a particular folder of a Document library? Second, possible to pass what folder to list via a query string to  that webpart ? Thanks.

Can't upload some pdf files to library

Hi there I got some pdf files about 40 or more Mb, and I already set the upload limit to 100 Mb in site setting. I tried to upload them only one file each time but always got wrong without any error message and shows nothing on the page with url looks like this: http://servername/site/_layouts/Upload.aspx?List=%7b2677D186-FEA0-4B28-91E5-E6F2B846DF90%7d&RootFolder=%2fes%2fFeed+Library%2fProject+FEED+Studies&Source=http%3a%2f%2fservername%2fsite%2fFeed+Library%2fForms%2fAllItems.aspx%3fRootFolder%3d%252fes%252fFeed%2520Library%252fProject%2520FEED%2520Studies%26FolderCTID%3d%26View%3d%257b0A2591CB%252d5354%252d4C8A%252d8F5A%252dA1EDB6313A01%257d any idea how to solve this? it's MOSS 2007 sp2 in Win 2008 R2 environment. Thanks in advance. allan

Programmatically Uploading a Documents into a Document Library using web part ?

Hii, Can anyone can help me how to upload the documents to the document library in sharepoint foundation using customization for what our deafult upload.aspx will do !!!!! Thanks in advance !!!! Rgrds//Praveen  

ASP:Upload control . Uploading into a SharePoint Document Library Subfolder and FILE NOT FOUND error

RE: ASP:Upload control . Uploading into a SharePoint Document Library Subfolder and FILE NOT FOUND error Two Issues, apparently unrelated. I have subfolders like this /ApplicantDocuments/20 and /ApplicantDocuments/21 (where 20 and 21 are my subfolders and ApplicantDocuments is my library. 1. The below function is erroring with file not found, but I confirmed I'm sending the fully qualify path (i.e c:\test.txt) to System.IO.FileStream content = System.IO.File.Open(documentFileName, System.IO.FileMode.Open); 2. Even if it worked, looking at the code, I'm not using argument foldername.  I'm passing 20 to the argument. How can I make sure it uploads into subfolder 20 of ApplicantDocuments? Thank you.     Just testing in test environment. Will tighten code once it works.   public void UploadDocumentToSite(string foldername, string documentFileName) {      SPSite siteCollection = new SPSite("https://xxxxxx");      SPWeb web = siteCollection.OpenWeb();      //SPSite.AllowUnsafeUpdates = true;      //Web.AllowUnsafeUpdates = true;      string Lib = "ApplicantDocuments";      SPFolder destFolder = web.GetFolder(Lib);      sendmail(documentFileName+" "+foldername);  

Excel fields linked to files in the document library do not update


We are having an issue with an Excel spreadsheet that is linked to several Excel documents in a document library.  Mutliple staff members update several "sub" spreadsheets with information that is rolled up to the "master" spreadsheet.  Excel appears to behave correctly in that if I open both the sub and master spreadsheets in my Excel window at the same time, the data in master gets updated.  If I just open the master, I have stale data.  I'm not sure SharePoint is to blame here, so I'll post this in the Excel forums as well, but any information or experience anyone has had with this would be fantastic.

Thanks in advance for any help/advice!

I want to upload Folders which contain special characters into the sharepoint document library

I want to upload Folders which contain special characters into the sharepoint document library

Getting error msg while trying to upload a document inot the document library using the form which i


I have designed an upload form with the columns that have to be filled in while uploading a document into the document library.The form is designed in .net.

I get "Error Access Denied" message when i try to upload the document using that upload form.When i go back to site,the document is uploaded in that particular document library.But this problem doesnot exist when i upload the document as admin.There is no " Error Access Denied" message.I have checked the document library permissions.The problem is not with the permission to that particular document library.

Can someone help me out in this issue?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend