Share via


How to give naming convention for a document library

Question

Saturday, December 18, 2010 4:26 PM

Hi,

I have a customer whose requirement is to put naming convention in a document library. He needs his users should follow the naming convention while uploading the document else the library should reject the document

the requirement is as follows,

naming convention like this:first three letter should be client name and next three letter should be some number.

For example:xxx111

I tried to put some id in document by default column setting .but couldn't achieve his requirement

Any idea to achieve this .

rijuv technical specialist,sharepoint

All replies (6)

Saturday, December 18, 2010 5:50 PM ✅Answered | 1 vote

Hey there,

While there is nothing out of the box, you have three options off the top of my head:

1. Find a 3rd party product that does this (sorry, I don't know of any, but I'm sure they exist)

2. Create an event receiver of some kind that incorporates the requirements via code

3. Create a couple of columns for your library that provide the information you need in your naming convention. Then have a workflow fire on item creation that takes the values they pick from your columns/metadata and assemble a string in your workflow that pieces that file naming convention together.  You'll need your workflow to:

  a) pause for a minute as SharePoint won't be able to update the items immediately as it will be (very temporarily, but long enough) checked out

  b) use the 'update item' to update the 'path and name item of the item, using the string you assembled with the the workflow

Hope that helps,
Sean

Sean Wallbridge, SharePoint MVP Victoria, BC On The Web: http://www.itgroove.net My Blog: http://blog.brainlitter.com


Monday, December 20, 2010 11:28 AM ✅Answered

Ideal way is to write an event receiver and attach it to the document library

Keep naming convention pattern in a generic place like web.config

 

 

Aravind http://aravindrises.blogspot.com


Monday, December 20, 2010 8:16 PM ✅Answered

In your case I will recommend that you implement ItemAdding event receiver (also ItemUpdating event as user might change the name anytime) for the document library. The second point is where you should store the desired naming conventions , you have multiple options (Web.config , Property bags , Lists etc) but you should select either of the carefully, some of them might be overkill.

Following MSDN link explains each option and its pros/cons. 

Managing Application Configuration

http://msdn.microsoft.com/en-us/library/ff649798.aspx

Microsoft SharePoint MVP |http://razirais.wordpress.com| MCT| MCPD SharePoint 2010 Developer| MCITP SharePoint Administrator 2010


Monday, December 20, 2010 10:20 PM ✅Answered

So the SharePointy way to do this is required metadata, where you'd have a required client field and a required somenumber field. If the user does not enter these values, the document will always be in a version 0.1 checked out state. Even better is with Records Center functionality, you can put documents into a HOLD state until they have the proper metadata, at which time they are routed into destination document libraries.


Tuesday, December 21, 2010 5:46 AM ✅Answered

rijuv, AFAIK this can be only achieved via Programming using Event Receivers.  Check the How Do I series of video on Event Receivers here.Thanks & Regards,
Kamlesh | Blog | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.


Tuesday, December 21, 2010 5:32 AM

Thanks for the answer.

Can you please mention how to do this procedure.that would be great help for me

rijuv technical specialist,sharepoint