locked
Copy the last modified document to a new document library RRS feed

  • Question

  • Hi Experts,

    I need your help.. Is there a way to create a document library that contains the recently modified documents?

    For example, i uploaded files in my site in different document libraries. Once done, a copy of recently modified items of all document libraries will be compiled in a particular document library.. 

    Can this be done via workflow? 

    Thanks!



    -glenn






    • Edited by sg_07 Monday, January 7, 2013 8:18 AM
    Monday, January 7, 2013 3:06 AM

Answers

  • Hi Glenn,

    As per your requirement follow these steps to create workflow 

    >Open the site in SharePoint designer

    >Select 'WorkFlows' in the left menu

    >On the top menu, select 'List Workflow' which will show you all the SharePoint lists

    >Select for 'Doc1' list (assuming you have document library 'Doc1')

    >A popup will come to give the name of the workflow. Give the name ex:CopyDocs

    >Workflow is now in the design surface showing 'Step1'

    >Select 'Step1' and you will be highlighted with 'Action' in the ribbon

    > Under the 'Action' select 'Copy List Item'

    >Now 'Step1' will show as 'Copy item in this list to this list'

    > Select first 'this list', a pop up will come to choose list item with 'Current Item' in the List

    > Leave it as it is i.e it should be 'Current Item' and click OK

    >Now 'Step1' will show as 'Copy item in Current Item to this list'

    >Select 'this list' link which will show the dropdown of all the lists

    >Select 'Doc3' list (assuming you have 'Doc3' document library list)

    >Now 'Step1' will show as 'Copy item in Current Item to Doc3'

    >Now select 'WorkFlow Settings' in the ribbon, which will open settings page of the workflow

    >In that page, under 'Start Options' section, select the checkboxes

    start workflow automatically when workflow is created

    start workflow automatically when an item is changed

    (you can check other checkboxes if you want)

    >Save the work flow and publish from the ribbon 

    With this worflow, when ever you add/modify a document/item in 'Doc1' will be copied to 'Doc3'

    You can go to SharePoint site and check 'Doc1' workflow settings. You will see the new workflow that is published

    Note:If you are using a system account and trying to add a document in 'Doc1' list, the workflow will not start. You have to login with another user

    Do the same steps for creating another workflow on another document library

    Let me know if you are stuck at any step.

    Regards,
    Adi
    www.adicodes.com

    • Marked as answer by sg_07 Tuesday, January 8, 2013 5:51 AM
    Tuesday, January 8, 2013 3:10 AM

All replies

  • Hello,

    What do you mean by compiled? Are you expecting to copy the last modified document to a new a document library?

    Regards,
    Adi
    www.adicodes.com

    Monday, January 7, 2013 3:36 AM
  • Hi Adi,

    Yes, exactly.. I need to copy the last modified document to a new library.. Do you have any suggestions on how to do this? Thanks! 


    Regards,
    Glenn



    • Edited by sg_07 Monday, January 7, 2013 3:43 AM
    Monday, January 7, 2013 3:40 AM
  • Instead of copying the files would you rather just see a rolled up list of the documents? Take a look at the Content Query Web Part.

    http://office.microsoft.com/en-us/sharepoint-designer-help/display-data-from-multiple-lists-with-the-content-query-web-part-HA010174134.aspx


    Mike Smith TechTrainingNotes.blogspot.com my SP customization book

    Monday, January 7, 2013 3:55 AM
  • I would suggest one of two routes.  Workflow may be an option by copying the document to another library, but it seems a bloated one.  You would potentially need to have a workflow instance in many places and end up with multiple copies of documents to manage.  

    If you just need to see recently modified documents in one place, you might want to use a content query web part and specify a filter option for a certain date, depending on how 'recently modified' you want the content to be.  

    You might be able to use a search core results web part to show all the documents in one spot.  You can edit the web part's query properties and specify the append text to query property to be the following:

    IsDocument:"1" Write>"1/1/2013".  This assumes a hard coded date.  Otherwise, I think a couple lines of code would need to be written.  

    http://technet.microsoft.com/en-us/library/gg549987(v=office.14).aspx

    • Proposed as answer by Pratik Vyas Monday, January 7, 2013 4:00 AM
    Monday, January 7, 2013 3:57 AM
  • In fact I could not understand your business requirement, because if we copy any last modified document to one document library we will end up all the documents in single document library. That means when ever document is uploaded in a document library it will be copied to a new library as per your requirement.

    Copying or moving documents is not at a problem. But, we can provide better solution if you can give more inputs on your requirement.

    Regards,
    Adi
    www.adicodes.com

    Monday, January 7, 2013 4:03 AM
  • Hi Guys,

    Thanks for your replies.. Actually, i managed to create this via Recent Document Webpart http://www.fiechter.eu/blog/Lists/Posts/Post.aspx?ID=19&mobile=0

    But the problem is, webparts are not visible in our SharePlus (sharepoint mobile application that we are using)

    So, we decided to make it inside a document library because only document libraries are viewable in SharePlus.. So instead of using webpart, maybe we can create a document library that will compile all the last modified document. 

    Do you have any idea on how to copy the last modified document to a new a document library?


    Regards,
    Glenn




    • Edited by sg_07 Monday, January 7, 2013 5:28 AM
    Monday, January 7, 2013 4:11 AM
  • Dear Glenn,

    I am putting up some detailed discussion on your requirement so that you can get better solution

    You requirment example: Document libraries Doc1, Doc2 and Doc3 are there in your site. So, whenever user uploads or modifies document in Doc1 or Doc2 it should copy to Doc3. In mobile site you will show Doc3 document library

    If you consider the above example as your requirement, Doc3 will have too many documents (ofcourse we can set some policies to remove the documents after certain time period)

    Attaching workflow to all document libraries to copy items might be overhead.

    May be list event handler which copies items to Doc3 is not a bad idea.

    But, just curious on your requirement, you mentioned that you are opening the site in mobile. Did you try disabling the default mobile behavior so that you can see the normal pages. I think you have already developed a webpart for display. 

    If I am wrong in understanding your requirement, please let me know

    Regards,
    Adi
    www.adicodes.com

    Monday, January 7, 2013 7:22 AM
  • Hi Adi,

    Btw, thanks for your time..
    Yes, we have to consider the above example, and Doc3 might have too many documents, so maybe setting some policies will be a good idea..

    Actually, we are using a mobile application which can only display document libraries, so, there is no other way to display webparts, only document libraries.. http://www.infragistics.com/community/forums/t/71293.aspx

    We only have 2 document libraries so attaching workflow to copy items may Not be overhead..
    Can i do this via workflow? Can you help me / give some suggestions to do this?

    THANKS!

     


    Regards, Glenn


    • Edited by sg_07 Monday, January 7, 2013 10:06 AM
    Monday, January 7, 2013 10:05 AM
  • Hi Glenn,

    No problem for help. Its good that you have only 2 document libraries. 

    Are you aware of creating workflow in SPD or is it a new task for you? If it is completely new let me know, I can provide you steps. Otherwise, I can help out if you are stuck at any place

    Regards,
    Adi
    www.adicodes.com

    Monday, January 7, 2013 11:09 AM
  • Hi Adi,

    I'm aware of sharepoint OOTB workflows but creating a new one is a new task for me.. 
    I'm also aware that creating workflow can be done via SPD, but i don't know how to start.. can you help me on creating a workflow regarding my requirement? Thanks again.. 


    Regards,
    Glenn



    • Edited by sg_07 Monday, January 7, 2013 2:56 PM
    Monday, January 7, 2013 1:29 PM
  • Hi Glenn,

    As per your requirement follow these steps to create workflow 

    >Open the site in SharePoint designer

    >Select 'WorkFlows' in the left menu

    >On the top menu, select 'List Workflow' which will show you all the SharePoint lists

    >Select for 'Doc1' list (assuming you have document library 'Doc1')

    >A popup will come to give the name of the workflow. Give the name ex:CopyDocs

    >Workflow is now in the design surface showing 'Step1'

    >Select 'Step1' and you will be highlighted with 'Action' in the ribbon

    > Under the 'Action' select 'Copy List Item'

    >Now 'Step1' will show as 'Copy item in this list to this list'

    > Select first 'this list', a pop up will come to choose list item with 'Current Item' in the List

    > Leave it as it is i.e it should be 'Current Item' and click OK

    >Now 'Step1' will show as 'Copy item in Current Item to this list'

    >Select 'this list' link which will show the dropdown of all the lists

    >Select 'Doc3' list (assuming you have 'Doc3' document library list)

    >Now 'Step1' will show as 'Copy item in Current Item to Doc3'

    >Now select 'WorkFlow Settings' in the ribbon, which will open settings page of the workflow

    >In that page, under 'Start Options' section, select the checkboxes

    start workflow automatically when workflow is created

    start workflow automatically when an item is changed

    (you can check other checkboxes if you want)

    >Save the work flow and publish from the ribbon 

    With this worflow, when ever you add/modify a document/item in 'Doc1' will be copied to 'Doc3'

    You can go to SharePoint site and check 'Doc1' workflow settings. You will see the new workflow that is published

    Note:If you are using a system account and trying to add a document in 'Doc1' list, the workflow will not start. You have to login with another user

    Do the same steps for creating another workflow on another document library

    Let me know if you are stuck at any step.

    Regards,
    Adi
    www.adicodes.com

    • Marked as answer by sg_07 Tuesday, January 8, 2013 5:51 AM
    Tuesday, January 8, 2013 3:10 AM
  • Wow, thanks for a very detailed steps Adi!
    I will try this and update you quickly once done..

    Thanks a lot!


    Regards, Glenn

    Tuesday, January 8, 2013 3:53 AM
  • Hi Adi,

    Thanks a lot! It was a success! It works.. thanks for your very detailed steps.

    One last question, how can i remove the documents after certain time period as you suggested earlier?

    Cheers!

    Glenn





    • Edited by sg_07 Tuesday, January 8, 2013 6:08 AM
    Tuesday, January 8, 2013 6:05 AM
  • Hi Glenn,


    Check this link how to set retention policy for deleting items

    http://weblogs.asp.net/sreejukg/archive/2010/11/11/retention-policy-for-document-library-in-sharepoint-2010.aspx


    Glad to hear that it helped you. All the best

    Regards,
    Adi
    www.adicodes.com

    Tuesday, January 8, 2013 6:28 AM