Moving documents from one document library to another with SharePoint 2013 Workflow using list item information - sharepoint

To preface: I believe this may be impossible with OOTB solutions and if it is I have a plan B, but this plan would be much easier to implement if it is indeed possible.
Is there any way to create a SharePoint workflow that moves a file from a separate document library to another separate library?
The workflow is launched when a new item is created in a list. The item contains the information needed to find the document that it's referencing (ID, path, folder path, name etc...). Is it possible to take this information and then move the file being referenced to another library using a SharePoint workflow?
The document can't be simply copied because version history must stay with the document. I'm also unable to run the workflow in the library that contains the document because it's deciding on what documents to move based on the last modified date and as soon as the document is touched by the workflow it's been modified.

If you only want to copy files with metadata, we can use the OOTB workflow to achieve it.
If you want to copy files with version history, please check the Nintex workflow.
Nintex Workflow Move Document and Preserve Version History
Or we can create event receiver with custom code to achieve it.
Copy files between libraries by keeping versions

Related

sharepoint workflow to move files of a content type to new folder (after creating it if needed)

I have multiple SP document libraries for different meetings. I want to keep the libraries organized by meeting day. So each meeting would have it's own folder and all the files for that day would go in that folder.
To make it easy I wanted to make it so you can upload a file and then a SP workflow will create a folder for that meeting, if needed, and move the file.
So I created a "meeting file" content type that also gets meeting date and file type (minutes, presentation, misc, etc...)...
What I need to do next is check if a folder for that meeting date exists and create it if it does not. Then move the file over to that folder.
Any ideas how I could do this?
I could also try it without using content types but then the workflow starts automatically for every file added and then I cannot create a new folder with that workflow (because it would start a new instance of that workflow).
I was hoping to keep it reusable so I could just use one workflow for all the document libraries. I thought the workflow could find the path of the list it is being run on, and create the folders and do the other work within that list.
Any ideas are appreciated.
For creating folder via workflows:
Creating folders and sub-folders using SharePoint 2010 Designer Workflow
and for checking folder name:
Create a string workflow variable.
Now create a lookup for your folder and set the variable to the folder's title. Take a look here for some helpful information and usage guidelines when it comes to list folders.
The actions dependent of the existence of the folder have to be placed inside an if-statement
E.g. the if-statement should be like "if [variable] not equals [folder name]" if you want the actions only to be run when the folder does not exist
and here the whole tutorial that I found:
Create folders using a SPD workflow

How to programmatically move (archive) a document from document library of a site collection to another site collection

I have to programmatically move (archive) a document from document library of a site collection to a document library of another site collection in SharePoint 2010, when a specific value is set for a column in the doc lib.
Would it be possible to write code for this scenario in an event receiver? Is there any other way?
If anybody has any relevant piece of code or links, please share.
Thanks in advance!
You could perhaps do a copy operation, then delete the original file.
Have a look at the following link, which discusses copying a file from one site to another:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfilecollection.aspx
The example uses one site collection. However, if you convert the source document to a byte array you can always instantiate the target site collection and add the binary data to a document library within that site collection.
Certainly the copy operation should would work within the event receiver. However, I'm not certain what will happen if you try to delete the file within the receiver (there may be concurrency issues). If the delete does not work, consider firing a one-time timer job to delete the file (which would occur in a different process).
You can try SPExport Class of SharePoint, as per this Article Copy or Move SharePoint items looks like few of the Operations that we do in SharePoint UI uses this API internally to acheive the task. Also this Approach depends if you are trying to do it one time or its going to be a repeatative process.

Changing Discussion Folder Names in SharePoint 2010

Is there a way to change the name of a folder within the discussion area of SharePoint 2010? The folder by default is given the name of the discsussion name when it is created, however, if you then change the discussion name, it does not (quite rightly) automatically update the folder name - I would like to though.
Just had a go there, I was able to rename it using SharePoint designer (use the All Files link on the left).
However if you need to do it automatically then you'll have to build an List Item Event Handler, and update the folder name using the API using the ListItemUpdated Event.
Shane

Migrate the discussion list in SharePoint?

I want to migrate a Discussion List from one site collection to another site collection with all content. Is there any way to do it? We can not save the list as a template. Because we want to keep all the original information, like the Created By.
Best Regards
I suggest you take a look at the SharePoint Content Deployment Wizard (http://www.codeplex.com/SPDeploymentWizard) by Chris O'Brien. The tool uses the built-in migration API and it should allow you to move your content.
In addition to Walkdek's answer :-
Simplest way is when you create a template you have the option of including the existing content (Save List As Template > Include Content). When you move the tmplate to hte other site sollection and create a new list based on it then your data will be there.
You can also do this using SharePoint Designer - select the list, select Copy then find destination and select Paste.
Another option is Gary Lapointe's STSADM extensions such as gl-exportlist and gl-importlist

Global Customized View for Document Libraries in Sharepoint

In Sharepoint document library, when we create a new document library, the default view is 'All Document'. This one:
We can make a custom view from View > Create View (at the upper right corner of document library view). I created a new standard view and named it 'Chromed View'. I edited it, then I saw that this view only applied on current document library:
The other document libraries cannot use this view.
I develop a system that triggers document library creation from CRM (the document library's view from CRM Iframe is using that chromed view). The creation itself went well, I can create document library using Sharepoint web services. But I still cannot apply a custom view automatically for that newly created doc lib.
My question is, can we make a view that is global (not in one document library only) so that we can use that global view for any document library.
Thanks b4 for any opinion :)
You could also create a new custom document library type, with the view embedded in it. Whenever a new library is created from the new doc lib type, it will get the new view.
This is still a not truly "global" view, and you may have the same problems if the view gets changed (the view won't be updated on document libraries that have been created with previous versions of the view).
One way to do this is to create a feature with an event receiver. When a user creates a list, you can check if the list is of the proper type (101), and then add new views to it. The feature could also add this view to existing document libraries on activation. Shouldn't be too much of an effort.
The view is not truly global. As list definitions are duplicated for each instance, there are no such thing as a global view (afaik) in WSS. We could all hope that views are a part of content type in the next version.
To globally change all document libraries and to change all existing libraries you need to edit the XSLT file that is in the XSL folder in layours/templates
There are a couple of them in there but these are how all the libraries are generated with this u can basically specify how a default"" library would look. Make sure to make a backup for these files though. Also creating a new content type and copying these xlts to a different file name and then linking your content type to these instead could also be a solution so when a user creates a new library using ur content type you can make sure that they are created in a way that you want.

Resources