Link to home
Start Free TrialLog in
Avatar of pauledwardian
pauledwardian

asked on

Sharepoint Workflow Move Document from one folder to another

I have a shared documents site in sharepoint. There are 4 folders listed under this site. Would you please give me an example of workflow how to move one document in a Folder called "Engineering" that is located in Shared Documents to another folder within the same library called "Inspection" when it is approved? I am confused on the folder level. How to move the documents between folders in same library (Shared Documents)?
Also, a workflow to send email notification when the document is moved between folders. Each notification needs to send the email to the particular group that the document is moved to. For example if the document is moved from inspection to engineering folder, it needs to send an email to people in engineering group and notify them about the new document in their folder.
Avatar of Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Flag of New Zealand image

Hello,

I've already answered that in your other question:

OK,

It would be better to use different libraries than folders. A SharePoint folder cannot be accessed with SPD workflows. You would need to write custom code.

Moving an item involves two steps: 1. copy the item form LibraryA to LibraryB, 2. delete the item in LibraryA

In SharePoint Designer click "Lists and Libraries" in the Navigation panel. Then click the library "Engineering". Find the "Workflows" section towards the lower right hand side and click the New button.

In the ribbon, click the "Action" drop-down and select "Copy list item" from the list actions
The workflow action will look like this:

Copy item in this list to this list

Click the first "this list", leave the selection with "Current item" and hit OK.
click the second "this list" and select "Inspection" from the drop down.

Next click the Action drop-down and select "Delete Item" from the list actions
The workflow action will look like this:

then Delete item in this list

Click "this list" and leave the selection with "Current item" and hit ok.

Now save the workflow and publish it. You can set the workflow to run manually or you can start it whenever an item is changed. For the latter scenario, you probably want to precede the copy and delete actions by a condition that checks for a value in a column, for example the text value in a "Status" column.

Does that help?

cheers, teylyn
Avatar of pauledwardian
pauledwardian

ASKER

It think there has to be a condition to move the document. Like if the document is approved then move it to the different library otherwise leave it there. how can I use this to reject\accept documents? I am using sharepoint foundation 2010.
I'm not sure if I can use the Accept\Reject feature since I am using the free version (sharepoitn foundation 20120)
if you do not have access to the extended features of SharePoint Server approval workflow, you can add a new column to your document  libraries instead.  Let's call it "Status" and make it a choice column with the options "accepted", "rejected" etc.

Then, in the SPD workflow, start with a condition (it's a command in the ribbon). I'm not in front of SharePoint or SPD right now, so I cannot give you the exact steps, but the Condition drop-down has several pre-defined conditions to choose from. You need the one that compares a field/column/value of an item with a value that you specify,

If the column "Status" of the current item equals "approved" then perform the steps to copy (to another library) and delete the item (in the current library) as described above.

I'll try to get more detailed steps to you as soon as I'm back in my SharePoint space,

cheers, teylyn
OK, what do you refer "a new column" to? Would you please provide more details.

Paul
Hi,

There are multiple way of acheiving it

a. Combination of Worflow + Event Receiver.
1. Create a simple approval workflow
2. Create a event reciever on updated event of List. When status of item is 'Approved', copy the document to the required folder and send email to corresponding group.

Code Examples of moving documents -

http://www.learningsharepoint.com/2010/07/04/programmatically-copy-and-move-documents-in-sharepoint-2010/ 

http://jgvimalan.wordpress.com/2010/09/27/programmatically-move-items-from-one-document-library-to-another/

b. Create a custom Visual Studio Workflow
And after approval step, use custom code activity to copy documents and send emails.

Cheers.
Raj

You can do it in combination of SharePoint Designer Workflow and Event Receiver. Or, using Visual Studio
SOLUTION
Avatar of Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks guys! one last question:
Is there a way to include the document name when its sending the email? In the if statment it says:

If thecurrentitem.status.value = approved
..
..
then send email to user(I need to include the name of the document that was approved in the body of the email.

is it possible?

Paul
You can store name from item Properties and use it while sending email.

Cheers,
Rajendra
Would you please be more specific? How can I store it from the item properties?

Paul
Never mind! I got it! thanks to both of you!
Thanks!
After I deploy the wsp file which not showing as active status. Kindly help