Skip to content

Commit

Permalink
Merge pull request #4548 from wilecoyotegenius/profile-card-properties
Browse files Browse the repository at this point in the history
Add cmdlets to control profile card properties
  • Loading branch information
KoenZomers authored Nov 19, 2024
2 parents 5b34163 + 87c4aee commit ed76592
Show file tree
Hide file tree
Showing 10 changed files with 537 additions and 0 deletions.
91 changes: 91 additions & 0 deletions documentation/Get-PnPProfileCardProperty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPProfileCardProperty.html
external help file: PnP.PowerShell.dll-Help.xml
title: Get-PnPProfileCardProperty
---

# Get-PnPProfileCardProperty

## SYNOPSIS

**Required Permissions**

* Microsoft Graph API : One of PeopleSettings.Read.All, PeopleSettings.ReadWrite.All

Retrieves custom properties added to user profile cards

## SYNTAX

```powershell
Get-PnPProfileCardProperty [-PropertyName <ProfileCardPropertyName>] [-Verbose] [-Connection <PnPConnection>]
```

## DESCRIPTION

This cmdlet may be used to retrieve custom properties added to user profile card.

## EXAMPLES

### EXAMPLE 1
```powershell
Get-PnPProfileCardProperty
```

This will retrieve all custom properties added to user profile card.

### EXAMPLE 2
```powershell
Get-PnPProfileCardProperty -PropertyName "pnppowershell"
```

This will return information about the specified property added to a profile card.

## PARAMETERS

### -Connection
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing [Get-PnPConnection](Get-PnPConnection.md).

```yaml
Type: PnPConnection
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Identity
Name of the property to be retrieved. If not provided, all properties will be returned.
```yaml
Type: Commands.Enums.ProfileCardPropertyName
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Verbose
When provided, additional debug statements will be shown while executing the cmdlet.
```yaml
Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## RELATED LINKS
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
[Microsoft Graph documentation](https://learn.microsoft.com/en-us/graph/add-properties-profilecard)
116 changes: 116 additions & 0 deletions documentation/New-PnpProfileCardProperty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/New-PnpProfileCardProperty.html
external help file: PnP.PowerShell.dll-Help.xml
title: New-PnpProfileCardProperty
---

# New-PnpProfileCardProperty

## SYNOPSIS

**Required Permissions**

* Microsoft Graph API : PeopleSettings.ReadWrite.All

Adds a property to user profile card

## SYNTAX

```powershell
New-PnpProfileCardProperty -PropertyName <ProfileCardPropertyName> -DisplayName <String> [-Localizations <Hashtable>] [-Verbose] [-Connection <PnPConnection>]
```
## DESCRIPTION

This cmdlet may be used to add a property to user profile card. Please note that it may take up to 24 hours to reflect the changes.

## EXAMPLES

### EXAMPLE 1
```powershell
New-PnpProfileCardProperty -PropertyName CustomAttribute1 -DisplayName "Cost Centre"
```

This cmdlet will add a property with a display name to user profile card.

### EXAMPLE 2
```powershell
$localizations = @{ "pl" = "Centrum kosztów"; "de" = "Kostenstelle" }
New-PnpProfileCardProperty -PropertyName CustomAttribute1 -DisplayName "Cost Centre" -Localizations $localizations
```

This cmdlet will add a property with a display name and specified localizations to user profile card.

## PARAMETERS

### -Connection
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing [Get-PnPConnection](Get-PnPConnection.md).

```yaml
Type: PnPConnection
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -PropertyName
Name of a property to be added
```yaml
Type: Commands.Enums.ProfileCardPropertyName
Parameter Sets: (All)
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -DisplayName
The display name of the property.
```yaml
Type: String
Parameter Sets: (All)
Required: True
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Localizations
List of display name localizations
```yaml
Type: Hashtable
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Verbose
When provided, additional debug statements will be shown while executing the cmdlet.
```yaml
Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## RELATED LINKS
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
[Microsoft Graph documentation](https://learn.microsoft.com/en-us/graph/add-properties-profilecard)
84 changes: 84 additions & 0 deletions documentation/Remove-PnPProfileCardProperty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/Remove-PnPProfileCardProperty.html
external help file: PnP.PowerShell.dll-Help.xml
title: Remove-PnPProfileCardProperty
---

# Remove-PnPProfileCardProperty

## SYNOPSIS

**Required Permissions**

* Microsoft Graph API : PeopleSettings.ReadWrite.All

Removes a specific property from user profile card

## SYNTAX

```powershell
Remove-PnPProfileCardProperty -PropertyName <ProfileCardPropertyName> [-Verbose] [-Connection <PnPConnection>]
```

## DESCRIPTION

This cmdlet can be used to remove a property from user profile card

## EXAMPLES

### EXAMPLE 1
```powershell
Remove-PnPProfileCardProperty -PropertyName CustomAttribute1
```

This will remove the connection to the external datasource with the specified identity from Microsoft Search.

## PARAMETERS

### -Connection
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing [Get-PnPConnection](Get-PnPConnection.md).

```yaml
Type: PnPConnection
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Identity
Unique identifier or an instance of the external connection in Microsoft Search that needs to be removed.
```yaml
Type: SearchExternalConnectionPipeBind
Parameter Sets: (All)
Required: True
Position: Named
Default value: None
Accept pipeline input: True
Accept wildcard characters: False
```
### -Verbose
When provided, additional debug statements will be shown while executing the cmdlet.
```yaml
Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## RELATED LINKS
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
[Microsoft Graph documentation](https://learn.microsoft.com/en-us/graph/add-properties-profilecard)
31 changes: 31 additions & 0 deletions src/Commands/Enums/ProfileCardPropertyName.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace PnP.PowerShell.Commands.Enums
{
/// <summary>
/// Custom properties available for customization on profile card
/// </summary>
/// <remarks>Documented at https://learn.microsoft.com/en-us/graph/add-properties-profilecard </remarks>
public enum ProfileCardPropertyName
{
CustomAttribute1,
CustomAttribute2,
CustomAttribute3,
CustomAttribute4,
CustomAttribute5,
CustomAttribute6,
CustomAttribute7,
CustomAttribute8,
CustomAttribute9,
CustomAttribute10,
CustomAttribute12,
CustomAttribute11,
CustomAttribute13,
CustomAttribute14,
CustomAttribute15,
UserPrincipalName,
FaxNumber,
StreetAddress,
PostalCode,
State,
MailNickname
}
}
25 changes: 25 additions & 0 deletions src/Commands/Model/Graph/ProfileCard/ProfileCardProperty.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using PnP.PowerShell.Commands.Enums;

namespace PnP.PowerShell.Commands.Model.Graph.ProfileCard
{
/// <summary>
/// Contains a profile card property information
/// </summary>
/// <remarks>See https://learn.microsoft.com/en-us/graph/api/resources/profilecardproperty</remarks>
public class ProfileCardProperty
{
/// <summary>
/// Directory property name
/// </summary>
[JsonPropertyName("directoryPropertyName")]
public string DirectoryPropertyName { get; set; }

/// <summary>
/// Annotations
/// </summary>
[JsonPropertyName("annotations")]
public List<ProfileCardPropertyAnnotation> Annotations { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using PnP.PowerShell.Commands.Enums;

namespace PnP.PowerShell.Commands.Model.Graph.ProfileCard
{
/// <summary>
/// Contains a profile card property annotation
/// </summary>
/// <remarks>See https://learn.microsoft.com/en-us/graph/api/resources/profilecardannotation</remarks>
public class ProfileCardPropertyAnnotation
{
/// <summary>
/// Unique identifier for the message
/// </summary>
[JsonPropertyName("displayName")]
public string DisplayName { get; set; }

/// <summary>
/// The To: recipients for the message
/// </summary>
[JsonPropertyName("localizations")]
public List<ProfileCardPropertyLocalization> Localizations { get; set; }
}
}
Loading

0 comments on commit ed76592

Please sign in to comment.