Term Store and Content Types in SharePoint Online

Metadata is data about data, in the sense that it gives more information about other data. Examples of metadata for a document can be the document's author, creation date, size, or its security classification. SharePoint enables the following types of metadata:

  • Automatically generated metadata: When you upload a document or create a list item in SharePoint, it automatically tracks who created the document or list item and when, who modified it and when, and accordingly adds the information to the document or list item.
  • Metadata that users can freely create in-place: In addition to autogenerated metadata, users can also add information to each list item or document according to the columns created for the list or library that they are working with. They can enter this information in-place using various types of fields, such as the date field type, the single line of text field type, and so on.
  • Metadata that is maintained centrally for the entire organization: The third type of metadata is one that is defined and managed centrally but is available for the entire organization to select and tag list items or documents with. Examples of such metadata could be an organization's office locations, departments, products, and so on. You will still need to create columns within various lists and libraries in order to tag them with this metadata but you would manage the metadata only from one central location called the Term Store in SharePoint.

Users with appropriate access can use the Term Store management tool to manage terms in the Term Store. Site or list and library owners can then create Managed Metadata columns that let users to accordingly tag information and documents with this centrally managed metadata. Doing so helps with the following benefits:

  • Consistent metadata definition across the organization: Instead of the site, list, or library owner creating their own classification, users across the entire organization use the standard enterprise terms. This helps ensure uniformity and accuracy. For example, HR, H.R., H. R., and Human Resources all mean the same department. Allowing users to enter the department name through a free flow text field, even if it's defined at the site level, could lead to inconsistencies. On the other hand, if there was a single selectable department defined at the enterprise level, all documents and list items could then be tagged with the same department name.
  • Improved content organization and discovery: Being able to tag documents using the same consistent terms leads to improved content discovery. As an example, you would be able to easily search for and discover all documents tagged with Report as the Document Type and Finance as the Department. The search would continue to return permission trimmed results so you only see what you have access to but you will not need to go to every single site, list, or library to discover this content. Also, Managed Metadata columns help you to better filter and sort information in the corresponding lists and libraries.
  • Central management of metadata: The Term Store enables you to centrally manage metadata. You can add new terms or update the old ones as needed and the changes will be reflected throughout all sites, lists, and libraries across the enterprise. You can also define synonyms and multilingual terms centrally through the Term Store. So, for example, you can set up departments in the Term Store so that HR andHuman Resources both point to the same term.
  • Navigation: Metadata navigation for sites enables a site owner to create navigation based on metadata terms. This article describes the navigation options for SharePoint Online, including managed navigation, in more detail: https://m365book.page.link/navigation-options.
    Further, we discussed list views in the Creating a custom list view recipe in Chapter 4, Working with Lists, Libraries in SharePoint Online. There's a flavor of metadata navigation for lists and libraries that enables the creation of dynamic metadata-based views. This support article explains the steps to do so: https://m365book.page.link/list-metadata-navigation.

The recipes in this chapter will show you how to first create and manage terms in the Term Store and then use them to enrich the content within your site. We will also look at the concept of a content type, which is basically a reusable collection of pre-defined site columns that let you standardize the information that is captured in the lists and libraries within your site.

At the time of writing, Microsoft was rolling out updates to the Managed Metadata service, Term Store, and content types. You can read more about these updates here: https://m365book.page.link/Modernizing-MMS.

Even though these updates modernize the way these features are presented to you, the underlying concepts that we will discuss in this chapter continue to carry over to the newer UI.

In this chapter, we will cover the following:

  • Creating a new group for term sets
  • Creating term sets and terms
  • Creating a Managed Metadata site column
  • Creating a content type and adding columns to it
  • Adding a content type to a list or library
  • Tagging a document

Creating a new group for term sets

Terms in SharePoint are organized in groups and term sets. A Term Store group is a container for term sets, which in turn contain various terms. All term sets in a group follow a common security setup. Your organization could have defined multiple groups within the Term Store, with each group typically targeting a different set of owners and contributors.

In this recipe, we will see how to use the Term Store management tool to create a new group in the Term Store.

Getting ready

You will need the Design permission level or higher on your site to be able to browse to the Term Store Management Tool. You can alternately browse to it from the Microsoft 365 admin center if you have SharePoint admin or higher permissions within your tenant.

You should additionally have been granted Term Store administratorrights within the Term Store to be able to create a new group once you browse to it.

How to do it...

To create a new groupusing the Term Store management tool, do the following:

  1. Browse to the Site Settings page for the site where you would like to create the new group.
Visit Viewing and changing site settings, in Chapter 3,Working with Modern Sites in SharePoint Online, if you are not familiar with how to browse to the Site Settings page.
  1. Click on Term store management under the Site Administration heading, as shown in the following screenshot:

  1. Click the down arrow next to the main node in the taxonomy tree on the left of the page and then click New group, as shown in the following screenshot:

  1. Enter a name for your group and then press Enter or click anywhere outside the box, as shown in the following screenshot. We will enter Contoso Enterprise terms for our example:

  1. This will create the group and show you a screen that lets you edit various properties for the group. You can optionally enter a description for the group through this screen. You can also enter or select the managers as well as the contributors for the group. This is shown in the following screenshot:

The group Contributors can create and edit term sets and terms within the group. The group Managers have Contributor permissions and can additionally manage users in the Contributors role. The permissions that you grant to a group are applied to all the underlying term sets and terms for that group. You cannot set or alter permissions on individual term sets or terms within the group.
  1. Click Save to save the updated properties for your new group.

Congratulations! You just created a new group in the SharePoint Term Store. Note that even though the group was created by navigating to the Term Store from within your site, it was created at an enterprise level. This means that anyone with appropriate access to the Term Store within your entire organization will be able to view/edit this group in the Term Store. Typically, this should only be a few users. Additionally, other users from across your organization will be able to tag items on their sites using the terms from within this group.

How it works...

The Term Store, at its core, is a way to organize and group a hierarchy of terms. The Term Store management toollets you centrally manage this taxonomy for your organization.

Provided that you have appropriate permissions, you can access this tool directly from the Site Settings page from within the site that you are working on. Please refer to the Viewing and changing site settings recipe in Chapter 3, Working with Modern Sites in
SharePoint Online for details on how to do this.Alternatively, you can access the Term Store through the SharePoint admin center if you have been granted one of the SharePoint admin or Global admin roles.

The highest node in the Term Store hierarchy is that of the service instance itself. As shown in the following screenshot, clicking this node enables you to view or manage the properties of the Term Store service instance for your tenant:

A few key things you can do through this screen are the following:

  • View the Sample Import file: The Term Store lets you create entire term sets and their underlying terms by importing them from CSV files. Clicking the View a sample import file link downloads a sample CSV file that you can update and then use to import your term sets. We will see how to use this import file in the Term Set properties topic of the Creating term sets and terms recipe later in this chapter.
  • Assign Term Store Administrators: This setting lets you specify users that can create and manage Term Set groups and the underlying term sets.
  • Change the Default Language: The Term Store allows for terms to be defined in multiple languages. It also lets you choose the default language for all the terms in the Term Store. You can choose from a list of languages that have been enabled for your environment. As mentioned in the property description, every term will need to have a label defined in the default language.
  • Edit the Working Languages: This setting enables you to select the languages allowed for the Term Store. For each term, you can then define a label in one of the allowed languages. As shown in the following screenshot, since German was one of the languages enabled in our tenant, we have defined an alternate label for Engineering in German:

Note that you need to be in the Term Store Administrators group or be part of the tenant wide Sharepoint admin or Global admin roles to be able to manage the properties of this node.

A Term Store group comes next in the hierarchy, below/after the Term Store service instance. The group properties are self-explanatory and were also described as part of the preceding recipe.

See also

  • The Viewing and changing site settings recipe in Chapter 3, Working with Modern Sites in SharePoint Online

Creating term sets and terms

A Term Set is a Grouping container for all the related terms. Some possible examples of term sets are a list of all products and/or services offered by your organization, a list of all office locations of your organization, a list of all departments, and so on.

There are two ways in which you can create a Term Set and underlying terms:

  • You can use the Term Store Management Tool to manually create each Term Set and then create individual terms underneath it.
  • You can use the CSV import functionality to import a Term Set along with the underlying terms.

This recipe shows you how to create term sets using both these approaches.

Getting ready

You will need Contribute access to the term group to be able to add and update term sets and terms within that group.

How to do it...

To create a new Term Set and terms from scratch, do the following:

  1. Browse to the Term Store Management Tool from the Site Settings page on your site.
Visit the Creating a new group for term sets recipe earlier in this chapter if you are not familiar with how to browse to the Term Store Management Tool.
  1. Click the down arrow against the group under which you would like to create the new Term Set and then click New Term Set, as shown in the following screenshot:

  1. Enter a name for your Term Set and then press Enter or click anywhere outside the box, as shown in the following screenshot; we will enter Contoso Departments for our example:

  1. This will create the Term Set and show you a screen that lets you edit various properties. You can optionally edit various properties for this Term Set on this screen.
  1. Click the down arrow next to the Term Set and then click Create Term, as shown in the following screenshot:

  1. Enter a name for your term and then press Enter or click anywhere outside the box. We will enter Human Resources for our example.
  2. This will create the term and show you a screen that lets you edit various properties for the term.
  3. Next, we will add a child term to the term that we just created. To do that, click the down arrow next to the term and then click Create Term.
  4. Enter a name for your Term Set and then press Enter or click anywhere outside the box. We will enterCompensation and Benefits for our example.
  1. Like before, this will create the new term and then show you the properties screen for it. The entire structure is shown in the following screenshot:

To import a new Term Set and underlying terms from a CSV file, do the following:

  1. Browse to the Term Store and click on the topmost node within the taxonomy tree.
  2. Click the View a sample import filelink in the Sample Importsection.
  3. Open the downloaded file. This file contains columns in the format required by the Term Store to be able to create a new Term Set through the import feature. It also contains sample data that helps illustrate the file structure. We will populate this sample file with the details for the Term Set that we are going to create.
  4. Replace the sample data with the Term Set and hierarchical terms, as shown in the following screenshot:

  1. Save the file. Make sure you save the file preserving the original .csv format.
  2. Back in the Term Store, click the down arrow next to the Term group within which you would like to import the Term Set and then click Import Term Set, as shown in the following screenshot:

  1. Click theChoose Filebutton in the Term Set importpop-up box and then select the CSV file that you saved as part of the previous steps.
  2. Clicking OK will import the contents of your file and show you the newly created Term Set under the selected group. This is shown in the following screenshot:

Congratulations! You just learned how to create a new Term Set and then add hierarchical terms to it.

How it works...

Term Sets help prevent the repetition of metadata definitions across multiple sites, thus ensuring consistency. By maintaining and managing this information in a central place, we also ensure additional governance for this metadata. Once created centrally through the Term Store, term sets and corresponding terms will be available for use across all sites in your organization.

Term Set properties

The Term Set property pages enable the management of various aspects of the Term Set. The following is a description of some of the notable properties:

  • The General tab:
    • Owner, Contact, and Stakeholders: While SharePoint lets you specify an owner, contact, and stakeholders for a Term Set, these values do not grant any additional permissions to the Term Set and are just a way to track the business owners or stakeholders for a Term Set. The permissions for all term sets within a group are controlled through the group's properties. You can read more about Term Store permissions here: https://m365book.page.link/termStore-Permissions.
    • Submission Policy: This property specifies whether or not users using a Term Set can freely addtermsto theTerm Set. When it's set to Closed, only users who have access to theTerm Setthrough permissions on theTerm Store can add termsto it. When set toOpen, users can add in-line terms while they are tagging content, and if theterm that they are looking for is not present in theTerm Set. TheAllow Fill-incolumn level property will also need to be set along with this value to enable end users to add new inline tags. We will look at the Allow Fill-inproperty as part of the next recipe, Creating a Managed Metadata site column. Generally speaking, it is a good idea to keep the Term Set closed. This helps maintain consistency and control over your data. There may be scenarios where you would want your Term Set to be open, especially when the classification is more informal. This article discusses formal and informal classification in greater detail: https://m365book.page.link/Folksonomy-Taxonomy.
    • The Intended Use tab:
      • Available for Tagging: Uncheck this option to disable the terms from this Term Set to be made available for tagging.
      • Use this Term Set for Site Navigation: On-prem versions of SharePoint let you use term sets and their underlying terms to drive the global (top) navigation. In fact, at the time of writing, this is the preferred method for the on-prem installations of SharePoint. This method of managing global navigation is now deprecated in the modern version of SharePoint Online. You can refer to the following links to understand managed navigation and how to enable it for the on-prem versions of SharePoint:
        https://m365book.page.link/Managed-Navigation and https://m365book.page.link/Managed-Navigation-SPO.
        The following link explains how to plan navigation for the modern SharePoint Online experience:
        https://m365book.page.link/Plan-Modern-Navigation.
      • Use this Term Set for Faceted Navigation: The term faceted navigation is used to describe filters or refiners that can be added to certain pages to make it easier to get to the content. Just like managed navigation, this feature is now deprecated in SharePoint Online and is only available for on-prem versions of SharePoint. You can read more about configuringfaceted navigation and refiners here:
        https://m365book.page.link/Faceted-Navigation.
    • The Custom Sort tab: By default, the terms in a Term Set are sorted alphabetically. If the need arises, however, you can specify a custom sort order for your terms. This can be useful in certain scenarios where you would like to have a non-standard sort, say, for example, a list of the products sorted by the newest product first.

Term properties

Some of the notable properties of a term are the following:

  • The General tab:
    • Available for Tagging: If unchecked, the term will be visible but cannot be used by end users. An example use of this property is if you have hierarchical terms and you want the users to select only the child terms and not the parent terms. To achieve this, you would uncheck this value for the parent term and leave it checked for the children.
    • Other Labels: SharePoint lets you define synonyms for your term, as shown in the following screenshot:

Your site users will then be able to select such terms either using the default label or one of the synonyms, as shown in the following screenshot:

  • The Custom Properties tab: You can add additional propertiesto yourterm and thus further define it through this screen. You can then utilize and display these properties through a custom-coded solution. You can also configure the SharePoint search to display one of these properties as part of the search results.

There's more...

If you click the down arrow next to a Term Set or a term, you will notice a few contextual actions that you can perform on them. We will discuss these actions in the following section.

Organizing the Term Store: Copy, reuse, and pin term sets and terms

The down arrow next to the Term Set shows the following actions in addition to the Create Term action that we saw as part of this recipe:

  • Copy Term Set: Clicking this option creates a copy of the Term Set and its underlying terms. The underlying terms are reused. We will see in a bit what reusing a term means.
  • Reuse terms: Enables you to select a term to reuse from a different Term Set. Reusing results in creating a linked copy of the selected term as a child of the selected Term Set. Additionally, if you make changes to the source term (such as renaming the term), the changes are also reflected in the destination term and vice versa.
  • Pin term with children: Lets you select a term to pin from a different Term Set. Just like reusing a term, pinning a term results in a linked copy of the original term. The difference is that any changes made to the source are also reflected in the destination but the destination term is now read-only (you cannot make any changes to it).
  • Move Term Set: Click this action to move the selected Term Set and its underlying terms to another group.
  • Delete Term Set: Altogether delete the selected Term Set and its underlying terms. Note that unlike most other SharePoint information types, deleted term sets or terms are not stored in the Recycle Bin and hence cannot be recovered.

The down arrow next to aterm shows the following actions in addition to theCreate Termaction that we saw as part of this recipe:

  • Copy term: Clicking this option creates a copy of the term. The copied term can be independently managed from this point on.
  • Reuse terms: This option works exactly like the Reuse terms option of a Term Set except that the term being reused is brought over as a child of the currently selected term.
  • Pin term with children: This option works exactly like the corresponding option of a Term Set except that the term being pinned is brought over as a child of the currently selected term.
  • Merge terms: Moves the selected source term as a label under the selected destination term.
  • Deprecate term: This makes the selected term unavailable for tagging going forward. Existing items that use the term continue to remain tagged with the term. You should almost always deprecate terms instead of deleting them. This will prevent orphaned tags if the term is being used somewhere.
  • Move term: Click this action to move the selected term and its underlying termsto another Term Set or term.
  • Delete term: Altogether delete the selected term.

The following links provide more details regarding these actions:

Exporting and importing using PnP

In addition to creating a taxonomy from scratch, you can also import the entire taxonomy tree, just a few term groups within the taxonomy, or individual term sets within those groups. You can achieve this by creating a comma-separated values (CSV) file of your groups, term sets, and terms and then use the PnP commands to import them into the Term Store.

PnP short for (Patterns and Practices). You can read more about it in the SharePoint PnP sub-section of the Office Development Frameworks section in the Appendix.

Once you have the taxonomy changes defined in the .csv file, you can import them into your organization's Term Store using the Import-PnPtermSet command, as described here: https://m365book.page.link/Import-PnPtermSet.

Similarly, you can use the Export-PnPTaxonomy command to export the taxonomy tree to a CSV file of your choice, as documented here: https://m365book.page.link/Export-PnPTaxonomy.

See also

  • The Creating a new group for term sets recipe in this chapter
  • The SharePoint PnP topic in the Office Development Frameworks section of the Appendix

Creating a Managed Metadata site column

In the previous recipe, we saw how to create term sets and terms in the Term Store. In this recipe, we will see how to create a column that utilizes these terms and makes them available to end-users for tagging. We will create a managed metadata site column called Contoso Department for this recipe. The purpose of this column will be to enable users to tag documents with the department that authored it and is responsible for it.

Getting ready

You will need Design or Full Control permissions for the site within which you would like to create the new column.

How to do it...

To create a new site column that utilizes the taxonomy from the Term Store, do the following:

  1. Browse to the Site Settings page for the site, as described in the Viewing and changing sitesettings recipe in Chapter 3, Working with Modern Sites in SharePoint Online.
  2. Then click Site columns under the Web Designer Galleries heading.
  3. Click Create to be taken to the Create Column screen. You can enter various details for your column on this screen.
  4. We will begin by entering the column name and selecting Managed Metadataas the column type. We will use Contoso Department as the column name for our example.
  5. We will then enter or select the following additional properties:
    • Group: This is just a way to group your custom columns. Select an existing group if you previously created one or create a new one by entering its name. For our example, we will create a new group called Contoso Enterprise Columns.
    • Description: Enter a meaningful description that explains the purpose of your column.
    • Require that this column contains information: Set this to Yes or No depending on whether or not this column will be mandatory.
    • Multiple Value field: If selected, this will enable users to enter or select multiple terms for this column. We will leave this unchecked for our example.
You will want to make sure that the column name reflects whether the column allows multiple values or not. For our example, we called the column Contoso Department because we anticipate that the users will only select a single department when tagging documents and list items with it. We would have called it Contoso Department if the business need was to allow documents and list items to be tagged with multiple departments. Either way, you should discuss business, governance, and information architecture requirements before selecting various properties for the column, including the Multiple Value field property for the Managed Metadata columns.
    • Display format: This property specifies whether to display the entire hierarchy for the selected term. It is usually best to leave this value to the default setting, which only displays the term name, instead of the entire hierarchy, which can get lengthy and confusing for most scenarios.
    • Term Set Settings: This is where we will select the Term Set to associate with the column. Users will then be able to tag list items and documents with the terms from the selected Term Set. To select the desired Term Set, expand Taxonomy_ node to find the appropriate group. Then expand the group to view all the term sets in that group and select the Term Set:

    • Allow Fill-in: If your Term Set is an open Term Set, meaning it allows users to enter new values instead of just selecting existing ones, you can choose to disable or enable that feature specifically for your column.
    • Default Value: You can enter or select a default term for this column. Selecting such defaults is a good idea in some scenarios. As an example, if this column is being added for an HR site, it may be a good idea to select Human Resources as the default value for this column. That way, all items added to a list or library containing this column, will automatically get tagged by the Human Resources term. Contributors to your list will still be able to change the default values if there are exceptions to this rule.
  1. Click OK to create your new column with the preceding properties. After creating your column, SharePoint will take you to the Site Columns page and show the new column under the appropriate group, as shown in the following screenshot:

Congratulations! You just learned how to create a new Managed Metadata column and associate a Term Set with it.

How it works...

We discussed Site Columnsin theThere's more section of theAdding a column recipe in Chapter 4, Working with Lists and Libraries in SharePoint Online. TheManaged Metadatacolumn type is just like any other site column, except that it lets you connect the Term Store to associate a Term Set. Note thatManaged Metadatacolumns will almost always get created as site columns versus lists or library columns. This is because they connect to the Term Store, which contains enterprise metadata, versus something that would be used just once.

See also

  • The Adding a column recipe, Chapter 4, Working with Lists, Libraries in SharePoint Online
  • The Creating term sets and terms recipe in this chapter

Creating a content type and adding columns to it

In the most simple terms, a SharePoint content type is a collection of columns for items or files in a list or library. More specifically, a content type is a blueprint for the properties that get associated with a type of list item or file within the corresponding list or library, thus making the information more meaningful. A content type ties an item or file to its properties. Further, content types are reusable and therefore offer the ability to standardize the type of information that gets collected across multiple lists and/or libraries within your site.

In this recipe, we will see how to create a new content type for your site and add columns to it.

Getting ready

You will needDesignorFull Control permissions to the site where you would like to create the new content type.

How to do it...

To create a new content type, do the following:

  1. Browse to theSite Settingspage for the site, as described in theViewing and changing site
    settingsrecipe inChapter 3, Working with Modern Sites in SharePoint Online.
  2. Then clickSite content typesunder theWeb Designer Galleriesheading. This will take you to the Site content typesscreen.
  3. Click Create, as shown in the following screenshot,to be taken to the New Site content type screen:

  1. Here, we will enter the following properties for the content type being created:
    • Name: A descriptive name for the content type. This name will show up on the New menu for your list or library. We will use Contoso Document as the name of the content type for our example.
    • Description: Enter a description for this content type. This is just for your internal/tracking purposes and is not shown anywhere.
    • Group: It is recommended to place custom content types in a separate group. You can select an existing group or create a new one. We will create a new group called Contoso content types as an example.
  2. Click the OK button to create the new content type.
  3. You will now be taken to a screen that displays information for the newly created content type, as shown in the following screenshot:

`

  1. Notice the Columns section for this content type. Since this content type was created based on the Document site content type, it came with fields that let you edit the title of the uploaded documents. We will now add more columns to this content type.
  2. Click Add from existing site columns to be taken to the Add Columnsscreen.

Since we created our site column in the Creating a Managed Metadata site column recipe earlier in this chapter, we will click the Add from existing site columns link for our example. You will click Add from new site column instead to create a new site column.

  1. Select a group name from the Select columns from listto filter the column selection based on the group name or directly select columns from the Available columnslist. As an example, we will add the following custom columns that we created on our example site:
    • Contoso Department: This is aManaged Metadatacolumn containing a list of all the departments for the organization. We created this column as part of a prior recipe in this chapter.
    • Document Type: ThisManaged Metadatacolumn contains a list of the various types of documents across the organization. Some examples areCase Study, Product Overview, Campaign, and so on.
    • Product: This Managed Metadata column contains a list of all products across the organization.
    • Product Line: This Managed Metadata column contains a list of all the organization-wide product lines. Examples are Audio, Cameras, Gaming, and so on.
    • Document Purpose: ASingle line of text column to describe the purpose of the document.
    • Document Contact: APerson or Group column allowing the document author to select a point of contact for that document.
  2. Click Add >to move them to the Columns to addlist.
  1. You will receive the following warning if even one of the columns that you are adding to the content type is a Managed Metadata column:

This message is forOffice 2007or older versions of Microsoft Officeand is shown because those versions of the Office client applications do not have the ability to edit Managed Metadata columns. SinceOffice 2007and earlier versions have been out of support for a long time, it is very likely that you are using one of the newer versions. Even if you are using an older version, you can always edit these properties directly in SharePoint. Either way, you can click OKto acknowledge this message. As a reminder, we discussed editing document properties in client applications as part of the Viewing and editing documents in the browser recipe in Chapter 5, Document Management in SharePoint Online.

  1. Select Yes forUpdate List and Site Content Types. If you are editing a content type that is already being used in lists and/or libraries within your site, selecting this option will make sure that the new column is propagated to those lists and/or libraries.
The only time you might need to set this value to Nois if this content type was being used in existing lists or libraries and someone made direct changes to the list or library content type. That is not a good practice anyway and beats the whole purpose of maintaining information consistency by using content types. Changing this setting to Nowould mean that the new column(s) will not be propagated to existing lists or libraries and will only show up in new lists and libraries using this content type.
  1. Click OKto save your changes and add the columns to the content type. As shown in the following screenshot, you will now see the columns you've added in the list of columns against the content type:

Congratulations! You just learned how to create a new content type for your site and add columns to it.

How it works...

As you saw in this recipe, a content type creates a schema or specification for the type of content that will eventually get associated with it. It does this by letting you define a set of columns or metadata that go together with it. content types exist at the site level and get reused across the different lists and libraries within the site and its sub-sites. Also, we can only add site columns to a content type. Because of these reasons, content types help to ensure data consistency whenever they are used in the various lists and libraries on your sites. Any changes to the columns within a content type or to its properties get reflected in all places that the content type is used (unless otherwise is desired).

Content Type properties

We saw some basic properties of content types in the previous recipe. We will look at some additional properties in this section:

  • Advanced settings:
    • Document template: This is similar to the document templates that we saw in the Associating a document template recipe in Chapter 5, Document Management in SharePoint Online. Once you associate a document template with a Document content type, any new documents that get created in a library that uses this content type will follow the default structure and styling defined by this template. Please note that users can still directly upload other documents to the library instead of using the New menu to create them. It is not necessary then for those documents to use this template. Depending on the purpose of the Document content type, it may be a good idea to associate a document template with it.
    • Read Only: Setting this property value to Yes ensures that lists or libraries using the content type cannot freely change the columns or various properties when using the content type. Note that the list or library owners can still set this flag to No just for that list and/or library. That then gives them the ability to modify the content type for their list or library only. As a governance rule, you would typically want to set this value to Yes to help maintain consistency across all lists and libraries that use this content type.
    • Update Sites and Lists: This setting helps you control whether or not the changes you made on this screen should be propagated to the lists and libraries already using this content type. You will also see this setting on some of the other settings screens for the content type when making changes to it. For example, you will notice this setting in the add/edit column screens. You will typically want this flag set to Yes (which is the default). An example scenario, though, where you may want to set this flag to No is if you made a breaking change that could affect the existing lists and libraries that are already using this content type.
  • Document Information Panel settings:
    • Document Information Panel Template: When you open a SharePoint Online document using a client application, you can directly edit its properties within it using the Document Information Panel in Office 2013 or earlier versions and using the Document Properties Panel in Office 2016 and above. Older versions also let you customize this panel. This is, however, now deprecated in newer versions and we will therefore not discuss it in detail here.
    • Show Always: Selecting this property ensures that the Document Properties panel always shows when you open a document that uses this content type. This will also force the panel to show up if you save a new document within the library for the first time and when using the client app:

It is recommended to select this option so the users of your application can see and set those properties as desired.

  • Column order: This screen lets you specify the order of the columns when they show up in the details pane for the list or library item. This order will also be used when displaying the columns in the new/edit forms for the list or library item. The following screenshot shows the column order for the example content type and the corresponding columns as they show up in the Edit Properties form for a document:

There's more...

In this section, we will see how to edit a column that is part of a content type or how to completely remove it. We will then briefly look at some advanced concepts related to content type inheritance and publishing.

Editing or removing a column from a content type

For your content type, you can select whether or not a particular column is required or optional. To do so, simply click on the column name to go to the Change content type Column screen and then change the corresponding setting. When doing this, you can also select the appropriate option to specify whether you would like the setting change to be propagated to the existing lists or libraries using this content type:

This screen also lets you disassociate the column from this content type. You can click the Remove button toward the bottom of the screen to do so. Note that since columns within a site exist independent of the content types, removing the column from this content type will not delete it from the site.

Content Type inheritance

Just like in real life, where children inherit certain behaviors and traits from their parents, in the software world, the term "inheritance" is used as a way to define the parent-child relationships of software objects. The child object acquires and then adds on to the traits and properties that it inherits from its parent. In the world of SharePoint, this concept applies to content types.

As an example, let's say we create a content type calledContractfor the legal department. Also assume that this content type contains the following custom columns: ProductLine,Product,Company Contact, Contract Status, and Execution Date (optional). We could potentially have the following content types inheriting from it:

  • Sale Contract: This content type would potentially contain the following columns in addition to those in the parentContract content type: Sales Person, Client Name, Units, Sale Amount, and so on.
  • Vendor Contract: This content type would instead contain the following additional columns: Vendor Name, Part Id, Part Name, Quantity, and so on.

Both the Sale Contract and Vendor Contract content types would automatically inherit the columns that we defined earlier for the Contract content type. This lets us define the common columns and set various column properties only in one place (for the Contract content type), and then simply reuse them for one or more child content types. If it's required to add, change, or remove a common column, we make that change only in a single place and the change gets propagated to the children. This enables greater control, better governance, and the scalability of content types and the related information architecture for your sites.

Note that in SharePoint, you will always select one of the existing content types as a parent and never create a content type from scratch. The Contract custom content type that we used for our example would have inherited the built-in Document content type. The Document content type, in turn, inherits the built-in Item content type, as shown in the following screenshot:

The Item content type is the base content type for all practical purposes (although it inherits from a hidden System content type). These links discuss the content type hierarchy and, specifically, content type inheritance in greater detail:

Please note that even though these articles were written for SharePoint 2010, these concepts continue to apply to all modern versions of SharePoint.

Content type hub and content type publishing

As we saw earlier, content types exist at the Site level and are accessible to the underlying lists, libraries, and subsites within that site. Further, as mentioned in the There's more section of the Creating a modern Team Site recipe in Chapter 2, Introduction to SharePoint Online, all sites in SharePoint are part of one parent container site called a Site Collection. This means that the highest level where a content type can exist is at the root site or Site Collection level.

In a true enterprise scenario, however, you would want to be able to use content types across multiple site collections within the enterprise. This capability is accomplished in SharePoint using content type publishing and the content type hub. A content type syndication hub is a feature that can be enabled for any Site Collection. SharePoint Online, however, already has a specific site designated as the syndication hub. You can access this site by browsing to https://<yourtenant>.sharepoint.com/sites/contenttypehub.

When you create a content type in the designated hub, you see an additional link on the content type properties page, as shown in the following screenshot:

Clicking this link takes you to the content type Publishingpage, which lets you manage the publishing for this content type. As shown in the following screenshot, you will need to select the Publish button when you first create the content type:

Once you do that, your published content type is now ready for consumption in all other site collections in your organization's tenant. To make any published content types available for your site collection, you will need to do the following:

  1. Browse to the Site Settings page for that site collection.
  2. Click Content Type publishing under the Site Collection Administration heading to be taken to the Content Type Publishing Hubs page.
  3. Select the Refresh All Published Content Types option and click OK on this page.
  4. After some time, you will start to see, on the Site Content Types page of the subscriber site collection, the published content types along with the site columns that they contained.
The content types are pushedfrom the hubto the subscriber sites through timer jobs that run every few hours. You might, therefore, see a delay before the content types start appearing in your subscriber site collections.

You can read more about content type publishing at these links:

Content type publishing, coupled with site columns, provides a great way to ensure consistency and governance for the content in your organization's SharePoint environment. It is, therefore, highly recommended to consider this feature when planning your organization's information architecture and SharePoint implementation strategy.

See also

  • The Creating a new document recipe, in Chapter 5, Document Management in SharePoint Online
  • The Creating a Managed Metadata site column recipe earlier in this chapter
  • The Viewing and editing documents in the client recipe, in Chapter 5, Document Management in SharePoint Online
  • The Creating a modern Team Site recipe, in Chapter 2, Introduction to SharePoint Online

Adding a content type to a list or library

content types coupled with site columns drive consistency across the lists and libraries on your site. In the previous recipe, we saw how to create a content type and added site columns to it.

This recipe will show you how to associate the content type we created earlier to a library so that the content in the library adheres to the metadata requirements defined by the content type. Note that even though this recipe uses a library as an example, the concepts and outlined steps work equally well with lists.

Getting ready

You will need Edit, Design, or Full Control access to the library for which you would like to add the content type.

How to do it...

To add your content type to a library, do the following:

  1. Browse to the Library Settings page, as described in the Viewing and changing document library settings recipe in Chapter 5, Document Management in SharePoint Online.
  2. Click Advanced settings under the General Settings heading.
  3. Change the Allow management of Content Types? setting to Yesand click the OK button toward the bottom of the screen. Doing so will take you back to the library settings page.
  4. Scroll down to the Content Types section on this page and click the Add from existing site content types link, as shown in the following screenshot:

Like the preceding screenshot shows, the library already has a content type called Document associated with it. This is the default content type for document libraries. Every library that gets created uses the Document content type by default. Once we associate our new content type to the library, we will disassociate this default content type from it.
  1. Select the content type you would like to add from the Available Site Content Types list and click the Add > button to add it to the Content Types to add list, as shown in the following screenshot:

Since we are working with a library, the only content types that you will see in the Select site content types from list are the library content types. You will not see content types that derive from the Item base content type. Conversely, if you were working with a SharePoint list (instead of a library), you would only see content types that are based on the Item content type. We discussed content type inheritance in more detail in the Adding columns to a content type recipe, earlier in this chapter.
  1. Click the OK button toward the bottom of the screen to save your changes and be taken back to the library settings screen. You will now see the new content type in the list of content types for this library. Notice that the columns from our new content type also show up in the list of columns for this library. This is shown in the following screenshot:

  1. Now that we have added our content type, we will now remove the default Document content type from this library. To do so, simply click on the Document content type and then click Delete this content type from the next screen, as shown in the following screenshot:

  1. You should now see the new content type that we just added as the only one associated with your library.

Congratulations! You just configured your library to use a new content type.

How it works...

As you saw in this recipe, a content type groups a list item, or in this case, a document with its metadata. Every list or library in SharePoint has at least one content type associated with it by default. This default content type often varies depending on the type of list or library. For example, as we saw in this recipe, the Document content type is the default content type for a SharePoint document library. On the other hand, the Announcementslist in SharePoint has theAnnouncementcontent type as its default. This means that any time you create an item in a list or a document in a library, you are actually associating that item with the columns defined by that default content type.

You can associate more than one content type with a list or library. We will discuss this next.

Multiple content types

SharePoint lets you associate multiple content types with your list or library. For such libraries, users will need to consciously choose the content type that they would like to associate with the item being created. A classic example of such a scenario is the Site Pages library. You will notice the following content types if you browse to the settings page of a Site Pages library:

Now if you go back to a view in the library, and if you have permission to add items to this library, you will notice that clicking the New menu option enables you to create items from one of these content types:

Also, you will notice in the earlier screenshot that Wiki Page is selected as the Default content type for the library. This setting is not as relevant for the Site Page library since it does not let you upload files, but for any other document library, uploading a document to it automatically associates the document with the selected default content type, and will prompt you to enter the necessary metadata for that content type. You can then change the content type through the details pane for that library. Note that changing the content type associated with the item will also mean that you will now need to enter information for the newly selected content type.

Multiple content types sometimes make it difficult to work with lists and libraries, especially for the not so savvy end user. It is therefore not recommended to use this option too frequently. If you have a need for two different content types, you are almost always better off creating separate lists or libraries that contain items for the separate content types.

There's more...

SharePoint enables you to interface with a variety of external systems and read from or write to these systems using the familiar list interface.

External content type and external list

The first step toward achieving this is to create an external content typeto connect to the external data source. You would then create anexternal list and associate theexternal content typewith it to be able to interact with this external data.

A more detailed discussion of this topic is beyond the scope of this book but here are a few links that can help you understand the capability in more detail:

Please note, however, that the methods to create external content types described in these links are now somewhat deprecated. It is recommended to use some of the newer tools (such as PowerApps, Power Automate, and Power BI) from the Microsoft 365 ecosystem to address such scenarios that require interaction with external data. We extensively discuss these tools and apps in subsequent chapters of this book.

See also

  • The Viewing and changing list settings recipe in Chapter 4, Working with Lists, Libraries in SharePoint Online
  • The Viewing and changing document library settings recipe in Chapter 5, Document Management in SharePoint Online
  • Chapter 13, Power Automate (Microsoft Flow)
  • Chapter 14, PowerApps
  • Chapter 15, Power BI

Tagging a document

We have seen two different ways of adding columns to a library so far:

  • Adding a column recipe in Chapter 4, Working with Lists, Libraries in SharePoint Online, showed you how to directly add columns to lists and libraries.
  • Adding a content type to a list or library recipe, earlier in this chapter showed you how to associate content types with a library, thereby also associating the corresponding columns from such content types.

Adding a Managed Metadata column to a list or library is just like adding any other column type in SharePoint. Once you have added Managed Metadata columns to a library, you can tag documents with the terms from those columns. The steps to do this are no different than carrying out similar steps for other column types in SharePoint.

This recipe will show you specifically how to tag your documents with terms from Managed Metadata columns. Note that the steps for updating items in lists containing the Managed Metadata columns are also going to be the same. For the purposes of illustration in this recipe, we will use the Contoso Department column that we created earlier.

Getting ready

You will need Contribute access or higher to the corresponding list or library.

How to do it...

Follow these steps to tag a document with terms from the Managed Metadata columns in your library:

  1. Select the row containing the document by clicking anywhere on it.
  2. Click the information icon in the right-hand corner of the library menu to open the details pane, as shown in the following screenshot:

  1. You can now edit the properties directly in this pane or click Edit all in the Properties section to edit the properties in an expanded view.
  1. Click within one of the Managed Metadata fields and start typing a value for that field. SharePoint will autocomplete it for you with the term name if it finds a match. This is shown in the following screenshot:

  1. Next, we will click inside another (Document Type) Managed Metadata field. This time, however, we will click the tag image next to the field:

  1. This opens a dialog for you to select your term.
  2. Here, you can select the appropriate term by first clicking the term, then theSelect > >button, and then OK, as shown in steps 1 through 3 in the following screenshot:

  1. You can then similarly enter or select the rest of the properties for the document and then click the Save button:

  1. This will update the document with the selected or entered properties, including any metadata tags that you may have applied. Depending on how the view for the library is configured, you will now see these properties as part of the view columns for the document, as shown in the following screenshot:

Congratulations – you just learned how to tag your documents with Managed Metadata by using terms that were created as a standard across the enterprise.

How it works...

Entering information in Managed Metadata columns is quite similar to entering or selecting information in some of the other column types. The one big difference for the Managed Metadata columns is that instead of entering or selecting information that is just used one time, you would typically enter or select terms that are maintained at the enterprise level. Just doing this opens up various additional scenarios. One of the biggest benefits of doing this is the ability to use SharePoint search to pull information globally from across multiple sites. To illustrate the point, let's refer to the document we just tagged in this recipe. We are going to see how tagging it with a particular product helps users easily search for it. Let's assume a user is looking for marketing campaigns related to the "Action Camera 1000s" Product.

The following is the result set that SharePoint brings back if I just search for the word campaigns:

However, since we tagged our campaign document with the appropriate product, users will be able to significantly narrow down the search to get to what they were looking for just by typing the name of the product against the search term. The following is the result set that SharePoint returns if they search for the following term (which includes the product name in the search) – campaigns Action camera 1000s:

As you can see, just the fact that we tagged the document with the product name helped us considerably narrow down the search results from potentially hundreds of documents to exactly what we were looking for.

Planning information architecture and the content structure along with the correct governance policies goes a long way in making sure that users can quickly get to what they are looking for. In the preceding example, we not only created the required term sets and corresponding Managed Metadata columns but also enforced the selection of the appropriate tags by marking these columns as required within our content type.

In addition to improved search, using Managed Metadata columns for the content in your library also enables you to set up better-organized information in it. The use of Managed Metadata columns enables you to use them to better filter, sort, and group information in your lists or libraries. The following screenshot shows how the library view was changed to show documents grouped by the Document TypeManaged Metadata field that was previously created for our example:

See also

  • The Adding a column recipe in Chapter 4, Working with Lists, Libraries in SharePoint Online
  • Chapter 8, Search in Microsoft 365
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset