Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fd1a905

Browse files
authoredAug 7, 2024
(MicrosoftDocsGH-11321) Add examples for DefaultDisplayProperty (MicrosoftDocs#11322)
Prior to this change, the documentation didn't include examples of defining the default display property in a `Types.ps1xml` file or with the `Update-TypeData` cmdlet. This change: - Adds a new example to the `Update-TypeData` cmdlet showing how a user can define a script property and set it as the default display property in a single command. - Updates existing examples for line length and readability. - Updates the example showing **PSStandardMembers** in `about_Types.ps1xml` to include a default display property. - Fixes AB#294774 - Resolves MicrosoftDocs#11321
1 parent fce5e8d commit fd1a905

File tree

8 files changed

+904
-192
lines changed

8 files changed

+904
-192
lines changed
 

‎reference/5.1/Microsoft.PowerShell.Core/About/about_Types.ps1xml.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Explains how to use `Types.ps1xml` files to extend the types of objects that are used in PowerShell.
33
Locale: en-US
4-
ms.date: 04/30/2021
4+
ms.date: 08/07/2024
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_types.ps1xml?view=powershell-5.1&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Types.ps1xml
@@ -357,8 +357,9 @@ following:
357357
For example, the following XML defines the default display of services
358358
(`System.ServiceProcess.ServiceController` objects) that are returned by the
359359
`Get-Service` cmdlet. It defines a member set named **PsStandardMembers** that
360-
consists of a default property set with the **Status**, **Name**, and
361-
**DisplayName** properties.
360+
consists of a default property set and a default display property. It defines
361+
the default property set as the **Status**, **Name**, and **DisplayName**
362+
properties. It defines the default display property as **Name**.
362363

363364
```xml
364365
<Type>
@@ -375,6 +376,10 @@ consists of a default property set with the **Status**, **Name**, and
375376
<Name>DisplayName</Name>
376377
</ReferencedProperties>
377378
</PropertySet>
379+
<NoteProperty>
380+
<Name>DefaultDisplayProperty</Name>
381+
<Value>Name</Value>
382+
</NoteProperty>
378383
</Members>
379384
</MemberSet>
380385
</Members>

‎reference/5.1/Microsoft.PowerShell.Utility/Update-TypeData.md

Lines changed: 212 additions & 45 deletions
Large diffs are not rendered by default.

‎reference/7.2/Microsoft.PowerShell.Core/About/about_Types.ps1xml.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Explains how to use `Types.ps1xml` files to extend the types of objects that are used in PowerShell.
33
Locale: en-US
4-
ms.date: 04/30/2021
4+
ms.date: 08/07/2024
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_types.ps1xml?view=powershell-7.2&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Types.ps1xml
@@ -358,8 +358,9 @@ following:
358358
For example, the following XML defines the default display of services
359359
(`System.ServiceProcess.ServiceController` objects) that are returned by the
360360
`Get-Service` cmdlet. It defines a member set named **PsStandardMembers** that
361-
consists of a default property set with the **Status**, **Name**, and
362-
**DisplayName** properties.
361+
consists of a default property set and a default display property. It defines
362+
the default property set as the **Status**, **Name**, and **DisplayName**
363+
properties. It defines the default display property as **Name**.
363364

364365
```xml
365366
<Type>
@@ -376,6 +377,10 @@ consists of a default property set with the **Status**, **Name**, and
376377
<Name>DisplayName</Name>
377378
</ReferencedProperties>
378379
</PropertySet>
380+
<NoteProperty>
381+
<Name>DefaultDisplayProperty</Name>
382+
<Value>Name</Value>
383+
</NoteProperty>
379384
</Members>
380385
</MemberSet>
381386
</Members>

‎reference/7.2/Microsoft.PowerShell.Utility/Update-TypeData.md

Lines changed: 220 additions & 45 deletions
Large diffs are not rendered by default.

‎reference/7.4/Microsoft.PowerShell.Core/About/about_Types.ps1xml.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Explains how to use `Types.ps1xml` files to extend the types of objects that are used in PowerShell.
33
Locale: en-US
4-
ms.date: 04/30/2021
4+
ms.date: 08/07/2024
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_types.ps1xml?view=powershell-7.4&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Types.ps1xml
@@ -358,8 +358,9 @@ following:
358358
For example, the following XML defines the default display of services
359359
(`System.ServiceProcess.ServiceController` objects) that are returned by the
360360
`Get-Service` cmdlet. It defines a member set named **PsStandardMembers** that
361-
consists of a default property set with the **Status**, **Name**, and
362-
**DisplayName** properties.
361+
consists of a default property set and a default display property. It defines
362+
the default property set as the **Status**, **Name**, and **DisplayName**
363+
properties. It defines the default display property as **Name**.
363364

364365
```xml
365366
<Type>
@@ -376,6 +377,10 @@ consists of a default property set with the **Status**, **Name**, and
376377
<Name>DisplayName</Name>
377378
</ReferencedProperties>
378379
</PropertySet>
380+
<NoteProperty>
381+
<Name>DefaultDisplayProperty</Name>
382+
<Value>Name</Value>
383+
</NoteProperty>
379384
</Members>
380385
</MemberSet>
381386
</Members>

‎reference/7.4/Microsoft.PowerShell.Utility/Update-TypeData.md

Lines changed: 220 additions & 45 deletions
Large diffs are not rendered by default.

‎reference/7.5/Microsoft.PowerShell.Core/About/about_Types.ps1xml.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Explains how to use `Types.ps1xml` files to extend the types of objects that are used in PowerShell.
33
Locale: en-US
4-
ms.date: 04/30/2021
4+
ms.date: 08/07/2024
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_types.ps1xml?view=powershell-7.5&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Types.ps1xml
@@ -358,8 +358,9 @@ following:
358358
For example, the following XML defines the default display of services
359359
(`System.ServiceProcess.ServiceController` objects) that are returned by the
360360
`Get-Service` cmdlet. It defines a member set named **PsStandardMembers** that
361-
consists of a default property set with the **Status**, **Name**, and
362-
**DisplayName** properties.
361+
consists of a default property set and a default display property. It defines
362+
the default property set as the **Status**, **Name**, and **DisplayName**
363+
properties. It defines the default display property as **Name**.
363364

364365
```xml
365366
<Type>
@@ -376,6 +377,10 @@ consists of a default property set with the **Status**, **Name**, and
376377
<Name>DisplayName</Name>
377378
</ReferencedProperties>
378379
</PropertySet>
380+
<NoteProperty>
381+
<Name>DefaultDisplayProperty</Name>
382+
<Value>Name</Value>
383+
</NoteProperty>
379384
</Members>
380385
</MemberSet>
381386
</Members>

‎reference/7.5/Microsoft.PowerShell.Utility/Update-TypeData.md

Lines changed: 220 additions & 45 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.