Skip to content

Commit ed76592

Browse files
authored
Merge pull request #4548 from wilecoyotegenius/profile-card-properties
Add cmdlets to control profile card properties
2 parents 5b34163 + 87c4aee commit ed76592

10 files changed

+537
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
Module Name: PnP.PowerShell
3+
schema: 2.0.0
4+
applicable: SharePoint Online
5+
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPProfileCardProperty.html
6+
external help file: PnP.PowerShell.dll-Help.xml
7+
title: Get-PnPProfileCardProperty
8+
---
9+
10+
# Get-PnPProfileCardProperty
11+
12+
## SYNOPSIS
13+
14+
**Required Permissions**
15+
16+
* Microsoft Graph API : One of PeopleSettings.Read.All, PeopleSettings.ReadWrite.All
17+
18+
Retrieves custom properties added to user profile cards
19+
20+
## SYNTAX
21+
22+
```powershell
23+
Get-PnPProfileCardProperty [-PropertyName <ProfileCardPropertyName>] [-Verbose] [-Connection <PnPConnection>]
24+
```
25+
26+
## DESCRIPTION
27+
28+
This cmdlet may be used to retrieve custom properties added to user profile card.
29+
30+
## EXAMPLES
31+
32+
### EXAMPLE 1
33+
```powershell
34+
Get-PnPProfileCardProperty
35+
```
36+
37+
This will retrieve all custom properties added to user profile card.
38+
39+
### EXAMPLE 2
40+
```powershell
41+
Get-PnPProfileCardProperty -PropertyName "pnppowershell"
42+
```
43+
44+
This will return information about the specified property added to a profile card.
45+
46+
## PARAMETERS
47+
48+
### -Connection
49+
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).
50+
51+
```yaml
52+
Type: PnPConnection
53+
Parameter Sets: (All)
54+
Required: False
55+
Position: Named
56+
Default value: None
57+
Accept pipeline input: False
58+
Accept wildcard characters: False
59+
```
60+
61+
### -Identity
62+
Name of the property to be retrieved. If not provided, all properties will be returned.
63+
64+
```yaml
65+
Type: Commands.Enums.ProfileCardPropertyName
66+
Parameter Sets: (All)
67+
Required: False
68+
Position: Named
69+
Default value: None
70+
Accept pipeline input: False
71+
Accept wildcard characters: False
72+
```
73+
74+
### -Verbose
75+
When provided, additional debug statements will be shown while executing the cmdlet.
76+
77+
```yaml
78+
Type: SwitchParameter
79+
Parameter Sets: (All)
80+
81+
Required: False
82+
Position: Named
83+
Default value: None
84+
Accept pipeline input: False
85+
Accept wildcard characters: False
86+
```
87+
88+
## RELATED LINKS
89+
90+
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
91+
[Microsoft Graph documentation](https://learn.microsoft.com/en-us/graph/add-properties-profilecard)
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
Module Name: PnP.PowerShell
3+
schema: 2.0.0
4+
applicable: SharePoint Online
5+
online version: https://pnp.github.io/powershell/cmdlets/New-PnpProfileCardProperty.html
6+
external help file: PnP.PowerShell.dll-Help.xml
7+
title: New-PnpProfileCardProperty
8+
---
9+
10+
# New-PnpProfileCardProperty
11+
12+
## SYNOPSIS
13+
14+
**Required Permissions**
15+
16+
* Microsoft Graph API : PeopleSettings.ReadWrite.All
17+
18+
Adds a property to user profile card
19+
20+
## SYNTAX
21+
22+
```powershell
23+
New-PnpProfileCardProperty -PropertyName <ProfileCardPropertyName> -DisplayName <String> [-Localizations <Hashtable>] [-Verbose] [-Connection <PnPConnection>]
24+
```
25+
## DESCRIPTION
26+
27+
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.
28+
29+
## EXAMPLES
30+
31+
### EXAMPLE 1
32+
```powershell
33+
New-PnpProfileCardProperty -PropertyName CustomAttribute1 -DisplayName "Cost Centre"
34+
```
35+
36+
This cmdlet will add a property with a display name to user profile card.
37+
38+
### EXAMPLE 2
39+
```powershell
40+
$localizations = @{ "pl" = "Centrum kosztów"; "de" = "Kostenstelle" }
41+
New-PnpProfileCardProperty -PropertyName CustomAttribute1 -DisplayName "Cost Centre" -Localizations $localizations
42+
```
43+
44+
This cmdlet will add a property with a display name and specified localizations to user profile card.
45+
46+
## PARAMETERS
47+
48+
### -Connection
49+
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).
50+
51+
```yaml
52+
Type: PnPConnection
53+
Parameter Sets: (All)
54+
Required: False
55+
Position: Named
56+
Default value: None
57+
Accept pipeline input: False
58+
Accept wildcard characters: False
59+
```
60+
61+
### -PropertyName
62+
Name of a property to be added
63+
64+
```yaml
65+
Type: Commands.Enums.ProfileCardPropertyName
66+
Parameter Sets: (All)
67+
Required: True
68+
Position: Named
69+
Default value: None
70+
Accept pipeline input: False
71+
Accept wildcard characters: False
72+
```
73+
74+
### -DisplayName
75+
The display name of the property.
76+
77+
```yaml
78+
Type: String
79+
Parameter Sets: (All)
80+
Required: True
81+
Default value: None
82+
Accept pipeline input: False
83+
Accept wildcard characters: False
84+
```
85+
86+
### -Localizations
87+
List of display name localizations
88+
89+
```yaml
90+
Type: Hashtable
91+
Parameter Sets: (All)
92+
Required: False
93+
Position: Named
94+
Default value: None
95+
Accept pipeline input: False
96+
Accept wildcard characters: False
97+
```
98+
99+
### -Verbose
100+
When provided, additional debug statements will be shown while executing the cmdlet.
101+
102+
```yaml
103+
Type: SwitchParameter
104+
Parameter Sets: (All)
105+
106+
Required: False
107+
Position: Named
108+
Default value: None
109+
Accept pipeline input: False
110+
Accept wildcard characters: False
111+
```
112+
113+
## RELATED LINKS
114+
115+
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
116+
[Microsoft Graph documentation](https://learn.microsoft.com/en-us/graph/add-properties-profilecard)
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
Module Name: PnP.PowerShell
3+
schema: 2.0.0
4+
applicable: SharePoint Online
5+
online version: https://pnp.github.io/powershell/cmdlets/Remove-PnPProfileCardProperty.html
6+
external help file: PnP.PowerShell.dll-Help.xml
7+
title: Remove-PnPProfileCardProperty
8+
---
9+
10+
# Remove-PnPProfileCardProperty
11+
12+
## SYNOPSIS
13+
14+
**Required Permissions**
15+
16+
* Microsoft Graph API : PeopleSettings.ReadWrite.All
17+
18+
Removes a specific property from user profile card
19+
20+
## SYNTAX
21+
22+
```powershell
23+
Remove-PnPProfileCardProperty -PropertyName <ProfileCardPropertyName> [-Verbose] [-Connection <PnPConnection>]
24+
```
25+
26+
## DESCRIPTION
27+
28+
This cmdlet can be used to remove a property from user profile card
29+
30+
## EXAMPLES
31+
32+
### EXAMPLE 1
33+
```powershell
34+
Remove-PnPProfileCardProperty -PropertyName CustomAttribute1
35+
```
36+
37+
This will remove the connection to the external datasource with the specified identity from Microsoft Search.
38+
39+
## PARAMETERS
40+
41+
### -Connection
42+
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).
43+
44+
```yaml
45+
Type: PnPConnection
46+
Parameter Sets: (All)
47+
Required: False
48+
Position: Named
49+
Default value: None
50+
Accept pipeline input: False
51+
Accept wildcard characters: False
52+
```
53+
54+
### -Identity
55+
Unique identifier or an instance of the external connection in Microsoft Search that needs to be removed.
56+
57+
```yaml
58+
Type: SearchExternalConnectionPipeBind
59+
Parameter Sets: (All)
60+
Required: True
61+
Position: Named
62+
Default value: None
63+
Accept pipeline input: True
64+
Accept wildcard characters: False
65+
```
66+
67+
### -Verbose
68+
When provided, additional debug statements will be shown while executing the cmdlet.
69+
70+
```yaml
71+
Type: SwitchParameter
72+
Parameter Sets: (All)
73+
74+
Required: False
75+
Position: Named
76+
Default value: None
77+
Accept pipeline input: False
78+
Accept wildcard characters: False
79+
```
80+
81+
## RELATED LINKS
82+
83+
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
84+
[Microsoft Graph documentation](https://learn.microsoft.com/en-us/graph/add-properties-profilecard)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
namespace PnP.PowerShell.Commands.Enums
2+
{
3+
/// <summary>
4+
/// Custom properties available for customization on profile card
5+
/// </summary>
6+
/// <remarks>Documented at https://learn.microsoft.com/en-us/graph/add-properties-profilecard </remarks>
7+
public enum ProfileCardPropertyName
8+
{
9+
CustomAttribute1,
10+
CustomAttribute2,
11+
CustomAttribute3,
12+
CustomAttribute4,
13+
CustomAttribute5,
14+
CustomAttribute6,
15+
CustomAttribute7,
16+
CustomAttribute8,
17+
CustomAttribute9,
18+
CustomAttribute10,
19+
CustomAttribute12,
20+
CustomAttribute11,
21+
CustomAttribute13,
22+
CustomAttribute14,
23+
CustomAttribute15,
24+
UserPrincipalName,
25+
FaxNumber,
26+
StreetAddress,
27+
PostalCode,
28+
State,
29+
MailNickname
30+
}
31+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System.Collections.Generic;
2+
using System.Text.Json.Serialization;
3+
using PnP.PowerShell.Commands.Enums;
4+
5+
namespace PnP.PowerShell.Commands.Model.Graph.ProfileCard
6+
{
7+
/// <summary>
8+
/// Contains a profile card property information
9+
/// </summary>
10+
/// <remarks>See https://learn.microsoft.com/en-us/graph/api/resources/profilecardproperty</remarks>
11+
public class ProfileCardProperty
12+
{
13+
/// <summary>
14+
/// Directory property name
15+
/// </summary>
16+
[JsonPropertyName("directoryPropertyName")]
17+
public string DirectoryPropertyName { get; set; }
18+
19+
/// <summary>
20+
/// Annotations
21+
/// </summary>
22+
[JsonPropertyName("annotations")]
23+
public List<ProfileCardPropertyAnnotation> Annotations { get; set; }
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System.Collections.Generic;
2+
using System.Text.Json.Serialization;
3+
using PnP.PowerShell.Commands.Enums;
4+
5+
namespace PnP.PowerShell.Commands.Model.Graph.ProfileCard
6+
{
7+
/// <summary>
8+
/// Contains a profile card property annotation
9+
/// </summary>
10+
/// <remarks>See https://learn.microsoft.com/en-us/graph/api/resources/profilecardannotation</remarks>
11+
public class ProfileCardPropertyAnnotation
12+
{
13+
/// <summary>
14+
/// Unique identifier for the message
15+
/// </summary>
16+
[JsonPropertyName("displayName")]
17+
public string DisplayName { get; set; }
18+
19+
/// <summary>
20+
/// The To: recipients for the message
21+
/// </summary>
22+
[JsonPropertyName("localizations")]
23+
public List<ProfileCardPropertyLocalization> Localizations { get; set; }
24+
}
25+
}

0 commit comments

Comments
 (0)