From ff80304ba4b7e5f593319ee79caac59f1dbb9b38 Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Tue, 9 Jun 2020 17:01:10 +0200 Subject: [PATCH 1/2] June 2020 Intermediate Release 1 --- CHANGELOG.md | 3 + Commands/Admin/StartSiteRename.cs | 32 -- Commands/Base/ConnectOnline.cs | 39 +- Commands/Base/GetStoredCredential.cs | 2 +- .../InitializePowerShellAuthentication.cs | 2 +- Commands/Base/InvokeSPRestMethod.cs | 4 +- Commands/Base/PnPConnection.cs | 6 +- Commands/Base/PnPConnectionHelper.cs | 419 ++++++++++-------- Commands/Diagnostic/MeasureResponseTime.cs | 4 +- Commands/Graph/ResetUnifiedGroupExpiration.cs | 2 +- Commands/PnPPowerShell.csproj | 50 ++- Commands/Properties/AssemblyInfo.cs | 4 +- Commands/Provider/SPOContentReaderWriter.cs | 4 + Commands/Provider/SPOProvider.cs | 8 +- .../Site/AddFileToProvisioningTemplate.cs | 4 + Commands/Utilities/AzureAuthHelper.cs | 4 +- 16 files changed, 331 insertions(+), 256 deletions(-) delete mode 100644 Commands/Admin/StartSiteRename.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index a3e283177..d5c340e62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ### Contributors +## [3.22.2006.1] + +Intermediate release due to a fix in the underlying Core Library. ## [3.22.2006.0] diff --git a/Commands/Admin/StartSiteRename.cs b/Commands/Admin/StartSiteRename.cs deleted file mode 100644 index 57c3f791d..000000000 --- a/Commands/Admin/StartSiteRename.cs +++ /dev/null @@ -1,32 +0,0 @@ -#if !ONPREMISES -using Microsoft.Online.SharePoint.TenantAdministration; -using Microsoft.SharePoint.Client; -using SharePointPnP.PowerShell.CmdletHelpAttributes; -using SharePointPnP.PowerShell.Commands.Base; -using System.Management.Automation; -using SharePointPnP.PowerShell.Commands.Base.PipeBinds; - -namespace SharePointPnP.PowerShell.Commands.Admin -{ - [Cmdlet(VerbsLifecycle.Start, "PnPSiteRename")] - [CmdletHelp("Registers a site as a hubsite", - DetailedDescription = "Registers a site as a hubsite", - SupportedPlatform = CmdletSupportedPlatform.Online, - Category = CmdletHelpCategory.TenantAdmin)] - [CmdletExample( - Code = @"PS:> Set-PnPHomePage -RootFolderRelativeUrl SitePages/Home.aspx", - Remarks = "Sets the home page to the home.aspx file which resides in the SitePages library", - SortOrder = 1)] - public class StartSiteRename : PnPAdminCmdlet - { - [Parameter(Mandatory = true, HelpMessage = @"The site to register as a hubsite")] - public SitePipeBind Site; - - protected override void ExecuteCmdlet() - { - Tenant - ClientContext.ExecuteQueryRetry(); - } - } -} -#endif \ No newline at end of file diff --git a/Commands/Base/ConnectOnline.cs b/Commands/Base/ConnectOnline.cs index 344ae0ca6..cd7b56781 100644 --- a/Commands/Base/ConnectOnline.cs +++ b/Commands/Base/ConnectOnline.cs @@ -13,14 +13,15 @@ using System.Security.Cryptography.X509Certificates; using System.IdentityModel.Tokens.Jwt; using SharePointPnP.PowerShell.Commands.Enums; +#if !NETSTANDARD2_1 using System.Web.UI.WebControls; +#endif using SharePointPnP.PowerShell.Commands.Model; using Resources = SharePointPnP.PowerShell.Commands.Properties.Resources; +#if !NETSTANDARD2_1 using System.Security.Cryptography; +#endif using System.Reflection; -#if NETSTANDARD2_1 -using System.IdentityModel.Tokens.Jwt; -#endif #if !ONPREMISES #endif @@ -375,8 +376,10 @@ public class ConnectOnline : BasePSCmdlet [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.")] public SwitchParameter UseWebLogin; +#if !NETSTANDARD2_1 [Parameter(Mandatory = false, ParameterSetName = ParameterSet_MAIN, HelpMessage = "Specify to use for instance use forms based authentication (FBA)")] public ClientAuthenticationMode AuthenticationMode = ClientAuthenticationMode.Default; +#endif [Parameter(Mandatory = false, ParameterSetName = ParameterSet_MAIN, HelpMessage = "If you want to create a PSDrive connected to the URL")] [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() connection = ConnectAppOnlyAadCer(); break; +#if !NETSTANDARD2_1 case ParameterSet_GRAPHWITHSCOPE: connection = ConnectGraphWithScope(); break; - +#endif case ParameterSet_ACCESSTOKEN: connection = ConnectAccessToken(); break; @@ -782,7 +786,7 @@ protected void Connect() } } - #region Connect Types +#region Connect Types /// /// Connect using the paramater set TOKEN @@ -1036,7 +1040,7 @@ private PnPConnection ConnectAppOnlyAadPem() #if !NETSTANDARD2_1 return PnPConnectionHelper.InitiateAzureADAppOnlyConnection(new Uri(Url), ClientId, Tenant, PEMCertificate, PEMPrivateKey, CertificatePassword, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, NoTelemetry, SkipTenantAdminCheck, AzureEnvironment); #else - throw new NotImplementedException(); + return PnPConnectionHelper.InitiateAzureADAppOnlyConnection(new Uri(Url), ClientId, Tenant, PEMCertificate, PEMPrivateKey, CertificatePassword, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, NoTelemetry, SkipTenantAdminCheck, AzureEnvironment); #endif #else return null; @@ -1053,7 +1057,7 @@ private PnPConnection ConnectAppOnlyAadThumb() #if !NETSTANDARD2_1 return PnPConnectionHelper.InitiateAzureADAppOnlyConnection(new Uri(Url), ClientId, Tenant, Thumbprint, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, NoTelemetry, SkipTenantAdminCheck, AzureEnvironment); #else - throw new NotImplementedException(); + return PnPConnectionHelper.InitiateAzureADAppOnlyConnection(new Uri(Url), ClientId, Tenant, Thumbprint, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, NoTelemetry, SkipTenantAdminCheck, AzureEnvironment); #endif #else return null; @@ -1296,6 +1300,7 @@ private PnPConnection ConnectWebLogin() return PnPConnectionHelper.InstantiateWebloginConnection(new Uri(Url), MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, SkipTenantAdminCheck); #else WriteWarning(@"-UseWebLogin is not implemented, due to restrictions of the .NET Standard framework. Use -PnPO365ManagementShell instead"); + return null; #endif } @@ -1321,6 +1326,7 @@ private PnPConnection ConnectCredentials(PSCredential credentials) } } +#if !NETSTANDARD2_1 return PnPConnectionHelper.InstantiateSPOnlineConnection(new Uri(Url), credentials, Host, @@ -1333,11 +1339,24 @@ private PnPConnection ConnectCredentials(PSCredential credentials) NoTelemetry, SkipTenantAdminCheck, AuthenticationMode); +#else + return PnPConnectionHelper.InstantiateSPOnlineConnection(new Uri(Url), + credentials, + Host, + CurrentCredentials, + MinimalHealthScore, + RetryCount, + RetryWait, + RequestTimeout, + TenantAdminUrl, + NoTelemetry, + SkipTenantAdminCheck); +#endif } - #endregion +#endregion - #region Helper methods +#region Helper methods private PSCredential GetCredentials() { var connectionUri = new Uri(Url); @@ -1410,6 +1429,6 @@ private void WriteUpdateMessage(string message) WriteWarning(message); } } - #endregion +#endregion } } diff --git a/Commands/Base/GetStoredCredential.cs b/Commands/Base/GetStoredCredential.cs index fbb23dba4..0d6b7ddb5 100644 --- a/Commands/Base/GetStoredCredential.cs +++ b/Commands/Base/GetStoredCredential.cs @@ -65,7 +65,7 @@ protected override void ProcessRecord() var creds = Utilities.CredentialManager.GetCredential(Name); if(creds != null) { - var spoCreds = new Microsoft.SharePoint.Client.SharePointOnlineCredentials(creds.UserName, creds.Password); + var spoCreds = new System.Net.NetworkCredential(creds.UserName, creds.Password); WriteObject(spoCreds); } else { diff --git a/Commands/Base/InitializePowerShellAuthentication.cs b/Commands/Base/InitializePowerShellAuthentication.cs index 326f0d8dc..8ac256a4c 100644 --- a/Commands/Base/InitializePowerShellAuthentication.cs +++ b/Commands/Base/InitializePowerShellAuthentication.cs @@ -1,4 +1,4 @@ -#if !ONPREMISES +#if !ONPREMISES && !NETSTANDARD2_1 using Newtonsoft.Json; using OfficeDevPnP.Core.Utilities; using SharePointPnP.PowerShell.CmdletHelpAttributes; diff --git a/Commands/Base/InvokeSPRestMethod.cs b/Commands/Base/InvokeSPRestMethod.cs index 778047d1f..06ce08c1a 100644 --- a/Commands/Base/InvokeSPRestMethod.cs +++ b/Commands/Base/InvokeSPRestMethod.cs @@ -1,4 +1,5 @@ -using Microsoft.SharePoint.Client; +#if !NETSTANDARD2_1 +using Microsoft.SharePoint.Client; using Newtonsoft.Json; using OfficeDevPnP.Core.Utilities; using SharePointPnP.PowerShell.CmdletHelpAttributes; @@ -233,3 +234,4 @@ public static extern bool InternetGetCookieEx( } } } +#endif \ No newline at end of file diff --git a/Commands/Base/PnPConnection.cs b/Commands/Base/PnPConnection.cs index f06978b43..924ce174c 100644 --- a/Commands/Base/PnPConnection.cs +++ b/Commands/Base/PnPConnection.cs @@ -552,8 +552,10 @@ internal ClientContext CloneContext(string url) if ((ex is WebException || ex is NotSupportedException) && CurrentConnection.PSCredential != null) { // legacy auth? - var authManager = new OfficeDevPnP.Core.AuthenticationManager(); - context = authManager.GetAzureADCredentialsContext(url.ToString(), CurrentConnection.PSCredential.UserName, CurrentConnection.PSCredential.Password); + using(var authManager = new OfficeDevPnP.Core.AuthenticationManager()) + { + context = authManager.GetAzureADCredentialsContext(url.ToString(), CurrentConnection.PSCredential.UserName, CurrentConnection.PSCredential.Password); + } context.ExecuteQueryRetry(); } else diff --git a/Commands/Base/PnPConnectionHelper.cs b/Commands/Base/PnPConnectionHelper.cs index 702d2e76e..729347674 100644 --- a/Commands/Base/PnPConnectionHelper.cs +++ b/Commands/Base/PnPConnectionHelper.cs @@ -53,35 +53,37 @@ internal static PnPConnection InstantiateSPOnlineConnection(Uri url, string real if (url != null) { - var authManager = new OfficeDevPnP.Core.AuthenticationManager(); - if (realm == null) + using (var authManager = new OfficeDevPnP.Core.AuthenticationManager()) { - realm = GetRealmFromTargetUrl(url); - } + if (realm == null) + { + realm = GetRealmFromTargetUrl(url); + } - if (url.DnsSafeHost.Contains("spoppe.com")) - { - context = PnPClientContext.ConvertFrom(authManager.GetAppOnlyAuthenticatedContext(url.ToString(), realm, clientId, clientSecret, acsHostUrl: "windows-ppe.net", globalEndPointPrefix: "login"), retryCount, retryWait * 1000); - } - else - { - context = PnPClientContext.ConvertFrom(authManager.GetAppOnlyAuthenticatedContext(url.ToString(), realm, clientId, clientSecret, acsHostUrl: authManager.GetAzureADACSEndPoint(azureEnvironment), globalEndPointPrefix: authManager.GetAzureADACSEndPointPrefix(azureEnvironment)), retryCount, retryWait * 1000); - } - context.ApplicationName = Resources.ApplicationName; - context.RequestTimeout = requestTimeout; + if (url.DnsSafeHost.Contains("spoppe.com")) + { + context = PnPClientContext.ConvertFrom(authManager.GetAppOnlyAuthenticatedContext(url.ToString(), realm, clientId, clientSecret, acsHostUrl: "windows-ppe.net", globalEndPointPrefix: "login"), retryCount, retryWait * 1000); + } + else + { + context = PnPClientContext.ConvertFrom(authManager.GetAppOnlyAuthenticatedContext(url.ToString(), realm, clientId, clientSecret, acsHostUrl: authManager.GetAzureADACSEndPoint(azureEnvironment), globalEndPointPrefix: authManager.GetAzureADACSEndPointPrefix(azureEnvironment)), retryCount, retryWait * 1000); + } + context.ApplicationName = Resources.ApplicationName; + context.RequestTimeout = requestTimeout; #if !SP2013 - context.DisableReturnValueCache = true; + context.DisableReturnValueCache = true; #endif - connectionType = ConnectionType.OnPrem; - if (url.Host.ToUpperInvariant().EndsWith("SHAREPOINT.COM")) - { - connectionType = ConnectionType.O365; - } - if (skipAdminCheck == false) - { - if (IsTenantAdminSite(context)) + connectionType = ConnectionType.OnPrem; + if (url.Host.ToUpperInvariant().EndsWith("SHAREPOINT.COM")) { - connectionType = ConnectionType.TenantAdmin; + connectionType = ConnectionType.O365; + } + if (skipAdminCheck == false) + { + if (IsTenantAdminSite(context)) + { + connectionType = ConnectionType.TenantAdmin; + } } } } @@ -102,18 +104,22 @@ internal static PnPConnection InstantiateSPOnlineConnection(Uri url, string real #if ONPREMISES internal static PnPConnection InstantiateHighTrustConnection(string url, string clientId, string hightrustCertificatePath, string hightrustCertificatePassword, string hightrustCertificateIssuerId, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, PSHost host, bool disableTelemetry, bool skipAdminCheck, string loginName) { - var authManager = new OfficeDevPnP.Core.AuthenticationManager(); - var context = authManager.GetHighTrustCertificateAppAuthenticatedContext(url, clientId, hightrustCertificatePath, hightrustCertificatePassword, hightrustCertificateIssuerId, loginName); + using (var authManager = new OfficeDevPnP.Core.AuthenticationManager()) + { + var context = authManager.GetHighTrustCertificateAppAuthenticatedContext(url, clientId, hightrustCertificatePath, hightrustCertificatePassword, hightrustCertificateIssuerId, loginName); - return InstantiateHighTrustConnection(context, url, minimalHealthScore, retryCount, retryWait, requestTimeout, tenantAdminUrl, host, disableTelemetry, skipAdminCheck); + return InstantiateHighTrustConnection(context, url, minimalHealthScore, retryCount, retryWait, requestTimeout, tenantAdminUrl, host, disableTelemetry, skipAdminCheck); + } } internal static PnPConnection InstantiateHighTrustConnection(string url, string clientId, System.Security.Cryptography.X509Certificates.X509Certificate2 hightrustCertificate, string hightrustCertificateIssuerId, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, PSHost host, bool disableTelemetry, bool skipAdminCheck, string loginName) { - var authManager = new OfficeDevPnP.Core.AuthenticationManager(); - var context = authManager.GetHighTrustCertificateAppAuthenticatedContext(url, clientId, hightrustCertificate, hightrustCertificateIssuerId, loginName); + using (var authManager = new OfficeDevPnP.Core.AuthenticationManager()) + { + var context = authManager.GetHighTrustCertificateAppAuthenticatedContext(url, clientId, hightrustCertificate, hightrustCertificateIssuerId, loginName); - return InstantiateHighTrustConnection(context, url, minimalHealthScore, retryCount, retryWait, requestTimeout, tenantAdminUrl, host, disableTelemetry, skipAdminCheck); + return InstantiateHighTrustConnection(context, url, minimalHealthScore, retryCount, retryWait, requestTimeout, tenantAdminUrl, host, disableTelemetry, skipAdminCheck); + } } private static PnPConnection InstantiateHighTrustConnection(ClientContext context, string url, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, PSHost host, bool disableTelemetry, bool skipAdminCheck) @@ -187,7 +193,7 @@ internal static PnPConnection InstantiateDeviceLoginConnection(string url, bool if (tokenResult != null) { progressCallback("Token received"); - spoConnection = new SPOnlineConnection(context, tokenResult, ConnectionType.O365, minimalHealthScore, retryCount, retryWait, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.DeviceLogin); + spoConnection = new PnPConnection(context, tokenResult, ConnectionType.O365, minimalHealthScore, retryCount, retryWait, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.DeviceLogin); } else { @@ -263,7 +269,7 @@ internal static PnPConnection InstantiateGraphDeviceLoginConnection(bool launchB if (tokenResult != null) { progressCallback("Token received"); - spoConnection = new SPOnlineConnection(tokenResult, ConnectionMethod.GraphDeviceLogin, ConnectionType.O365, minimalHealthScore, retryCount, retryWait, PnPPSVersionTag, host, disableTelemetry, InitializationType.GraphDeviceLogin); + spoConnection = new PnPConnection(tokenResult, ConnectionMethod.GraphDeviceLogin, ConnectionType.O365, minimalHealthScore, retryCount, retryWait, PnPPSVersionTag, host, disableTelemetry, InitializationType.GraphDeviceLogin); } else { @@ -338,7 +344,7 @@ internal static void OpenBrowser(string url) { try { - Process.Start(url); + System.Diagnostics.Process.Start(url); } catch { @@ -346,15 +352,15 @@ internal static void OpenBrowser(string url) if (Utilities.OperatingSystem.IsWindows()) { url = url.Replace("&", "^&"); - Process.Start(new ProcessStartInfo("cmd", $"/c start {url}") { CreateNoWindow = true }); + System.Diagnostics.Process.Start(new ProcessStartInfo("cmd", $"/c start {url}") { CreateNoWindow = true }); } else if (Utilities.OperatingSystem.IsLinux()) { - Process.Start("xdg-open", url); + System.Diagnostics.Process.Start("xdg-open", url); } else if (Utilities.OperatingSystem.IsMacOS()) { - Process.Start("open", url); + System.Diagnostics.Process.Start("open", url); } else { @@ -362,56 +368,59 @@ internal static void OpenBrowser(string url) } } } -#if !NETSTANDARD2_1 + #if !ONPREMISES +#if !NETSTANDARD2_1 internal static PnPConnection InitiateAzureADNativeApplicationConnection(Uri url, string clientId, Uri redirectUri, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, PSHost host, bool disableTelemetry, bool skipAdminCheck = false, AzureEnvironment azureEnvironment = AzureEnvironment.Production) { - var authManager = new OfficeDevPnP.Core.AuthenticationManager(); - - - string appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); - string configFile = Path.Combine(appDataFolder, "SharePointPnP.PowerShell\\tokencache.dat"); - FileTokenCache cache = new FileTokenCache(configFile); - - var context = PnPClientContext.ConvertFrom(authManager.GetAzureADNativeApplicationAuthenticatedContext(url.ToString(), clientId, redirectUri, cache, azureEnvironment), retryCount, retryWait * 10000); - var connectionType = ConnectionType.OnPrem; - if (url.Host.ToUpperInvariant().EndsWith("SHAREPOINT.COM")) - { - connectionType = ConnectionType.O365; - } - if (skipAdminCheck == false) + using (var authManager = new OfficeDevPnP.Core.AuthenticationManager()) { - if (IsTenantAdminSite(context)) + string appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); + string configFile = Path.Combine(appDataFolder, "SharePointPnP.PowerShell\\tokencache.dat"); + FileTokenCache cache = new FileTokenCache(configFile); + var context = PnPClientContext.ConvertFrom(authManager.GetAzureADNativeApplicationAuthenticatedContext(url.ToString(), clientId, redirectUri, cache, azureEnvironment), retryCount, retryWait * 10000); + var connectionType = ConnectionType.OnPrem; + if (url.Host.ToUpperInvariant().EndsWith("SHAREPOINT.COM")) { - connectionType = ConnectionType.TenantAdmin; + connectionType = ConnectionType.O365; + } + if (skipAdminCheck == false) + { + if (IsTenantAdminSite(context)) + { + connectionType = ConnectionType.TenantAdmin; + } } + var spoConnection = new PnPConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, clientId, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.AADNativeApp) + { + ConnectionMethod = ConnectionMethod.AzureADNativeApplication + }; + return spoConnection; } - var spoConnection = new PnPConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, clientId, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.AADNativeApp) - { - ConnectionMethod = ConnectionMethod.AzureADNativeApplication - }; - return spoConnection; } +#endif internal static PnPConnection InitiateAzureADAppOnlyConnection(Uri url, string clientId, string tenant, X509Certificate2 certificate, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, PSHost host, bool disableTelemetry, bool skipAdminCheck = false, AzureEnvironment azureEnvironment = AzureEnvironment.Production) { - var authManager = new OfficeDevPnP.Core.AuthenticationManager(); - var context = PnPClientContext.ConvertFrom(authManager.GetAzureADAppOnlyAuthenticatedContext(url.ToString(), clientId, tenant, certificate, azureEnvironment), retryCount, retryWait * 1000); - var connectionType = ConnectionType.OnPrem; - if (url.Host.ToUpperInvariant().EndsWith("SHAREPOINT.COM")) + using (var authManager = new OfficeDevPnP.Core.AuthenticationManager()) { - connectionType = ConnectionType.O365; - } - if (skipAdminCheck == false) - { - if (IsTenantAdminSite(context)) + var context = PnPClientContext.ConvertFrom(authManager.GetAzureADAppOnlyAuthenticatedContext(url.ToString(), clientId, tenant, certificate, azureEnvironment), retryCount, retryWait * 1000); + var connectionType = ConnectionType.OnPrem; + if (url.Host.ToUpperInvariant().EndsWith("SHAREPOINT.COM")) { - connectionType = ConnectionType.TenantAdmin; + connectionType = ConnectionType.O365; + } + if (skipAdminCheck == false) + { + if (IsTenantAdminSite(context)) + { + connectionType = ConnectionType.TenantAdmin; + } } + var spoConnection = new PnPConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.AADAppOnly); + spoConnection.ConnectionMethod = Model.ConnectionMethod.AzureADAppOnly; + return spoConnection; } - var spoConnection = new PnPConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.AADAppOnly); - spoConnection.ConnectionMethod = Model.ConnectionMethod.AzureADAppOnly; - return spoConnection; } internal static PnPConnection InitiateAzureADAppOnlyConnection(Uri url, string clientId, string tenant, string certificatePath, SecureString certificatePassword, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, PSHost host, bool disableTelemetry, bool skipAdminCheck = false, AzureEnvironment azureEnvironment = AzureEnvironment.Production) @@ -502,32 +511,33 @@ private static PnPConnection InitiateAzureAdAppOnlyConnectionWithCert(Uri url, s int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, PSHost host, bool disableTelemetry, bool skipAdminCheck, AzureEnvironment azureEnvironment, X509Certificate2 certificate, bool certificateFromFile) { - var authManager = new OfficeDevPnP.Core.AuthenticationManager(); - var clientContext = authManager.GetAzureADAppOnlyAuthenticatedContext(url.ToString(), clientId, tenant, certificate, azureEnvironment); - var context = PnPClientContext.ConvertFrom(clientContext, retryCount, retryWait * 1000); - context.RequestTimeout = requestTimeout; - var connectionType = ConnectionType.OnPrem; - if (url.Host.ToUpperInvariant().EndsWith("SHAREPOINT.COM")) + using (var authManager = new OfficeDevPnP.Core.AuthenticationManager()) { - connectionType = ConnectionType.O365; - } - - if (skipAdminCheck == false) - { - if (IsTenantAdminSite(context)) + var clientContext = authManager.GetAzureADAppOnlyAuthenticatedContext(url.ToString(), clientId, tenant, certificate, azureEnvironment); + var context = PnPClientContext.ConvertFrom(clientContext, retryCount, retryWait * 1000); + context.RequestTimeout = requestTimeout; + var connectionType = ConnectionType.OnPrem; + if (url.Host.ToUpperInvariant().EndsWith("SHAREPOINT.COM")) { - connectionType = ConnectionType.TenantAdmin; + connectionType = ConnectionType.O365; } - } - var spoConnection = new PnPConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, clientId, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.AADAppOnly) - { - ConnectionMethod = ConnectionMethod.AzureADAppOnly, - Certificate = certificate, - Tenant = tenant - }; + if (skipAdminCheck == false) + { + if (IsTenantAdminSite(context)) + { + connectionType = ConnectionType.TenantAdmin; + } + } - return spoConnection; + var spoConnection = new PnPConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, clientId, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.AADAppOnly) + { + ConnectionMethod = ConnectionMethod.AzureADAppOnly, + Certificate = certificate, + Tenant = tenant + }; + return spoConnection; + } } /// @@ -569,63 +579,70 @@ internal static void CleanupCryptoMachineKey(X509Certificate2 certificate) } } #endif -#endif + #if !ONPREMISES internal static PnPConnection InitiateAccessTokenConnection(Uri url, string accessToken, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, PSHost host, bool disableTelemetry, bool skipAdminCheck = false, AzureEnvironment azureEnvironment = AzureEnvironment.Production) { - var authManager = new OfficeDevPnP.Core.AuthenticationManager(); - var context = PnPClientContext.ConvertFrom(authManager.GetAzureADAccessTokenAuthenticatedContext(url.ToString(), accessToken), retryCount, retryWait); - var connectionType = ConnectionType.O365; - if (skipAdminCheck == false) + using (var authManager = new OfficeDevPnP.Core.AuthenticationManager()) { - if (IsTenantAdminSite(context)) + var context = PnPClientContext.ConvertFrom(authManager.GetAzureADAccessTokenAuthenticatedContext(url.ToString(), accessToken), retryCount, retryWait); + var connectionType = ConnectionType.O365; + if (skipAdminCheck == false) { - connectionType = ConnectionType.TenantAdmin; + if (IsTenantAdminSite(context)) + { + connectionType = ConnectionType.TenantAdmin; + } } + var spoConnection = new PnPConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.Token); + spoConnection.ConnectionMethod = Model.ConnectionMethod.AccessToken; + return spoConnection; } - var spoConnection = new PnPConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.Token); - spoConnection.ConnectionMethod = Model.ConnectionMethod.AccessToken; - return spoConnection; } #endif #if !NETSTANDARD2_1 internal static PnPConnection InstantiateWebloginConnection(Uri url, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, PSHost host, bool disableTelemetry, bool skipAdminCheck = false) { - var authManager = new OfficeDevPnP.Core.AuthenticationManager(); - - var context = PnPClientContext.ConvertFrom(authManager.GetWebLoginClientContext(url.ToString()), retryCount, retryWait * 1000); - - if (context != null) + using (var authManager = new OfficeDevPnP.Core.AuthenticationManager()) { - context.RetryCount = retryCount; - context.Delay = retryWait * 1000; - context.ApplicationName = Resources.ApplicationName; - context.RequestTimeout = requestTimeout; + var context = PnPClientContext.ConvertFrom(authManager.GetWebLoginClientContext(url.ToString()), retryCount, retryWait * 1000); + + if (context != null) + { + context.RetryCount = retryCount; + context.Delay = retryWait * 1000; + context.ApplicationName = Resources.ApplicationName; + context.RequestTimeout = requestTimeout; #if !SP2013 - context.DisableReturnValueCache = true; + context.DisableReturnValueCache = true; #endif - var connectionType = ConnectionType.OnPrem; - if (url.Host.ToUpperInvariant().EndsWith("SHAREPOINT.COM")) - { - connectionType = ConnectionType.O365; - } - if (skipAdminCheck == false) - { - if (IsTenantAdminSite(context)) + var connectionType = ConnectionType.OnPrem; + if (url.Host.ToUpperInvariant().EndsWith("SHAREPOINT.COM")) { - connectionType = ConnectionType.TenantAdmin; + connectionType = ConnectionType.O365; } + if (skipAdminCheck == false) + { + if (IsTenantAdminSite(context)) + { + connectionType = ConnectionType.TenantAdmin; + } + } + var spoConnection = new PnPConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.InteractiveLogin); + spoConnection.ConnectionMethod = Model.ConnectionMethod.WebLogin; + return spoConnection; } - var spoConnection = new PnPConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.InteractiveLogin); - spoConnection.ConnectionMethod = Model.ConnectionMethod.WebLogin; - return spoConnection; } throw new Exception("Error establishing a connection, context is null"); } #endif +#if !NETSTANDARD2_1 internal static PnPConnection InstantiateSPOnlineConnection(Uri url, PSCredential credentials, PSHost host, bool currentCredentials, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, bool disableTelemetry, bool skipAdminCheck = false, ClientAuthenticationMode authenticationMode = ClientAuthenticationMode.Default) +#else + internal static PnPConnection InstantiateSPOnlineConnection(Uri url, PSCredential credentials, PSHost host, bool currentCredentials, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, bool disableTelemetry, bool skipAdminCheck = false) +#endif { var context = new PnPClientContext(url.AbsoluteUri); @@ -637,6 +654,7 @@ internal static PnPConnection InstantiateSPOnlineConnection(Uri url, PSCredentia #endif context.RequestTimeout = requestTimeout; +#if !NETSTANDARD2_1 context.AuthenticationMode = authenticationMode; if (authenticationMode == ClientAuthenticationMode.FormsAuthentication) @@ -644,12 +662,16 @@ internal static PnPConnection InstantiateSPOnlineConnection(Uri url, PSCredentia var formsAuthInfo = new FormsAuthenticationLoginInfo(credentials.UserName, EncryptionUtility.ToInsecureString(credentials.Password)); context.FormsAuthenticationLoginInfo = formsAuthInfo; } - +#endif if (!currentCredentials) { try { +#if !NETSTANDARD2_1 SharePointOnlineCredentials onlineCredentials = new SharePointOnlineCredentials(credentials.UserName, credentials.Password); +#else + var onlineCredentials = new System.Net.NetworkCredential(credentials.UserName, credentials.Password); +#endif context.Credentials = onlineCredentials; try { @@ -660,12 +682,14 @@ internal static PnPConnection InstantiateSPOnlineConnection(Uri url, PSCredentia { #if NETSTANDARD2_1 // Legacy auth is not supported with .NET Standard - throw nox; + throw new Exception("Legacy auth is not supported with .NET Standard"); #else // legacy auth? - var authManager = new OfficeDevPnP.Core.AuthenticationManager(); - context = PnPClientContext.ConvertFrom(authManager.GetAzureADCredentialsContext(url.ToString(), credentials.UserName, credentials.Password)); - context.ExecuteQueryRetry(); + using (var authManager = new OfficeDevPnP.Core.AuthenticationManager()) + { + context = PnPClientContext.ConvertFrom(authManager.GetAzureADCredentialsContext(url.ToString(), credentials.UserName, credentials.Password)); + context.ExecuteQueryRetry(); + } #endif } #endif @@ -742,100 +766,102 @@ internal static PnPConnection InstantiateSPOnlineConnection(Uri url, PSCredentia #if !NETSTANDARD2_1 internal static PnPConnection InstantiateAdfsConnection(Uri url, bool useKerberos, PSCredential credentials, PSHost host, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, bool disableTelemetry, bool skipAdminCheck = false, string loginProviderName = null) { - var authManager = new OfficeDevPnP.Core.AuthenticationManager(); - - string adfsHost; - string adfsRelyingParty; - OfficeDevPnP.Core.AuthenticationManager.GetAdfsConfigurationFromTargetUri(url, loginProviderName, out adfsHost, out adfsRelyingParty); - - if (string.IsNullOrEmpty(adfsHost) || string.IsNullOrEmpty(adfsRelyingParty)) + using (var authManager = new OfficeDevPnP.Core.AuthenticationManager()) { - throw new Exception("Cannot retrieve ADFS settings."); - } + string adfsHost; + string adfsRelyingParty; + OfficeDevPnP.Core.AuthenticationManager.GetAdfsConfigurationFromTargetUri(url, loginProviderName, out adfsHost, out adfsRelyingParty); - PnPClientContext context; - if (useKerberos) - { - context = PnPClientContext.ConvertFrom(authManager.GetADFSKerberosMixedAuthenticationContext(url.ToString(), - adfsHost, - adfsRelyingParty), - retryCount, - retryWait * 1000); - } - else - { - if (null == credentials) + if (string.IsNullOrEmpty(adfsHost) || string.IsNullOrEmpty(adfsRelyingParty)) { - throw new ArgumentNullException(nameof(credentials)); + throw new Exception("Cannot retrieve ADFS settings."); } - var networkCredentials = credentials.GetNetworkCredential(); - context = PnPClientContext.ConvertFrom(authManager.GetADFSUserNameMixedAuthenticatedContext(url.ToString(), - networkCredentials.UserName, - networkCredentials.Password, - networkCredentials.Domain, - adfsHost, - adfsRelyingParty), - retryCount, - retryWait * 1000); - } - context.RetryCount = retryCount; - context.Delay = retryWait * 1000; + PnPClientContext context; + if (useKerberos) + { + context = PnPClientContext.ConvertFrom(authManager.GetADFSKerberosMixedAuthenticationContext(url.ToString(), + adfsHost, + adfsRelyingParty), + retryCount, + retryWait * 1000); + } + else + { + if (null == credentials) + { + throw new ArgumentNullException(nameof(credentials)); + } + var networkCredentials = credentials.GetNetworkCredential(); + context = PnPClientContext.ConvertFrom(authManager.GetADFSUserNameMixedAuthenticatedContext(url.ToString(), + networkCredentials.UserName, + networkCredentials.Password, + networkCredentials.Domain, + adfsHost, + adfsRelyingParty), + retryCount, + retryWait * 1000); + } - context.ApplicationName = Resources.ApplicationName; - context.RequestTimeout = requestTimeout; + context.RetryCount = retryCount; + context.Delay = retryWait * 1000; + + context.ApplicationName = Resources.ApplicationName; + context.RequestTimeout = requestTimeout; #if !SP2013 - context.DisableReturnValueCache = true; + context.DisableReturnValueCache = true; #endif - var connectionType = ConnectionType.OnPrem; + var connectionType = ConnectionType.OnPrem; - if (skipAdminCheck == false) - { - if (IsTenantAdminSite(context)) + if (skipAdminCheck == false) { - connectionType = ConnectionType.TenantAdmin; + if (IsTenantAdminSite(context)) + { + connectionType = ConnectionType.TenantAdmin; + } } + var spoConnection = new PnPConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.ADFS); + spoConnection.ConnectionMethod = ConnectionMethod.ADFS; + return spoConnection; } - var spoConnection = new PnPConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.ADFS); - spoConnection.ConnectionMethod = ConnectionMethod.ADFS; - return spoConnection; } internal static PnPConnection InstantiateAdfsCertificateConnection(Uri url, string serialNumber, PSHost host, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, bool disableTelemetry, bool skipAdminCheck = false, string loginProviderName = null) { - var authManager = new OfficeDevPnP.Core.AuthenticationManager(); - - string adfsHost; - string adfsRelyingParty; - OfficeDevPnP.Core.AuthenticationManager.GetAdfsConfigurationFromTargetUri(url, loginProviderName, out adfsHost, out adfsRelyingParty); - - if (string.IsNullOrEmpty(adfsHost) || string.IsNullOrEmpty(adfsRelyingParty)) + using (var authManager = new OfficeDevPnP.Core.AuthenticationManager()) { - throw new Exception("Cannot retrieve ADFS settings."); - } + string adfsHost; + string adfsRelyingParty; + OfficeDevPnP.Core.AuthenticationManager.GetAdfsConfigurationFromTargetUri(url, loginProviderName, out adfsHost, out adfsRelyingParty); - var context = authManager.GetADFSCertificateMixedAuthenticationContext(url.ToString(), serialNumber, adfsHost, adfsRelyingParty); + if (string.IsNullOrEmpty(adfsHost) || string.IsNullOrEmpty(adfsRelyingParty)) + { + throw new Exception("Cannot retrieve ADFS settings."); + } - context.ApplicationName = Resources.ApplicationName; - context.RequestTimeout = requestTimeout; + var context = authManager.GetADFSCertificateMixedAuthenticationContext(url.ToString(), serialNumber, adfsHost, adfsRelyingParty); + + context.ApplicationName = Resources.ApplicationName; + context.RequestTimeout = requestTimeout; #if !ONPREMISES - context.DisableReturnValueCache = true; + context.DisableReturnValueCache = true; #elif SP2016 || SP2019 - context.DisableReturnValueCache = true; + context.DisableReturnValueCache = true; #endif - var connectionType = ConnectionType.OnPrem; + var connectionType = ConnectionType.OnPrem; - if (skipAdminCheck == false) - { - if (IsTenantAdminSite(context)) + if (skipAdminCheck == false) { - connectionType = ConnectionType.TenantAdmin; + if (IsTenantAdminSite(context)) + { + connectionType = ConnectionType.TenantAdmin; + } } + var spoConnection = new PnPConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.ADFS); + spoConnection.ConnectionMethod = ConnectionMethod.ADFS; + return spoConnection; } - var spoConnection = new PnPConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, url.ToString(), tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry, InitializationType.ADFS); - spoConnection.ConnectionMethod = ConnectionMethod.ADFS; - return spoConnection; } #endif @@ -893,7 +919,6 @@ private static bool IsTenantAdminSite(ClientRuntimeContext clientContext) { using (var clonedContext = clientContext.Clone(clientContext.Url)) { - var tenant = new Tenant(clonedContext); clonedContext.ExecuteQueryRetry(); return true; diff --git a/Commands/Diagnostic/MeasureResponseTime.cs b/Commands/Diagnostic/MeasureResponseTime.cs index 84401921e..1adf7acef 100644 --- a/Commands/Diagnostic/MeasureResponseTime.cs +++ b/Commands/Diagnostic/MeasureResponseTime.cs @@ -1,4 +1,5 @@ -using System; +#if !NETSTANDARD2_1 +using System; using System.Net; using System.Linq; using System.Threading; @@ -243,3 +244,4 @@ private Uri GetEndpointUri() } } } +#endif \ No newline at end of file diff --git a/Commands/Graph/ResetUnifiedGroupExpiration.cs b/Commands/Graph/ResetUnifiedGroupExpiration.cs index 29a30c653..f7d528bc0 100644 --- a/Commands/Graph/ResetUnifiedGroupExpiration.cs +++ b/Commands/Graph/ResetUnifiedGroupExpiration.cs @@ -1,4 +1,4 @@ -#if !ONPREMISES +#if !ONPREMISES && !NETSTANDARD2_1 using OfficeDevPnP.Core.Framework.Graph; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base; diff --git a/Commands/PnPPowerShell.csproj b/Commands/PnPPowerShell.csproj index 669dccd09..45556dcf0 100644 --- a/Commands/PnPPowerShell.csproj +++ b/Commands/PnPPowerShell.csproj @@ -32,7 +32,8 @@ - + + @@ -54,12 +55,51 @@ + + ..\..\PnP-Sites-Core\Assemblies\core\Microsoft.Office.Client.Policy.dll + + + ..\..\PnP-Sites-Core\Assemblies\core\Microsoft.Office.Client.TranslationServices.dll + + + ..\..\PnP-Sites-Core\Assemblies\core\Microsoft.Office.SharePoint.Tools.dll + + + ..\..\PnP-Sites-Core\Assemblies\core\Microsoft.Online.SharePoint.Client.Tenant.dll + + + ..\..\PnP-Sites-Core\Assemblies\core\Microsoft.ProjectServer.Client.dll + + + ..\..\PnP-Sites-Core\Assemblies\core\Microsoft.SharePoint.Client.dll + + + ..\..\PnP-Sites-Core\Assemblies\core\Microsoft.SharePoint.Client.DocumentManagement.dll + + + ..\..\PnP-Sites-Core\Assemblies\core\Microsoft.SharePoint.Client.Publishing.dll + + + ..\..\PnP-Sites-Core\Assemblies\core\Microsoft.SharePoint.Client.Runtime.dll + + + ..\..\PnP-Sites-Core\Assemblies\core\Microsoft.SharePoint.Client.Search.dll + + + ..\..\PnP-Sites-Core\Assemblies\core\Microsoft.SharePoint.Client.Search.Applications.dll + + + ..\..\PnP-Sites-Core\Assemblies\core\Microsoft.SharePoint.Client.Taxonomy.dll + + + ..\..\PnP-Sites-Core\Assemblies\core\Microsoft.SharePoint.Client.UserProfiles.dll + + + ..\..\PnP-Sites-Core\Assemblies\core\Microsoft.SharePoint.Client.WorkflowServices.dll + ..\..\PnP-Sites-Core\Core\OfficeDevPnP.Core\bin\DebugCore\OfficeDevPnP.Core.dll - - ..\..\PnP-Sites-Core\Assemblies\16.1\SharePointPnP.Client.dll - @@ -78,7 +118,7 @@ - + diff --git a/Commands/Properties/AssemblyInfo.cs b/Commands/Properties/AssemblyInfo.cs index 071632fe6..c3a6d22b2 100644 --- a/Commands/Properties/AssemblyInfo.cs +++ b/Commands/Properties/AssemblyInfo.cs @@ -48,6 +48,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.22.2006.0")] -[assembly: AssemblyFileVersion("3.22.2006.0")] +[assembly: AssemblyVersion("3.22.2006.1")] +[assembly: AssemblyFileVersion("3.22.2006.1")] [assembly: InternalsVisibleTo("SharePointPnP.PowerShell.Tests")] \ No newline at end of file diff --git a/Commands/Provider/SPOContentReaderWriter.cs b/Commands/Provider/SPOContentReaderWriter.cs index 90afd4356..1c4bbc572 100644 --- a/Commands/Provider/SPOContentReaderWriter.cs +++ b/Commands/Provider/SPOContentReaderWriter.cs @@ -63,7 +63,11 @@ public IList Write(IList content) _streamWriter.Flush(); _stream.Position = 0; +#if NETSTANDARD2_1 + _file.SaveBinary(new FileSaveBinaryInformation()); +#else File.SaveBinaryDirect((_file.Context as ClientContext), _file.ServerRelativeUrl, _stream, true); +#endif return content; } diff --git a/Commands/Provider/SPOProvider.cs b/Commands/Provider/SPOProvider.cs index 4fac2b286..35d423a8d 100644 --- a/Commands/Provider/SPOProvider.cs +++ b/Commands/Provider/SPOProvider.cs @@ -537,7 +537,11 @@ public void ClearContent(string path) if (ShouldProcess($"Clear content from {GetServerRelativePath(path)}")) { var file = obj as File; +#if NETSTANDARD2_1 + file.SaveBinary(new FileSaveBinaryInformation()); +#else File.SaveBinaryDirect(file.Context as ClientContext, file.ServerRelativeUrl, Stream.Null, true); +#endif } } } @@ -547,7 +551,7 @@ public object ClearContentDynamicParameters(string path) return null; } - #region Helpers +#region Helpers //Get helpers private object GetFileOrFolder(string path, bool throwError = true, bool useCache = true) @@ -1144,6 +1148,6 @@ private void SetCachedWeb(string serverRelativePath, Web web) }); } - #endregion +#endregion } } diff --git a/Commands/Provisioning/Site/AddFileToProvisioningTemplate.cs b/Commands/Provisioning/Site/AddFileToProvisioningTemplate.cs index 4e6b7a521..3dbce53a1 100644 --- a/Commands/Provisioning/Site/AddFileToProvisioningTemplate.cs +++ b/Commands/Provisioning/Site/AddFileToProvisioningTemplate.cs @@ -97,7 +97,11 @@ protected override void ProcessRecord() var fileName = file.EnsureProperty(f => f.Name); var folderRelativeUrl = serverRelativeUrl.Substring(0, serverRelativeUrl.Length - fileName.Length - 1); +#if !NETSTANDARD2_1 var folderWebRelativeUrl = HttpUtility.UrlKeyValueDecode(folderRelativeUrl.Substring(SelectedWeb.ServerRelativeUrl.TrimEnd('/').Length + 1)); +#else + var folderWebRelativeUrl = System.Web.HttpUtility.UrlDecode(folderRelativeUrl.Substring(SelectedWeb.ServerRelativeUrl.TrimEnd('/').Length + 1)); +#endif if (ClientContext.HasPendingRequest) ClientContext.ExecuteQuery(); try { diff --git a/Commands/Utilities/AzureAuthHelper.cs b/Commands/Utilities/AzureAuthHelper.cs index bdba90f5b..0dfb793a3 100644 --- a/Commands/Utilities/AzureAuthHelper.cs +++ b/Commands/Utilities/AzureAuthHelper.cs @@ -1,4 +1,5 @@ -using Microsoft.Azure.ActiveDirectory.GraphClient; +#if !NETSTANDARD2_1 +using Microsoft.Azure.ActiveDirectory.GraphClient; using Microsoft.Azure.ActiveDirectory.GraphClient.Internal; using Microsoft.Identity.Client; using System; @@ -107,3 +108,4 @@ internal static void OpenConsentFlow(string url, Action messageAction) } } } +#endif \ No newline at end of file From b09e987e92ae5ad3f4114edd6c15d5785ca73e5d Mon Sep 17 00:00:00 2001 From: Erwin van Hunen Date: Tue, 9 Jun 2020 17:54:24 +0200 Subject: [PATCH 2/2] June 2020 Intermediate Release 1 --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index f82280631..2fb930e9c 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -3.22.2006.0 \ No newline at end of file +3.22.2006.1 \ No newline at end of file