.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

Moving files from one document library to another problem.

Posted By:      Posted Date: September 01, 2010    Points: 0   Category :SharePoint
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

View Complete Post

More Related Resource Links

problem autorun.ini in document library


HI ,

In a MOSS 2007 SP1 installation, one " autorun.inf " file was uploaded by user to a document library.

The file keeps updating itself every 10 seconds and cannot be deleted from the library.

Even when System Account ( farm administrator) tries to delete, he gets  " access denied  error".

Help is appreciated . Thank you

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,


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 */

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!

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.

Document Set - Problem when uploading multiple files with "Launch forms in a dialog" disabled

Hello, Has anyone come across this before? I have a basic document library for which I have enabled "Allow management of content types" and disabled "Launch forms in a dialog".  Both of these settings are in the "Advanced Settings" page.  Also, the document library does not have versioning enabled and check out is not required. I added the OOTB "Document Set" content type to this document library and allowed OOTB "Document" content type documents in this document set.  This document set does not have any default content. The issue arises after I upload multiple files and click the "Done" button.  After I do this, the browser redirects to the top level of the site!  For example, if I uploaded to my document set at http://server/sites/anyname/doclib, I am redirected to http://server/. This issue has come up in both a standard server and an enterprise server. Steps to repeat issue: Create a document set Open the document set Select "Upload Multiple Documents" Drag and drop or browse for files Click "OK" Click "Done" Actually, this issue also occurs when "Launch forms in a dialog" is enabled.  In this case, you just have to navigate to the upload form directly (with all the necessary query string parameters, of course). Has anyone else seen this issu

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!

document library url RootFolder and https problem


Hi there,

We have SharePoint site running and configured to https protocol over IAG.

When I am trying to view sub folders in document library the RootFolder querystring in the url is relative. But, in my scenario it is coming absolute . Please follow below on how I am getting.

I have infopath form services enabled and a document library contains infopath forms. When user clicks on infopath form, then it will take user to formserver.aspx page, and it automatically adds the source query string to the url. This url it is generating is not relative . It is starting with complete url including domain like https://abcxyz.com

Now, when user closes the infopath form, then it is trying to redirect the user to url what source query string contains.

So, it redirects to the page https://abcxyz.com/doclib/forms/allitems.aspx?RootFolder= https%3a%2f%2fabcxyz.com%2fdoclib%2fsubfolder&FolderCTID=0x012000CD8CD5632FE5F545A3BF3E3EEB142DB5

Because of it contains https absolute url in the RootFolder query string, it is giving error

MOSS 2007 Strange Problem with edit forms, content types and document library columns


I'm having a strange problem and have not been able to track down any useful answers over google.

I inherited a SharePoint site that I am now making some changes to.

I am having problems with one document library.  We had custom edit forms on this document library, which I was finding a pain to maintain so I reset them back to the site definition.  This edit form now shows only those fields that are associated with the Document content type (the only content type - I've deleted the others) on the document library.  There are other columns on this document library that are NOT associated with the content type that I would like to show on the edit form but they are not available when I try to add them to the content type via Settings > Document Content Type > Add from existing site or list columns.  The select columns from drop down is set to List Columns.  The Additional Authors column is just not there.

I CAN see this field on the all items view for the document library, it is there and populated with data.

Setting the Allow Managed content types radio button to NO does not have any impact on which fields are visible on the form- I still see those same fields that have been associated with the Document content type.

Has anyone else seen this or does anyone have any thoughts?? 

They will be muc

Sharepoint 2007 delay in files are not showing up in document library


When saving a file from ie. an email attachment into a sharepoint document library the files show up in explorer view of the document library but there is about a 20 minutes delay before they show up in the default view of the document library.  This is quite frustrating as because you can not see it there the users try to save as again. 

This seems to work correctly in our test sharepoint environment.  Does anyone have any ideas as where to start looking.


Managing Document Library files using Offce 2007 VBA


We have a farily large SharePoint site, (>20,000 Office documents), and we are running low on disk space.  I would like to write a VBA program that walks through the tree (including subsites) and deletes all the document library history files that are over 1 year old.  I can't seem to find a way to access the history files unless I open each document; opening each document would cause my program to take months to complete.  Does anyone know a way to get access to the history files using VBA without having to open the Office file whose history I want access to?  The only way I've found to access this history files is to use the DocumentLibraryVersions object, but it requires that I open the file (that I know of).  I have no problem walking the file tree and I have access to SharePoint Designer 2007, Excel 2007, and Word 2007 typelibs, object models, etc..  Due to policy restrictions in my company, I cannot install development tools on my machine, so I'm stuck with VBA.  Also, I won't be allowed to create a web service; although I can access one that already exists on our server in case any come with SharePoint.


P.S., I have lots of good VBA code that I've written over the last 15 years to do all kinds of tasks with Office and SharePoint that I'm happy to share if anyone can benefit from it.&

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


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

how to extract the files from the document library using object model



I need to extract the files from the document library using object model in sharepoint 2007.

Can anyone help me.




Deploying files to a document library with your wsp (hopefully an easy one!)


Hey all,

I build a project to WSP and deploy to my solution, that all works beautifully. I now want to deploy some 'emailtemplates' for use throughout the site collection - the best way to do this seems to be as a document library. What do i need to do? Can i do it as a module? How do i specify where things end up? I'm really struggling to find links to help with this so i'm thinking it must be 'obvious' - at least to someone!

Many thanks,


Edit 1: Email templates are .xslt files

Deploying files to a document library with your wsp (hopefully an easy one!)


Hey all,

I build a project to WSP and deploy to my solution, that all works beautifully. I now want to deploy some 'emailtemplates' for use throughout the site collection - the best way to do this seems to be as a document library. What do i need to do? Can i do it as a module? How do i specify where things end up? I'm really struggling to find links to help with this so i'm thinking it must be 'obvious' - at least to someone!

Many thanks,


Edit 1: Email templates are .xslt files

Problem with Document Library



We have a document library with a number of content types defined that share certain underlying meta properties. When we try and create and save a Word Document in the library the Document Information Panel appears as expected and the user is prompted to enter the required info. The problem is one of the properties is a lookup with a couple of hundred entries and it maps to a drop down but not all these entries defined in Sharepoint appear in the corresponding drop down in Word. Is this by design?

Is this a bug? Has anyone found a solution to this?



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