Seiten

Herzlich willkommen im technischen Blog der MindBusiness GmbH
In diesem Blog veröffentlichen wir praxisnahes Know-how, neue Erkenntnisse und Erfahrungen zu Microsoft SharePoint- und Office-Themen direkt aus unserer Berater-, Trainer- und Entwickler-Praxis. Hier finden Sie interessante Lösungen und neue Ideen zu den verschiedensten Anforderungen und Problemen. Unseren News-Blog finden Sie unter newsblog.mindbusiness.de/newsblog. Wir wünschen Ihnen viel Spaß beim Lesen und Stöbern und freuen uns auf den Austausch mit Ihnen.

SharePoint folders and metadata

Metadata is a powerful means of organizing your information, especially documents, in SharePoint. It allows you to break away from your standard file system and the confusing mess that too many folders within folders can create. Finding your information is achieved to a large extent through a) making sure users input necessary information, b) powerful search and c) views.

In this article, I will show you how to create folders that can save metadata attributes as part of their properties.

Why use folders in SharePoint in the first place?

Although by and large you’ll be better off without folders in SharePoint (based on my experience, anyway), in some instances it can make sense to use them. For example, the different CDs we use for our products, training information etc. are built in HTML. As a consequence, you’ve got files that need to be in the right folders in relation to each other for all the links to work properly. Naturally, you could simply zip all of this information. However, that means any time you need to update just one or a few files, you have to download the entire zip file, unzip, add the new files, zip again, and upload to SharePoint. Wouldn’t it be much nicer to directly access or add individual files and edit them without further ado?

Standard settings won’t suffice

SharePoint folders with metadata will let you do just that while making it easier to find your information. If you take a look at SharePoint libraries, you’ll find that there’s already an option in place that lets you add folders (just click on the arrow next to “new” in the document library menu bar to see it in the drop-down list). However, you’ll also find that you cannot add metadata to folders created this way.

Creating a new folder content type

The way to resolve this is to create a new website content type that’s based on the content type “Folder”. You’ll need to go to the website collection settings to do this. Once you’ve created a new content type, you can include it in any library. Just make sure to add any custom columns you might have in your library.

Here’s how to do it in a few steps. Let’s start by creating a new content type:

1. Go to your top level site.

2. Click on “Site actions”.

 

3. Select “Site Settings”. In MOSS, you’ll have to additionally select “Change all Site Settings”.

4. Under “Galleries”, select “Site Content Types”.

5. Click on “Create”.

6. Give the new content type a name.

7. Select “Folder Content Types” as the parent content type group.

8. Select “Folder” as the parent content type.

9. Select which group you want to add the new content type to.

10. Click “OK”.

Adding the new folder content type to your libraries

Next, we’ll add this new content type to a document library:

1. Go to the library you want to add the content type to.

2. On the library menu bar, click on “Settings”.

3. Select “Document Library Settings”.

4. Under “General Settings”, select “Advanced Settings”.

5. Set “Allow management of content types” to “Yes” if this is not already the case.

6. Click on “OK” to go back to library settings.

7. Under “Content Types, click on “Add from existing site content types”.

8. Select the content type group from the drop-down list that you saved your content type in.

9. Select the new content type from the list of “Available Site Content Types” on the left.

10. Click on “Add”. The content type is added to the list of “Content types to add” to your library.

11. Click on “OK”. This brings you back to your library settings.

Adding columns to your new content type i.e. preparing for metadata

Finally, we need to make sure we can use all the columns in this library with our new content type re. with folders. From the list of content types in the library, click on the one you just added. Then follow these steps:

1. Under “Columns”, click on “Add from existing site or list columns”.

2. From the drop-down list, select “List Columns” if this is not already selected.

3. Select all “Available columns” that you want to be able to use with this content type.

4. Click on “Add”. The selected columns placed in the “Columns to add” list.

5. Click on “OK”.

Done!

That’s it! It takes a few steps but I think it’s worth the effort. You can access the new content type through the drop-down list that opens up when you click the arrow next to the “New” button in your library menu bar. I’d also recommend turning off the standard folder option available in the drop-down list. Otherwise users might be confused and select the wrong folder. To turn this off, just go your library settings and disable the appropriate option in the “Advanced Settings”.

What about existing folders?

The nice thing about content types in SharePoint is that you can assign them to items in a library as needed. So, if you’ve got an existing folder structure you want to keep and you copy & paste it to SharePoint via the “Explorer” view, all you need to do is alter the content types of these folders (the default setting will assign them the standard “Folder” content type that can’t save metadata). Just select “Edit properties” from the drop-down menu on the desired item and switch the content type to the one you want to use.

Also, don’t forget that most of the effort in SharePoint has to do with organisation and planning. Realization will usually only take a fraction of the time. One of the  things to ask yourself here is: Do I need EVERY folder to be able to save metadata? For example, an HTML project may contain folders for CSS or other files that don’t actually hold content. Maybe these folders don’t need metadata. Essentially, the most important folder is the project one, the one that contains all the other files and folders. Maybe it’s enough if this one uses metadata and/or some selected files and folders.

Naturally, all of this depends on the nature of your project. Planning these things can save you a lot of work without compromising the efficiency of your SharePoint site.

Questions?

I hope this will be helpful. Please don’t hesitate to post questions and/or feedback if you think there’s something missing or there’s something I didn’t make clear.

14 Kommentare zu SharePoint folders and metadata

  • Dave

    I am trying to add one of these new folder types to a document library using
    the API.
    For example SPFolderCollection.Add() will add a new folder but you don’t get
    to choose the content type.

    SPListItemCollection.Add(folderUrl, underlyingObjectType, leafName) just
    gives me an SPException Invalid Item data – missing FileRef.

    Any ideas?

  • I tried everything to add a folder in a custom list. The New Folder in Sharepoint works, but when I want to do it in code, if fails (not always errors, but no folder is visible)…

    I tried to add contentstypes, ….. but nothing work?!

    In My SPDocumentLibrary it is easy, but not work here :(

  • Peter Worlin

    Hi,

    I had the same problem but found an alternative that does work:

    this line below does not work,it gives a file ref problem:

    ‘oListItem = oDocLib.Folders.Add(FolderURL, SPFileSystemObjectType.Folder)

    ‘However this works fine
    oFolder = oDocLib.RootFolder.SubFolders.Add(FolderURL)

    Hope this helps

    Peter

  • D

    Awesome article!!!
    Thanks a lot, such a simple solution and it works great!
    I might have thought of this or run across it eventually, but finding this article sure save me a lot of time compared to what I was going to do.
    Thanks again!!

  • Thanks, great and clear article!

  • Jim E

    Great read Robert! May I ask a quick question?

    Folder A: Folder called My Music . It has a metadata field called Artist
    Folder B: Sub Folder called My CDs Also has a field called Artist

    If I change artist name in A, will that change reflect automatically in B if inheritance is turned on?

    It does not seem to be working… I change Artis name but it doe not auto-update in subfolder

  • Peter

    thanks. very useful.

  • Jessica Heinz

    I hope someone read this …

    my questions is,

    it\’s possible to make a listtemplate from this document libary and create a new one that include the documents types automatically?

    scenario:

    lib with 5 folder who have the new createt doc typ.. I put metadata into it. know i make a template. after I create a new lib with the template die metadata of the folder are not longer \”visible\”.

    thanks you very much

    cheers
    jessica

  • Ali

    Hi for all,

    I am trying to create new folder automatically each time new item is created and the item will be created inside that folder automatically.

    how can we acheive this senario ???

  • Vasanth

    Excellent..I was looking for folder metadata

  • mukesh Ajmera

    How to find item click event in Folder Content Type. I wann to custimized Default url.

  • iain

    Hi there

    This was so really useful and easy to follow. Many thanks for the guide.

    Best regards

    Iain

  • Sree V

    Thanks for the detailed article.

Hinterlasse eine Antwort

 

 

 

Du kannst diese HTML-Tags benutzen

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">