Skip to content

Commit bfb4291

Browse files
authored
Merge branch 'dev' into fix/4203-allow-scripts
2 parents 2c1b233 + e6cbff6 commit bfb4291

16 files changed

+3506
-3503
lines changed

.github/workflows/buildpr.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,20 @@ jobs:
3333
- name: Setup .NET Core
3434
uses: actions/setup-dotnet@v4
3535
with:
36-
dotnet-version: |
37-
6.0.x
38-
7.0.x
36+
dotnet-version: |
3937
8.0.x
38+
9.0.x
4039
- name: Install PnP.Core dependencies
4140
run: dotnet restore
4241
working-directory: pnpcore/src/sdk
4342
- name: Build PnP.Core
4443
run: dotnet build --configuration Debug --no-restore -p:WarningLevel=0
4544
working-directory: pnpcore/src/sdk/PnP.Core
4645
- name: Install PnP.Framework dependencies
47-
run: dotnet restore -p:PnPCoreSdkPath="..\..\..\pnpcore\src\sdk\PnP.Core\bin\Debug\netstandard2.0\PnP.Core.dll" -p:PnPCoreSdkPathNet8="..\..\..\pnpcore\src\sdk\PnP.Core\bin\Debug\net8.0\PnP.Core.dll"
46+
run: dotnet restore -p:PnPCoreSdkPath="..\..\..\pnpcore\src\sdk\PnP.Core\bin\Debug\netstandard2.0\PnP.Core.dll" -p:PnPCoreSdkPathNet8="..\..\..\pnpcore\src\sdk\PnP.Core\bin\Debug\net8.0\PnP.Core.dll" -p:PnPCoreSdkPathNet9="..\..\..\pnpcore\src\sdk\PnP.Core\bin\Debug\net9.0\PnP.Core.dll"
4847
working-directory: pnpframework/src/lib
4948
- name: Build PnP.Framework
50-
run: dotnet build --configuration Debug --no-restore -p:WarningLevel=0 -p:PnPCoreSdkPath="..\..\..\..\pnpcore\src\sdk\PnP.Core\bin\Debug\netstandard2.0\PnP.Core.dll" -p:PnPCoreSdkPathNet8="..\..\..\..\pnpcore\src\sdk\PnP.Core\bin\Debug\net8.0\PnP.Core.dll"
49+
run: dotnet build --configuration Debug --no-restore -p:WarningLevel=0 -p:PnPCoreSdkPath="..\..\..\..\pnpcore\src\sdk\PnP.Core\bin\Debug\netstandard2.0\PnP.Core.dll" -p:PnPCoreSdkPathNet8="..\..\..\..\pnpcore\src\sdk\PnP.Core\bin\Debug\net8.0\PnP.Core.dll" -p:PnPCoreSdkPathNet9="..\..\..\..\pnpcore\src\sdk\PnP.Core\bin\Debug\net9.0\PnP.Core.dll"
5150
working-directory: pnpframework/src/lib/PnP.Framework
5251
- name: Install PnP.PowerShell dependencies
5352
run: dotnet restore -p:PnPFrameworkPath="..\..\..\pnpframework\src\lib\" -p:PnPCoreSdkPath="..\..\..\pnpcore\src\sdk\"

.github/workflows/nightlyrelease.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ jobs:
1616
- name: Setup .NET Core
1717
uses: actions/setup-dotnet@v4
1818
with:
19-
dotnet-version: |
20-
6.x
21-
7.x
19+
dotnet-version: |
2220
8.x
21+
9.x
2322
- uses: actions/checkout@v4
2423
with:
2524
ref: dev

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
3939

4040
### Changed
4141

42-
- **PnP PowerShell is now .NET 8.0 based, and requires PowerShell 7.4.**
42+
- **PnP PowerShell is now .NET 8.0 based, and requires PowerShell 7.4.3 or newer **
4343
- **`-Interactive` login is now the default.**
4444
- In case of errors when Graph batch method is used, it will now throw a clearer error message about what was the issue. [#4327](https://github.com/pnp/powershell/pull/4327/)
4545
- `Get-PnPAccessToken`, `Request-PnPAccessToken` and `Get-PnPGraphAccessToken` output type is changed to `Microsoft.IdentityModel.JsonWebTokens.JsonWebToken`. Earlier they returned `System.IdentityModel.Tokens.Jwt`.

pnpframework_hash.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c774fcfcc3b317f29570ad5c20316e5916aeba98
1+
2a16d67a759a8cb65c2fa3d453316c99b51831b9

pnppowershell_hash.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
79d5de90e56090ff99f3c2e1858c87458adb0788
1+
ba52197da4b025a8568dbfe3e26ad1060b4b02cf

resources/predictor/PnP.PowerShell.Suggestions.nightly.json

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

src/Commands/Base/PipeBinds/SearchExternalConnectionPipeBind.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public SearchExternalConnectionPipeBind(string identity)
2323
_identity = identity;
2424
}
2525

26+
public string GetExternalConnectionId(PSCmdlet cmdlet, PnPConnection connection, string accessToken)
27+
{
28+
return _identity ?? _searchExternalConnection?.Id ?? GetExternalConnection(cmdlet, connection, accessToken)?.Id;
29+
}
30+
2631
public Model.Graph.MicrosoftSearch.ExternalConnection GetExternalConnection(PSCmdlet cmdlet, PnPConnection connection, string accessToken)
2732
{
2833
if(_searchExternalConnection != null)

src/Commands/Search/GetSearchExternalConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace PnP.PowerShell.Commands.Search
1313
[OutputType(typeof(Model.Graph.MicrosoftSearch.ExternalConnection))]
1414
public class GetSearchExternalConnection : PnPGraphCmdlet
1515
{
16-
[Parameter(Mandatory = false)]
16+
[Parameter(Mandatory = false, Position = 0, ValueFromPipeline = true)]
1717
public string Identity;
1818

1919
protected override void ExecuteCmdlet()

src/Commands/Search/GetSearchExternalItem.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class GetSearchExternalItem : PnPGraphCmdlet
2525

2626
protected override void ExecuteCmdlet()
2727
{
28-
var externalConnection = ConnectionId.GetExternalConnection(this, Connection, AccessToken);
28+
var externalConnectionId = ConnectionId.GetExternalConnectionId(this, Connection, AccessToken) ?? throw new PSArgumentException("No valid external connection specified", nameof(ConnectionId));
2929

3030
var searchQuery = new Model.Graph.MicrosoftSearch.SearchRequests
3131
{
@@ -39,7 +39,7 @@ protected override void ExecuteCmdlet()
3939
],
4040
ContentSources =
4141
[
42-
$"/external/connections/{externalConnection.Id}"
42+
$"/external/connections/{externalConnectionId}"
4343
],
4444
Query = new Model.Graph.MicrosoftSearch.SearchRequestQuery
4545
{
@@ -59,11 +59,11 @@ protected override void ExecuteCmdlet()
5959

6060
if(hits == null || hits.Count == 0)
6161
{
62-
WriteVerbose($"No external items found{(ParameterSpecified(nameof(Identity)) ? $" with the identity '{Identity}'" : "")} on external connection '{externalConnection.Id}'");
62+
WriteVerbose($"No external items found{(ParameterSpecified(nameof(Identity)) ? $" with the identity '{Identity}'" : "")} on external connection '{externalConnectionId}'");
6363
return;
6464
}
6565

66-
WriteVerbose($"Found {hits.Count} external item{(hits.Count != 1 ? "s" : "")}{(ParameterSpecified(nameof(Identity)) ? $" with the identity '{Identity}'" : "")} on external connection '{externalConnection.Id}'");
66+
WriteVerbose($"Found {hits.Count} external item{(hits.Count != 1 ? "s" : "")}{(ParameterSpecified(nameof(Identity)) ? $" with the identity '{Identity}'" : "")} on external connection '{externalConnectionId}'");
6767

6868
var externalItems = hits.Select(s => new Model.Graph.MicrosoftSearch.ExternalItem {
6969
Id = s.Resource.Properties["fileID"].ToString()[(s.Resource.Properties["fileID"].ToString().LastIndexOf(',') + 1)..],

src/Commands/Search/GetSearchExternalSchema.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public class GetSearchExternalSchema : PnPGraphCmdlet
1515

1616
protected override void ExecuteCmdlet()
1717
{
18-
var searchExternalConnection = ConnectionId.GetExternalConnection(this, Connection, AccessToken);
19-
var graphApiUrl = $"v1.0/external/connections/{searchExternalConnection.Id}/schema";
18+
var externalConnectionId = ConnectionId.GetExternalConnectionId(this, Connection, AccessToken) ?? throw new PSArgumentException("No valid external connection specified", nameof(ConnectionId));
19+
var graphApiUrl = $"v1.0/external/connections/{externalConnectionId}/schema";
2020
var result = Utilities.REST.GraphHelper.Get<Model.Graph.MicrosoftSearch.ExternalSchema>(this, Connection, graphApiUrl, AccessToken, additionalHeaders: new System.Collections.Generic.Dictionary<string, string> { { "Prefer", "include-unknown-enum-members" } });
2121
WriteObject(result, false);
2222
}

src/Commands/Search/RemoveSearchExternalConnection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public class RemoveSearchExternalConnection : PnPGraphCmdlet
1414

1515
protected override void ExecuteCmdlet()
1616
{
17-
var externalConnection = Identity.GetExternalConnection(this, Connection, AccessToken);
18-
Utilities.REST.GraphHelper.Delete(this, Connection, $"v1.0/external/connections/{externalConnection.Id}", AccessToken);
17+
var externalConnectionId = Identity.GetExternalConnectionId(this, Connection, AccessToken) ?? throw new PSArgumentException("No valid external connection specified", nameof(Identity));
18+
Utilities.REST.GraphHelper.Delete(this, Connection, $"v1.0/external/connections/{externalConnectionId}", AccessToken);
1919
}
2020
}
2121
}

src/Commands/Search/RemoveSearchExternalItem.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ public class RemoveSearchExternalItem : PnPGraphCmdlet
2121

2222
protected override void ExecuteCmdlet()
2323
{
24-
var connection = ConnectionId.GetExternalConnection(this, Connection, AccessToken);
24+
var externalConnectionId = ConnectionId.GetExternalConnectionId(this, Connection, AccessToken) ?? throw new PSArgumentException("No valid external connection specified", nameof(ConnectionId));
2525

2626
try
2727
{
28-
var response = GraphHelper.Delete(this, Connection, $"beta/external/connections/{connection.Id}/items/{ItemId}", AccessToken);
29-
WriteVerbose($"External item with ID '{ItemId}' successfully removed from external connection '{connection.Id}'");
28+
var response = GraphHelper.Delete(this, Connection, $"beta/external/connections/{externalConnectionId}/items/{ItemId}", AccessToken);
29+
WriteVerbose($"External item with ID '{ItemId}' successfully removed from external connection '{externalConnectionId}'");
3030
}
3131
catch (PSInvalidOperationException ex)
3232
{
33-
throw new PSInvalidOperationException($"Removing external item with ID '{ItemId}' from external connection '{connection.Id}' failed with message '{ex.Message}'", ex);
33+
throw new PSInvalidOperationException($"Removing external item with ID '{ItemId}' from external connection '{externalConnectionId}' failed with message '{ex.Message}'", ex);
3434
}
3535
}
3636
}

src/Commands/Search/SetSearchExternalConnection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ protected override void ExecuteCmdlet()
4141
var jsonContent = JsonContent.Create(bodyContent, null, new JsonSerializerOptions { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull });
4242
WriteVerbose($"Constructed payload: {jsonContent.ReadAsStringAsync().GetAwaiter().GetResult()}");
4343

44-
var externalConnection = Identity.GetExternalConnection(this, Connection, AccessToken);
45-
var graphApiUrl = $"v1.0/external/connections/{externalConnection.Id}";
44+
var externalConnectionId = Identity.GetExternalConnectionId(this, Connection, AccessToken) ?? throw new PSArgumentException("No valid external connection specified", nameof(Identity));
45+
var graphApiUrl = $"v1.0/external/connections/{externalConnectionId}";
4646
Utilities.REST.GraphHelper.Patch(this, Connection, AccessToken, jsonContent, graphApiUrl);
4747
}
4848
}

src/Commands/Search/SetSearchExternalItem.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ protected override void ExecuteCmdlet()
105105
var jsonContent = JsonContent.Create(bodyContent);
106106
WriteVerbose($"Constructed payload: {jsonContent.ReadAsStringAsync().GetAwaiter().GetResult()}");
107107

108-
var searchExternalConnection = ConnectionId.GetExternalConnection(this, Connection, AccessToken);
109-
var graphApiUrl = $"v1.0/external/connections/{searchExternalConnection.Id}/items/{ItemId}";
108+
var externalConnectionId = ConnectionId.GetExternalConnectionId(this, Connection, AccessToken) ?? throw new PSArgumentException("No valid external connection specified", nameof(ConnectionId));
109+
var graphApiUrl = $"v1.0/external/connections/{externalConnectionId}/items/{ItemId}";
110110
var results = Utilities.REST.GraphHelper.Put<Model.Graph.MicrosoftSearch.ExternalItem>(this, Connection, graphApiUrl, AccessToken, jsonContent);
111111
WriteObject(results, false);
112112
}

src/Commands/Search/SetSearchExternalSchema.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class SetSearchExternalSchema : PnPGraphCmdlet
3737

3838
protected override void ExecuteCmdlet()
3939
{
40-
var searchExternalConnection = ConnectionId.GetExternalConnection(this, Connection, AccessToken);
40+
var externalConnectionId = ConnectionId.GetExternalConnectionId(this, Connection, AccessToken) ?? throw new PSArgumentException("No valid external connection specified", nameof(ConnectionId));
4141

4242
switch(ParameterSetName)
4343
{
@@ -53,7 +53,7 @@ protected override void ExecuteCmdlet()
5353
var jsonContent = new StringContent(SchemaAsText);
5454
WriteVerbose($"Constructed payload: {jsonContent.ReadAsStringAsync().GetAwaiter().GetResult()}");
5555

56-
var graphApiUrl = $"v1.0/external/connections/{searchExternalConnection.Id}/schema";
56+
var graphApiUrl = $"v1.0/external/connections/{externalConnectionId}/schema";
5757
var results = Utilities.REST.GraphHelper.Patch(this, Connection, AccessToken, jsonContent, graphApiUrl);
5858

5959
WriteVerbose("Trying to retrieve location header from response which can be used to poll for the status of the schema operation");

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.99.45
1+
2.99.48

0 commit comments

Comments
 (0)