Skip to content
This repository was archived by the owner on Jan 19, 2021. It is now read-only.

Commit b812c37

Browse files
Merge pull request #2721 from pnp/dev
June 2020 Intermediate Release 1
2 parents 07637ed + b09e987 commit b812c37

17 files changed

+332
-257
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
1313

1414
### Contributors
1515

16+
## [3.22.2006.1]
17+
18+
Intermediate release due to a fix in the underlying Core Library.
1619

1720
## [3.22.2006.0]
1821

Commands/Admin/StartSiteRename.cs

-32
This file was deleted.

Commands/Base/ConnectOnline.cs

+29-10
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
using System.Security.Cryptography.X509Certificates;
1414
using System.IdentityModel.Tokens.Jwt;
1515
using SharePointPnP.PowerShell.Commands.Enums;
16+
#if !NETSTANDARD2_1
1617
using System.Web.UI.WebControls;
18+
#endif
1719
using SharePointPnP.PowerShell.Commands.Model;
1820
using Resources = SharePointPnP.PowerShell.Commands.Properties.Resources;
21+
#if !NETSTANDARD2_1
1922
using System.Security.Cryptography;
23+
#endif
2024
using System.Reflection;
21-
#if NETSTANDARD2_1
22-
using System.IdentityModel.Tokens.Jwt;
23-
#endif
2425
#if !ONPREMISES
2526
#endif
2627

@@ -375,8 +376,10 @@ public class ConnectOnline : BasePSCmdlet
375376
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_WEBLOGIN, HelpMessage = "If you want to connect to SharePoint with browser based login. This is required when you have multi-factor authentication (MFA) enabled.")]
376377
public SwitchParameter UseWebLogin;
377378

379+
#if !NETSTANDARD2_1
378380
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_MAIN, HelpMessage = "Specify to use for instance use forms based authentication (FBA)")]
379381
public ClientAuthenticationMode AuthenticationMode = ClientAuthenticationMode.Default;
382+
#endif
380383

381384
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_MAIN, HelpMessage = "If you want to create a PSDrive connected to the URL")]
382385
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_TOKEN, HelpMessage = "If you want to create a PSDrive connected to the URL")]
@@ -693,10 +696,11 @@ protected void Connect()
693696
connection = ConnectAppOnlyAadCer();
694697
break;
695698

699+
#if !NETSTANDARD2_1
696700
case ParameterSet_GRAPHWITHSCOPE:
697701
connection = ConnectGraphWithScope();
698702
break;
699-
703+
#endif
700704
case ParameterSet_ACCESSTOKEN:
701705
connection = ConnectAccessToken();
702706
break;
@@ -782,7 +786,7 @@ protected void Connect()
782786
}
783787
}
784788

785-
#region Connect Types
789+
#region Connect Types
786790

787791
/// <summary>
788792
/// Connect using the paramater set TOKEN
@@ -1036,7 +1040,7 @@ private PnPConnection ConnectAppOnlyAadPem()
10361040
#if !NETSTANDARD2_1
10371041
return PnPConnectionHelper.InitiateAzureADAppOnlyConnection(new Uri(Url), ClientId, Tenant, PEMCertificate, PEMPrivateKey, CertificatePassword, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, NoTelemetry, SkipTenantAdminCheck, AzureEnvironment);
10381042
#else
1039-
throw new NotImplementedException();
1043+
return PnPConnectionHelper.InitiateAzureADAppOnlyConnection(new Uri(Url), ClientId, Tenant, PEMCertificate, PEMPrivateKey, CertificatePassword, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, NoTelemetry, SkipTenantAdminCheck, AzureEnvironment);
10401044
#endif
10411045
#else
10421046
return null;
@@ -1053,7 +1057,7 @@ private PnPConnection ConnectAppOnlyAadThumb()
10531057
#if !NETSTANDARD2_1
10541058
return PnPConnectionHelper.InitiateAzureADAppOnlyConnection(new Uri(Url), ClientId, Tenant, Thumbprint, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, NoTelemetry, SkipTenantAdminCheck, AzureEnvironment);
10551059
#else
1056-
throw new NotImplementedException();
1060+
return PnPConnectionHelper.InitiateAzureADAppOnlyConnection(new Uri(Url), ClientId, Tenant, Thumbprint, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, NoTelemetry, SkipTenantAdminCheck, AzureEnvironment);
10571061
#endif
10581062
#else
10591063
return null;
@@ -1296,6 +1300,7 @@ private PnPConnection ConnectWebLogin()
12961300
return PnPConnectionHelper.InstantiateWebloginConnection(new Uri(Url), MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, SkipTenantAdminCheck);
12971301
#else
12981302
WriteWarning(@"-UseWebLogin is not implemented, due to restrictions of the .NET Standard framework. Use -PnPO365ManagementShell instead");
1303+
return null;
12991304
#endif
13001305
}
13011306

@@ -1321,6 +1326,7 @@ private PnPConnection ConnectCredentials(PSCredential credentials)
13211326
}
13221327
}
13231328

1329+
#if !NETSTANDARD2_1
13241330
return PnPConnectionHelper.InstantiateSPOnlineConnection(new Uri(Url),
13251331
credentials,
13261332
Host,
@@ -1333,11 +1339,24 @@ private PnPConnection ConnectCredentials(PSCredential credentials)
13331339
NoTelemetry,
13341340
SkipTenantAdminCheck,
13351341
AuthenticationMode);
1342+
#else
1343+
return PnPConnectionHelper.InstantiateSPOnlineConnection(new Uri(Url),
1344+
credentials,
1345+
Host,
1346+
CurrentCredentials,
1347+
MinimalHealthScore,
1348+
RetryCount,
1349+
RetryWait,
1350+
RequestTimeout,
1351+
TenantAdminUrl,
1352+
NoTelemetry,
1353+
SkipTenantAdminCheck);
1354+
#endif
13361355
}
13371356

1338-
#endregion
1357+
#endregion
13391358

1340-
#region Helper methods
1359+
#region Helper methods
13411360
private PSCredential GetCredentials()
13421361
{
13431362
var connectionUri = new Uri(Url);
@@ -1410,6 +1429,6 @@ private void WriteUpdateMessage(string message)
14101429
WriteWarning(message);
14111430
}
14121431
}
1413-
#endregion
1432+
#endregion
14141433
}
14151434
}

Commands/Base/GetStoredCredential.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected override void ProcessRecord()
6565
var creds = Utilities.CredentialManager.GetCredential(Name);
6666
if(creds != null)
6767
{
68-
var spoCreds = new Microsoft.SharePoint.Client.SharePointOnlineCredentials(creds.UserName, creds.Password);
68+
var spoCreds = new System.Net.NetworkCredential(creds.UserName, creds.Password);
6969
WriteObject(spoCreds);
7070
} else
7171
{

Commands/Base/InitializePowerShellAuthentication.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if !ONPREMISES
1+
#if !ONPREMISES && !NETSTANDARD2_1
22
using Newtonsoft.Json;
33
using OfficeDevPnP.Core.Utilities;
44
using SharePointPnP.PowerShell.CmdletHelpAttributes;

Commands/Base/InvokeSPRestMethod.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.SharePoint.Client;
1+
#if !NETSTANDARD2_1
2+
using Microsoft.SharePoint.Client;
23
using Newtonsoft.Json;
34
using OfficeDevPnP.Core.Utilities;
45
using SharePointPnP.PowerShell.CmdletHelpAttributes;
@@ -233,3 +234,4 @@ public static extern bool InternetGetCookieEx(
233234
}
234235
}
235236
}
237+
#endif

Commands/Base/PnPConnection.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,10 @@ internal ClientContext CloneContext(string url)
552552
if ((ex is WebException || ex is NotSupportedException) && CurrentConnection.PSCredential != null)
553553
{
554554
// legacy auth?
555-
var authManager = new OfficeDevPnP.Core.AuthenticationManager();
556-
context = authManager.GetAzureADCredentialsContext(url.ToString(), CurrentConnection.PSCredential.UserName, CurrentConnection.PSCredential.Password);
555+
using(var authManager = new OfficeDevPnP.Core.AuthenticationManager())
556+
{
557+
context = authManager.GetAzureADCredentialsContext(url.ToString(), CurrentConnection.PSCredential.UserName, CurrentConnection.PSCredential.Password);
558+
}
557559
context.ExecuteQueryRetry();
558560
}
559561
else

0 commit comments

Comments
 (0)