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

Commit 4c7bc2d

Browse files
Merge pull request #1546 from erwinvanhunen/dev
on-prem build fixes
2 parents ab89fa4 + 14024a6 commit 4c7bc2d

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

Commands/Base/ConnectOnline.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,11 +579,11 @@ protected override void ProcessRecord()
579579
#if ONPREMISES
580580
else if (ParameterSetName == ParameterSet_HIGHTRUST_CERT)
581581
{
582-
connection = SPOnlineConnectionHelper.InstantiateHighTrustConnection(Url, ClientId, HighTrustCertificate, HighTrustCertificateIssuerId ?? ClientId, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, SkipTenantAdminCheck);
582+
connection = SPOnlineConnectionHelper.InstantiateHighTrustConnection(Url, ClientId, HighTrustCertificate, HighTrustCertificateIssuerId ?? ClientId, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, NoTelemetry, SkipTenantAdminCheck);
583583
}
584584
else if (ParameterSetName == ParameterSet_HIGHTRUST_PFX)
585585
{
586-
connection = SPOnlineConnectionHelper.InstantiateHighTrustConnection(Url, ClientId, HighTrustCertificatePath, HighTrustCertificatePassword, HighTrustCertificateIssuerId ?? ClientId, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, SkipTenantAdminCheck);
586+
connection = SPOnlineConnectionHelper.InstantiateHighTrustConnection(Url, ClientId, HighTrustCertificatePath, HighTrustCertificatePassword, HighTrustCertificateIssuerId ?? ClientId, MinimalHealthScore, RetryCount, RetryWait, RequestTimeout, TenantAdminUrl, Host, NoTelemetry, SkipTenantAdminCheck);
587587
}
588588
#endif
589589
else

Commands/Base/SPOnlineConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ internal void InitializeTelemetry(ClientContext context, PSHost host)
202202
var choices = new System.Collections.ObjectModel.Collection<ChoiceDescription>();
203203
choices.Add(new ChoiceDescription("&Allow", "You will allow us to transmit anonymous data"));
204204
choices.Add(new ChoiceDescription("&Do not allow", "You do not allow us to transmit anonymous data"));
205-
if (host.UI.PromptForChoice("Telemetry", "Please allow us to transmit anonymous metrics in order to make PnP PowerShell even better. We transmit the version of PnP PowerShell you are using, the version of SharePoint you are connecting to and which cmdlet you are executing. We do not transmit tenant/server URLs nor parameter values and content.", choices, 0) == 0)
205+
if (host.UI.PromptForChoice("PnP PowerShell Telemetry", $"Please allow us to transmit anonymous metrics in order to make PnP PowerShell even better.{Environment.NewLine}We transmit the version of PnP PowerShell you are using, the version of SharePoint you are connecting to and which cmdlet you are executing. We do not transmit tenant/server URLs nor parameter values and content.{Environment.NewLine}{Environment.NewLine}Your decision will be recorded in a file a called .pnppowershelltelemetry which will be located in your profile folder ({userProfile}).{Environment.NewLine}{Environment.NewLine}You can choose to disable and/or enable telemetry at a later stage by using Enable-PnPPowerShellTelemetry or Disable-PnPPowerShellTelemetry. Get-PnPPowerShellTelemetryEnabled will provide you with your current setting.", choices, 0) == 0)
206206
{
207207
enableTelemetry = true;
208208
System.IO.File.WriteAllText(telemetryFile, "allow");

Commands/Base/SPOnlineConnectionHelper.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,23 @@ internal static SPOnlineConnection InstantiateSPOnlineConnection(Uri url, string
7777

7878
#if !NETSTANDARD2_0
7979
#if ONPREMISES
80-
internal static SPOnlineConnection InstantiateHighTrustConnection(string url, string clientId, string hightrustCertificatePath, string hightrustCertificatePassword, string hightrustCertificateIssuerId, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, PSHost host, bool skipAdminCheck = false)
80+
internal static SPOnlineConnection 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)
8181
{
8282
var authManager = new OfficeDevPnP.Core.AuthenticationManager();
8383
var context = authManager.GetHighTrustCertificateAppOnlyAuthenticatedContext(url, clientId, hightrustCertificatePath, hightrustCertificatePassword, hightrustCertificateIssuerId);
8484

85-
return InstantiateHighTrustConnection(context, url, minimalHealthScore, retryCount, retryWait, requestTimeout, tenantAdminUrl, host, skipAdminCheck);
85+
return InstantiateHighTrustConnection(context, url, minimalHealthScore, retryCount, retryWait, requestTimeout, tenantAdminUrl, host, disableTelemetry, skipAdminCheck);
8686
}
8787

88-
internal static SPOnlineConnection 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 skipAdminCheck = false)
88+
internal static SPOnlineConnection 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)
8989
{
9090
var authManager = new OfficeDevPnP.Core.AuthenticationManager();
9191
var context = authManager.GetHighTrustCertificateAppOnlyAuthenticatedContext(url, clientId, hightrustCertificate, hightrustCertificateIssuerId);
9292

93-
return InstantiateHighTrustConnection(context, url, minimalHealthScore, retryCount, retryWait, requestTimeout, tenantAdminUrl, host, skipAdminCheck);
93+
return InstantiateHighTrustConnection(context, url, minimalHealthScore, retryCount, retryWait, requestTimeout, tenantAdminUrl, host, disableTelemetry, skipAdminCheck);
9494
}
9595

96-
private static SPOnlineConnection InstantiateHighTrustConnection(ClientContext context, string url, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, PSHost host, bool skipAdminCheck = false)
96+
private static SPOnlineConnection InstantiateHighTrustConnection(ClientContext context, string url, int minimalHealthScore, int retryCount, int retryWait, int requestTimeout, string tenantAdminUrl, PSHost host, bool disableTelemetry, bool skipAdminCheck)
9797
{
9898
context.ApplicationName = Properties.Resources.ApplicationName;
9999
context.RequestTimeout = requestTimeout;
@@ -108,7 +108,7 @@ private static SPOnlineConnection InstantiateHighTrustConnection(ClientContext c
108108
connectionType = ConnectionType.TenantAdmin;
109109
}
110110
}
111-
return new SPOnlineConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, url, tenantAdminUrl, PnPPSVersionTag, host);
111+
return new SPOnlineConnection(context, connectionType, minimalHealthScore, retryCount, retryWait, null, url, tenantAdminUrl, PnPPSVersionTag, host, disableTelemetry);
112112
}
113113
#endif
114114
#endif

Tests/WebhookSubscriptionsTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.SharePoint.Client;
1+
#if !ONPREMISES
2+
using Microsoft.SharePoint.Client;
23
using Microsoft.VisualStudio.TestTools.UnitTesting;
34
using OfficeDevPnP.Core.Entities;
45
using System;
@@ -30,6 +31,7 @@ private List EnsureFreshTestList(ClientContext ctx)
3031
return list;
3132
}
3233

34+
3335
[TestMethod]
3436
public void AddListWebhookSubscriptionTest()
3537
{
@@ -149,3 +151,4 @@ public void SetListWebhookSubscriptionTest()
149151
}
150152
}
151153
}
154+
#endif

0 commit comments

Comments
 (0)