Skip to content

Commit cbf564e

Browse files
000-866: ct get
1 parent 0e555bc commit cbf564e

File tree

12 files changed

+305
-665
lines changed

12 files changed

+305
-665
lines changed

_includes/google-analytics.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@
55
>
66
</script>
77

8+
9+
10+

articles/en/SharePointOnline/ctget.md

Lines changed: 0 additions & 664 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
layout: page
3+
title: 'How to create SharePoint content type'
4+
hero_image: '/img/IMG_20220521_140146.jpg'
5+
show_sidebar: false
6+
hero_height: is-small
7+
date: '2025-03-22'
8+
---
9+
10+
11+
A content type can be a form, a document template you want to use to gather information. Behind the scenes, a content type in SharePoint is a reusable collection of metadata (columns), workflows, and behavior settings for items in a list or library. Here is a step-by-step guide to create a content type in SharePoint Online.
12+
13+
14+
# List or Library
15+
16+
17+
18+
19+
20+
21+
22+
23+
24+
25+
26+
27+
28+
29+
30+
31+
32+
33+
# Site
34+
35+
To create a content type that will be available for all lists and libraries in your site collection, navigate to **Site Settings** and select **Content Types**
36+
37+
38+
39+
40+
41+
42+
43+

articles/en/new.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,19 @@ Copilot Dashboard
2121
Copilot Dashboard Auto Enablement
2222
Copilot Dashboard Delegation
2323
Copilot Assisted Value
24-
Copilot in Microsoft Viva Insights
24+
Copilot in Microsoft Viva Insights
25+
26+
27+
28+
29+
externe fonts entfernen
30+
31+
32+
Images outside the critical viewport can be lazy-loaded.
33+
When images are lazy-loaded using loading="lazy", when they scroll into the viewport, freeing up early load for other tasks.
34+
35+
/articles/images/easycaml1.png
36+
/articles/images/easycaml2.png
37+
/articles/images/easycaml3.png
38+
/articles/images/easycaml4.png
39+
/articles/images/easycaml5.png

articles/en/spo/ctget.md

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
---
2+
layout: page
3+
title: 'List SharePoint content types'
4+
hero_image: '/img/IMG_20220521_140146.jpg'
5+
show_sidebar: false
6+
hero_height: is-small
7+
date: '2025-03-15'
8+
---
9+
10+
11+
12+
# What is a content type?
13+
14+
A Content Type in SharePoint is a reusable collection of metadata, templates, and settings that define the structure and behavior of a specific type of content across a site or library. It allows organizations to standardize and manage information consistently. For example, a "Contract" content type might include specific metadata fields like "Contract Number," "Expiration Date," and "Client Name," along with a document template. By associating content types with lists or libraries, users can easily create and manage content that aligns with organizational standards, improving consistency, compliance, and searchability. Content types are foundational for building efficient information architectures in SharePoint.
15+
16+
17+
<img src="/articles/img/ctget1.PNG" width="600">
18+
19+
20+
This article shows you how to get all or selected content types that you have in your list or your SharePoint site.
21+
22+
# List or Library
23+
24+
25+
## User Interface - Browser
26+
27+
Navigate to Library or List Settings. There you will see Content Types available for this library or list. If the Content Types section is completely missing from your view, make sure to [enable content type management](https://powershellscripts.github.io/articles/en/spo/enablect/) first.
28+
29+
30+
<img src="/articles/img/ctget2.PNG" width="600">
31+
32+
33+
<br/><br/>
34+
35+
## PnP Powershell - Get all content types
36+
37+
```powershell
38+
39+
# Import the PnP PowerShell module
40+
Import-Module PnP.PowerShell
41+
42+
# Connect to the SharePoint site
43+
$SiteUrl = "https://yourtenant.sharepoint.com/sites/yoursite"
44+
Connect-PnPOnline -Url $SiteUrl -Interactive
45+
46+
# Specify the list name
47+
$ListName = "YourListName"
48+
49+
# Get the list
50+
$List = Get-PnPList -Identity $ListName
51+
52+
# Get all content types associated with the list
53+
$ContentTypes = Get-PnPContentType -List $List
54+
55+
# Display content types
56+
$ContentTypes | ForEach-Object {
57+
Write-Output "Content Type Name: $($_.Name)"
58+
Write-Output "Content Type ID: $($_.Id.StringValue)"
59+
Write-Output "------------------------------"
60+
}
61+
62+
# Disconnect from the site
63+
Disconnect-PnPOnline
64+
65+
```
66+
67+
<br/>
68+
69+
70+
## PnP Powershell - Get a content type by id
71+
72+
```powershell
73+
74+
# Import the PnP PowerShell module
75+
Import-Module PnP.PowerShell
76+
77+
# Connect to the SharePoint site
78+
$SiteUrl = "https://yourtenant.sharepoint.com/sites/yoursite"
79+
Connect-PnPOnline -Url $SiteUrl -Interactive
80+
81+
# Specify the content type ID
82+
$ContentTypeId = "0x0101001234567890ABCDEF1234567890ABCDEF" # Replace with your Content Type ID
83+
84+
# Get the content type by ID
85+
$ContentType = Get-PnPContentType | Where-Object { $_.Id.StringValue -eq $ContentTypeId }
86+
87+
# Check if content type is found
88+
if ($ContentType) {
89+
Write-Output "Content Type Found:"
90+
Write-Output "Name: $($ContentType.Name)"
91+
Write-Output "ID: $($ContentType.Id.StringValue)"
92+
} else {
93+
Write-Output "Content Type with ID $ContentTypeId not found."
94+
}
95+
96+
# Disconnect from the site
97+
Disconnect-PnPOnline
98+
99+
```
100+
101+
<br/>
102+
103+
## PnP Powershell - Get a content type by name
104+
105+
106+
```powershell
107+
108+
# Import the PnP PowerShell module
109+
Import-Module PnP.PowerShell
110+
111+
# Connect to the SharePoint site
112+
$SiteUrl = "https://yourtenant.sharepoint.com/sites/yoursite"
113+
Connect-PnPOnline -Url $SiteUrl -Interactive
114+
115+
# Specify the content type name
116+
$ContentTypeName = "Your Content Type Name" # Replace with the name of your content type
117+
118+
# Get the content type by name
119+
$ContentType = Get-PnPContentType | Where-Object { $_.Name -eq $ContentTypeName }
120+
121+
# Check if content type is found
122+
if ($ContentType) {
123+
Write-Output "Content Type Found:"
124+
Write-Output "Name: $($ContentType.Name)"
125+
Write-Output "ID: $($ContentType.Id.StringValue)"
126+
} else {
127+
Write-Output "Content Type with name '$ContentTypeName' not found."
128+
}
129+
130+
# Disconnect from the site
131+
Disconnect-PnPOnline
132+
133+
134+
```
135+
136+
<br/><br/>
137+
138+
139+
# Site
140+
141+
142+
## User Interface (Browser)
143+
144+
Navigate to Site Settings.
145+
146+
<img src="/articles/img/ctget3.PNG" width="600">
147+
148+
Open the Site Settings and under Web Designer Galleries you will find a link to a list of your site content types.
149+
150+
151+
<img src="/articles/img/ctget4.PNG" width="600">
152+
153+
154+
<br/><br/>
155+
156+
## PnP Powershell - Get all content types
157+
158+
159+
```powershell
160+
161+
# Import the PnP PowerShell module
162+
Import-Module PnP.PowerShell
163+
164+
# Connect to the SharePoint site
165+
$SiteUrl = "https://yourtenant.sharepoint.com/sites/yoursite"
166+
Connect-PnPOnline -Url $SiteUrl -Interactive
167+
168+
# Get all content types from the site
169+
$ContentTypes = Get-PnPContentType
170+
171+
# Display all content types
172+
$ContentTypes | ForEach-Object {
173+
Write-Output "Name: $($_.Name)"
174+
Write-Output "ID: $($_.Id.StringValue)"
175+
Write-Output "Description: $($_.Description)"
176+
Write-Output "------------------------------"
177+
}
178+
179+
# Disconnect from the site
180+
Disconnect-PnPOnline
181+
182+
```
183+
184+
<br/>
185+
186+
187+
## CSOM - Get a content type by id
188+
189+
```powershell
190+
191+
# Load the SharePoint CSOM Assemblies
192+
Add-Type -Path "C:\Path\To\Microsoft.SharePoint.Client.dll"
193+
Add-Type -Path "C:\Path\To\Microsoft.SharePoint.Client.Runtime.dll"
194+
195+
# Define credentials
196+
$SiteUrl = "https://yourtenant.sharepoint.com/sites/yoursite"
197+
$Username = "[email protected]"
198+
$Password = "yourpassword"
199+
$SecurePassword = ConvertTo-SecureString $Password -AsPlainText -Force
200+
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $SecurePassword)
201+
202+
# Create the ClientContext
203+
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
204+
$Context.Credentials = $Credentials
205+
206+
# Specify the Content Type ID
207+
$ContentTypeId = "0x0101001234567890ABCDEF1234567890ABCDEF" # Replace with your Content Type ID
208+
209+
# Get the Content Type by ID
210+
$ContentType = $Context.Web.ContentTypes.GetById($ContentTypeId)
211+
$Context.Load($ContentType)
212+
$Context.ExecuteQuery()
213+
214+
# Check if the Content Type was found and display its details
215+
if ($ContentType -ne $null) {
216+
Write-Output "Content Type Found:"
217+
Write-Output "Name: $($ContentType.Name)"
218+
Write-Output "ID: $($ContentType.Id.StringValue)"
219+
Write-Output "Description: $($ContentType.Description)"
220+
} else {
221+
Write-Output "Content Type with ID $ContentTypeId not found."
222+
}
223+
224+
```
225+
226+
<br/>
227+
<br/>
228+
229+
# See Also
230+
231+
[Enable content type management](https://powershellscripts.github.io/articles/en/spo/enablect/)
232+
233+
[Add content type using Powershell and CSOM](https://powershellscripts.github.io/articles/en/SharePointOnline/Add%20content%20type/)
234+
235+
236+
[Find content type ID](https://powershellscripts.github.io/articles/en/SharePointOnline/findctid/)

articles/img/ctcreate0.png

41.1 KB
Loading

articles/img/ctcreate1.png

110 KB
Loading

articles/img/ctget1.png

48.8 KB
Loading

articles/img/ctget2.png

32.1 KB
Loading

articles/img/ctget3.png

11.1 KB
Loading

articles/img/ctget4.png

49 KB
Loading

index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ Welcome to Tips and Tricks on SharePoint, Power Platform and other Microsoft 365
121121
<ol style="--length: 5" role="list">
122122

123123

124+
<li style="--i: 12"><a href="https://powershellscripts.github.io/articles/en/spo/ctget/">
125+
<span style="display: block; text-align: right;">2025-03-15
126+
<h3>List SharePoint content types</h3></span>
127+
<p>This article shows you how to get all or selected content types that you have in your list or your SharePoint site.</p>
128+
</a></li>
129+
130+
124131
<li style="--i: 9"><a href="https://powershellscripts.github.io/articles/en/copilot/unpincopilotchat/">
125132
<span style="display: block; text-align: right;">2025-03-08
126133
<h3>How to unpin Copilot chat?</h3></span>

0 commit comments

Comments
 (0)