Monday, 25 June 2007

Adding metadata to a folder

Last month, I got a requirement; my client wanted to add some metadata with folders in document library. After some research, I found that we can not attach Meta data to folders. To resolve this problem we can create a new content type based on Folder content type. Below are the steps you can follow…

1. Under Site Actions menu, go to Site Settings



2. Click on Site Content Types under Galleries section



3. Click on “Create”
4. Give it a name “Ordered Folder”
5. Select “Folder Content Types” as the parent content type group.
6. From the Parent Content Type drop down select the “Folder” option.
7. Click “Ok”.



8. You will be redirected to Content Type Settings page. You can add columns to your Content Type here. Click on the “Add from new site column” link under the column section.



9. Select a name and data type for your column.



10. Click “Ok”. Now navigate to Document Library where you want to add this content type.

11. We need to enable management of content type for document library. On Document Library menu click on “Settings” and then “Document Library Settings”.



12. Select “Advanced Settings” under "General Settings”



13. Set “Allow management of content types” to “Yes”.



14. Click “Ok”. You will be redirected to Document Library Settings page.
15. Now under “Content Types” section, click on “Add from existing site content types”.



16. Select “Ordered Folder” from the list of “Available Site Content Types”.



17. Click “Ok”. You will be redirected to Document Library Settings page. Go to Document Library.

18. Select “New” on menu bar.



19. You can create your new folders using this content type. And at anytime you can add new columns to this content type.

20. If you have some existing folders, you can change the content type from “Folder” to “Ordered Folder”. Cool isn’t it.

I hope this will be helpful. I’m open for suggestions and comments.

27 comments:

M said...

Hey dude cool...good..keep posting more...i presume this is a service you are doing to the future and existing sharepoint developers...hope it will educate more people..

Anonymous said...

I followed this step-by-step and it really works! This solves the problem of how can I create a view that returns folders (rather than files) Thanks!

Arman arman@cine.se said...

I cannot click on "Site" >> "Site settings". Why?

Please help me.

Sumit Kumar Domyan said...

Hi Arman,

Do you mean you can't see "Site Actions" menu on your site?

Arman said...

That's right. I am using Microsoft Office SharePoint Designer 2007. Is that a different version? :/

Uma said...

Hi Sumit, Great stuff.
Very easy to understand. Screen images make it much easier to follow.Well done.
The only problem i have is i want to list all the documents in the folder in a Content Query Web Part.
Whenever i run the query, it returns the folder.
Is there a way to display in a page, list of items that are inside a particular folder in the document library?

Anonymous said...

Hi,

I'm working on folder metadata and I go further :
1 - create a list with a custom folder content type
2 - create a folder of that custom content type and set a value to a metadata
3 - save the list as a template list (.stp) and select "Include content"

Problem : When I use the new template to create a list, the new list contain a folder but the metadata is not present. Why?

Anonymous said...

Hi,
Thanks for this extremely useful information. I am looking to take this to the next level and report on some custom columns I have added as metadata to some reports I am attempting to build using SQL Server Report Builder. Problem is, I cannot find where the field data is stored in the database let alone how to reference index information using these fields stored against objects stored in sharepoint. Any pointers are greatly appreciated!

Anonymous said...

I am currently working on folder content type:

1)I created a new folder content type

2)I attached the folder content type to document library.

3)I saved the docu library as a template ....stp file.

4)My problem is when i create a new document library with this template all the folder items are comming, but it is showing the original folder content type not the custom content type i used....

Any suggesions that would be appriciated....

C. Anne said...

Help please...This worked great until I modified the field and by mistake selected to update all content types inheriting from this type. All the folders across the entire site, not just the new folder now have URL problems and cannot be linked to. I tried to undo but it's not working....

Peter said...

Hi Sumit,
Thanks a lot for sharing your valuable experience!
Peter

Anonymous said...

This worked great! Now I need to edit the properties, and want to use "Edit Datasheet". But all values show read-only. Document properties edit without issue.

Any help?

Anonymous said...

This was very helpful. Now that I have my folders built, I need to be able to modify the folder properties using "edit in datasheet". But the cells are all read-only. Is this by design?

vrdarako said...

Hi, This post is really good and very useful. However, I am not able to edit the folder metadata in datasheet view. they become read-only. Is this a limitation?

Thanks,
Ramana

Sherie said...

Hi Sumit,
Thanks so much for this great post and easy-to-follow directions/screen shots! I spend 1/2 a day working on this and was about to give up!
Sherie

vrdarako said...

Hi,
We have created custom folder types and added metadata to the folders, but we are facing some issue with this. All the custom folder types are available for documents also and SharePoint is allowing me to set hte folder type as the content type of a document. This is happening in 'Edit in datasheet view' and also with client applications like office.

Is there any way to fix this, so that only document content types are avaialble for documents and folder content types are available for folders. SP web UI is working fine though

Laurie Minarcik said...

Thanks for the info on adding metadata to a folder. Can I search on the metadata?

Laurie Minarcik said...

Is it possible to search on folder metadata?

Sumit Kumar Domyan said...

Yes, search on metadata of a folder is possible.

Anonymous said...

Hi, this is really cool, but I have a question. After setting this up as you suggest, I now set filters based on what I want to see. However, If I click on one of the folders, some of the items beneath that folder are not shown because they don't have the same metadata on them. I'm just thinking that there are going to be a lot of end users that are confused that they don't see all the documents in their folder. Do you have any other suggestions other than manually removing the filter each time you click on the custom folder?

Eric said...

Thanks so much for this! I didn't want to have to move all that information out of folders! But I do have one question, I use the display order field on my ordered folders and some one off files in the library. How can I sort both the folders and the files together. Ex.:

folder 1
file 2
folder 3
folder 4
file 5

Thanks!

Akshaya Mashankar said...

hi Nice Post,

hey is the any way by which we can have a folder describtion in the view details the files in the folder.
if so whats the reemedy

Katherine said...

Thank you for documenting folders with metadata. My question is when you create a folder content type, can you program it through SharePoint MOSS 2007 to automatically create the same three folders under it every time you click on New, Folder Content type?

Anonymous said...

You saved my life today, great trick!

Wayne said...

Hi there,
this concept works well. We need to take it one step further is it possible to calculate and tabulate data based on content in the metadata tags? we have a scenario where we are evaluating on information based on the metadata tags.

Thanks!

nkhhphuc said...

Great! I resolved my problem follow your intruction.

Thank you very much.

tripwire said...

Hi Sumit,

This is a nice article on contentt ype inheritance but are you bale to address the issues everyone keeps referring to?

The Datasheet View read only problem is not only associated with your method but seems to be a SharePoint bug.

We too have noticed this when dealign with custom content types.

It woul dbe great to know why this happens.