none
how to automatically save new file into document library with a unique name or ID? RRS feed

  • Question

  • I've created a form using MS Word Document (2007) and lock it (protect it) so that users will be able to fill in the required fields.
    then i've created a Content Type and uploaded the MS word form to be used as a template.

    Then I've created a document library and enabled the content type and associate the above form for the library, so that when users click on New button the form will open.

    everythings goes fine till here.

    The problem is when users clicks on New and save the file back to the library, It doesn't save it with a unique name, instead it is over writting the existing one.
    in other words, if employee 1 fill up the form and save it and later on employee 2 accessed the library and fill up a new form, he will overwrite what employee 1 has already saved!!

    Is there a way to give every new created file a unique name? maybe (username+time)??

    Friday, August 27, 2010 11:02 AM

Answers

  • Hi Aysha,

    Thanks to share your problem.

    I think, you can create a event handler on ItemAdding type. Save the username+current date in one column. Add every doc as new item in doc library by using item.Add(). It should work.

    To create event handler please look into it.

    http://madsharepoint.blogspot.com/2009/07/basic-event-handling-in-sharepoint.html


    Please let me know if you find any problem


    Cheers, Hemendra-MCTS "Yesterday is just a memory,Tomorrow we may never see"
    Friday, September 24, 2010 5:10 AM
    Moderator
  • Whenever Word saves a file to SharePoint document library it asks for a document name which allows users to choose a unique name. I don't really recommend a event handler to rename the file, I tried with the same problem and end up with another issue where I was not able to delete the document or invoke a workflow.

    Whenever you upload a file it is actually a Url, when you are trying to rename you are theoretically copying the file in new name and removing the old file. You can achieve the same using SPFile.MoveTo

    Refer:http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/5c3dcc5d-3113-463d-8835-2a050b2471a6/


    Aravind http://aravindrises.blogspot.com
    Monday, December 13, 2010 5:33 PM

All replies

  • Not sure if it is done through some settings in word 2007.

    does anyone have expenience in this?

    Monday, August 30, 2010 4:35 AM
  • i'm not lucky to find a solution.

    any one can help?

    Tuesday, September 21, 2010 8:04 AM
  • Hi Aysha,

    Thanks to share your problem.

    I think, you can create a event handler on ItemAdding type. Save the username+current date in one column. Add every doc as new item in doc library by using item.Add(). It should work.

    To create event handler please look into it.

    http://madsharepoint.blogspot.com/2009/07/basic-event-handling-in-sharepoint.html


    Please let me know if you find any problem


    Cheers, Hemendra-MCTS "Yesterday is just a memory,Tomorrow we may never see"
    Friday, September 24, 2010 5:10 AM
    Moderator
  • Whenever Word saves a file to SharePoint document library it asks for a document name which allows users to choose a unique name. I don't really recommend a event handler to rename the file, I tried with the same problem and end up with another issue where I was not able to delete the document or invoke a workflow.

    Whenever you upload a file it is actually a Url, when you are trying to rename you are theoretically copying the file in new name and removing the old file. You can achieve the same using SPFile.MoveTo

    Refer:http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/5c3dcc5d-3113-463d-8835-2a050b2471a6/


    Aravind http://aravindrises.blogspot.com
    Monday, December 13, 2010 5:33 PM