sharepoint content types - meetupfiles.meetup.com › 19493949 › sharepoint content types.pdf ·...

20
SharePoint Content Types Evansville SharePoint User Group Carrie Rudolph March 17, 2016

Upload: others

Post on 05-Jul-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

  • SharePoint Content Types

    Evansville SharePoint User Group

    Carrie Rudolph

    March 17, 2016

  • Summary

    � What is a Content Type?

    � What is Site Column?

    � Content Type Creation via User Interface

    � Content Type Creation via PowerShell

    � Designing Content Types

    � Updating Content Types

    � Use Cases

  • What is a Content Type?

    � Reusable collection of metadata (columns), workflow, behavior, and other settings for a category of items or documents in a Microsoft SharePoint list or document library

    � Enable you to manage the settings for a category of information in a centralized, reusable way.

    � Available in all versions of SharePoint

    � A site content type becomes available to lists and document libraries within the site on which the content type is created, and also to lists and document libraries in any child site.

  • Encapsulate Data Requirements

    Content Types can include:

    � The metadata, or properties, you want to assign to this type. These are represented by site columns added to the list or document library when you add the content type.

    � Custom New, Edit, and Display forms to use with this content type.

    � Workflows available for items of this content type. These can be defined to start automatically based on a selected event or condition, or through user selection.

    � For document content types, the document template on which to base documents of this type.

    � Any information necessary for custom solutions that are associated with this content type. You can store this information in the content type as one or more XML documents.

    Source: https://msdn.microsoft.com/en-us/library/ms472236.aspx

  • Examples

  • Site Columns

    � Reusable column definition, or template, that you can

    assign to multiple lists across multiple SharePoint sites.

    Site columns decrease re-work and help you ensure

    consistency of metadata across sites and lists.

    � When you create a site column on a site, that site column

    also becomes available to any child sites, and thereby, the

    lists on those sites.

  • Content Type Creation

    You can create site columns and content types in three ways:

    � Using the SharePoint user interface.

    � Using the SharePoint object model.

    � Deploying a Feature that installs the content type based on

    an XML definition file.

    Source: https://msdn.microsoft.com/en-us/library/ms472236.aspx

  • Content Type Setup

    �Create Content Type

    �Create Site Columns

    �Add Site Columns to Content Type

    �Add Content Type to list or libraries

  • Create a New Content Type

  • Enable Managements of Content Types

    on List/Library

  • Adding a Content Type -- PowerShell

    # Determine available Content Types Parents and add new Content Types

    $Web.AvailableContentTypes | Select Name

    $parent = $Web.AvailableContentTypes["$($_.'ParentContentType')"]

    $contentType = New-Object Microsoft.SharePoint.SPContentType

    -ArgumentList @($parent,$Web.ContentTypes,"$($_.'NewContentType')")

    $contentType.Group = "$($_.'Group')"

    $contentType.Description = "$($_.'Description')"

    $Web.ContentTypes.Add($contentType) $Web.Update()

  • Add Site Column -- PowerShell#Assign fieldXMLString variable with field XML for site column$fieldXMLString = '

  • Add Site Column to Content Type-PowerShell

    $field = $web.Fields[$fieldName]

    $ct = $web.ContentTypes[$contentTypeName]

    $link = new-object Microsoft.SharePoint.SPFieldLink

    $field $ct.FieldLinks.Add($link)

    $ct.Update($true)

  • Designing Content Types

    � Scope. Where in the site hierarchy do you want the

    content type to become available?

    � Parent. Which existing content type that is in scope will

    you choose to derive your content type from?

    � Columns. Which existing site columns are available for

    you to use?

    � Other Resources. Will the content type require language

    resources? Document templates? Forms?

  • Updating Content Types

    � Approach 1: Make the necessary changes to the content type, and then push

    down those changes to all child content types.

    � This approach works best if you must make targeted, discrete changes to a content

    type that is in use.

    � Each content type contains a reference to the site content type on which it is

    based. This enables SharePoint Foundation to propagate, or push down, changes

    that are made to a parent content type to its child site and list content types.

    When you make changes to a site content type, you can choose to push down those

    changes to all of its child content types.

    � Approach 2: Create a new content type with the necessary changes, deploy it

    wherever the previous content type exists, and then add the previous content

    type to the _Hidden content type group.

    � This approach works best if you want to replace a content type that is currently in

    use with a revised content type, but still retain the current content type for items

    that are already assigned that content type.

  • Updating Content Type Prompt