1

How to move item to folder automatically when it has been added or edited in a library? The folder is in the same library. The correct folder will be defined by metadata. This should happen automatically when the item has been added or edited. The listitem Id should be preserved. No server-side code should be deployed.

Can this be done using workflows (SP2010/SP2013)? If not then what would be the other options?

1 Answer 1

3

Workflows cannot "move" an item, they can only copy it (which would preserve metadata but not listitem IDs). The built-in IDs cannot be changed or set manually. Your best bet is to create your own ID system using a workflow or event receiver to assign unique IDs to new items, and make a simple program to go through and assign IDs to all the existing items if necessary. Then you can use the "Copy list item" function in a workflow to create a duplicate in the new location, using conditional statements to read your metadata and determine where to place the new item, and you will be able to preserve the IDs you created. Workflows have the advantage of being able to be triggered by new items and/or changes to existing items.

Note that only 2010 workflows have the "Copy list item" action. In 2013 you have to use the "Create list item" action and manually assign all the fields. In either case you will have to use the "Delete item" action to remove the original item once you copy it to its destination.

1
  • Moving is mandatory so that existing links work (as they use sharepoint listitem id). CSOM and REST do support this.
    – thomius
    Jan 1, 2014 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.