From f56a617faf1de52f78e5e7130f18e39ccb53cdec Mon Sep 17 00:00:00 2001
From: Release-Agent <>
Date: Fri, 14 Jul 2023 15:04:43 +0000
Subject: [PATCH] ''
---
src/Build.Shared.props | 6 ++--
.../Client/ConnectionService.cs | 6 ++--
...soft.PowerPlatform.Dataverse.Client.csproj | 1 +
.../DataverseClient/Client/ServiceClient.cs | 19 ++++++++---
.../ServiceClientTests.cs | 34 ++++++++++++++++---
...rPlatform.Dataverse.Client.Dynamics.nuspec | 4 +--
...Platform.Dataverse.Client.ReleaseNotes.txt | 8 +++++
...soft.PowerPlatform.Dataverse.Client.nuspec | 9 ++---
8 files changed, 66 insertions(+), 21 deletions(-)
diff --git a/src/Build.Shared.props b/src/Build.Shared.props
index 7d8b708..370e72a 100644
--- a/src/Build.Shared.props
+++ b/src/Build.Shared.props
@@ -12,14 +12,16 @@
4.9.3165-v9.0-weekly-2304.2
4.6.6061-weekly-2108.5
13.0.1
- 2.3.20
+ 2.3.24
9.0.2.48
9.0.2.34
3.0.8
0.4.20
3.1.0
3.1.8
- 6.0.0
+ 6.0.0
+ 7.0.3
+ 7.0.0
17.5.0
diff --git a/src/GeneralTools/DataverseClient/Client/ConnectionService.cs b/src/GeneralTools/DataverseClient/Client/ConnectionService.cs
index ca19ddd..5649741 100644
--- a/src/GeneralTools/DataverseClient/Client/ConnectionService.cs
+++ b/src/GeneralTools/DataverseClient/Client/ConnectionService.cs
@@ -139,7 +139,7 @@ namespace Microsoft.PowerPlatform.Dataverse.Client
///
/// Client or App Id to use.
///
- private string _clientId;
+ internal string _clientId;
///
/// uri specifying the redirection uri post OAuth auth
@@ -149,7 +149,7 @@ namespace Microsoft.PowerPlatform.Dataverse.Client
///
/// Resource to connect to
///
- private string _resource;
+ internal string _resource;
///
/// cached authority reading from credential manager
@@ -1570,7 +1570,7 @@ namespace Microsoft.PowerPlatform.Dataverse.Client
if (dvService != null)
{
- OrganizationVersion = Version.Parse("9.0");
+ OrganizationVersion = Version.Parse("9.0.0.0");
//await GetServerVersion(dvService, _targetInstanceUriToConnectTo).ConfigureAwait(false);
//await RefreshInstanceDetails(dvService, _targetInstanceUriToConnectTo).ConfigureAwait(false);
// Format the URL for WebAPI service.
diff --git a/src/GeneralTools/DataverseClient/Client/Microsoft.PowerPlatform.Dataverse.Client.csproj b/src/GeneralTools/DataverseClient/Client/Microsoft.PowerPlatform.Dataverse.Client.csproj
index 7fb5adf..a6bdd10 100644
--- a/src/GeneralTools/DataverseClient/Client/Microsoft.PowerPlatform.Dataverse.Client.csproj
+++ b/src/GeneralTools/DataverseClient/Client/Microsoft.PowerPlatform.Dataverse.Client.csproj
@@ -45,6 +45,7 @@
+
diff --git a/src/GeneralTools/DataverseClient/Client/ServiceClient.cs b/src/GeneralTools/DataverseClient/Client/ServiceClient.cs
index d3cf36c..f775e75 100644
--- a/src/GeneralTools/DataverseClient/Client/ServiceClient.cs
+++ b/src/GeneralTools/DataverseClient/Client/ServiceClient.cs
@@ -300,10 +300,19 @@ namespace Microsoft.PowerPlatform.Dataverse.Client
if (_connectionSvc != null && (
_connectionSvc.AuthenticationTypeInUse == AuthenticationType.OAuth ||
_connectionSvc.AuthenticationTypeInUse == AuthenticationType.Certificate ||
- _connectionSvc.AuthenticationTypeInUse == AuthenticationType.ExternalTokenManagement ||
_connectionSvc.AuthenticationTypeInUse == AuthenticationType.ClientSecret))
{
- return _connectionSvc.RefreshClientTokenAsync().ConfigureAwait(false).GetAwaiter().GetResult();
+ if (_connectionSvc._authenticationResultContainer != null && !string.IsNullOrEmpty(_connectionSvc._resource) && !string.IsNullOrEmpty(_connectionSvc._clientId))
+ {
+ if (_connectionSvc._authenticationResultContainer.ExpiresOn.ToUniversalTime() < DateTime.UtcNow.AddMinutes(1))
+ {
+ // Force a refresh if the token is about to expire
+ return _connectionSvc.RefreshClientTokenAsync().ConfigureAwait(false).GetAwaiter().GetResult();
+ }
+ return _connectionSvc._authenticationResultContainer.AccessToken;
+ }
+ // if not configured, return empty string
+ return string.Empty;
}
else
return string.Empty;
@@ -512,7 +521,7 @@ namespace Microsoft.PowerPlatform.Dataverse.Client
if (_connectionSvc?.OrganizationVersion != null)
{
_connectionSvc.CallerAADObjectId = null; // Null value as this is not supported for this version.
- _logEntry.Log($"Setting CallerAADObject ID not supported in version {_connectionSvc?.OrganizationVersion}");
+ _logEntry.Log($"Setting CallerAADObject ID not supported in version {_connectionSvc?.OrganizationVersion}. Dataverse version {Utilities.FeatureVersionMinimums.AADCallerIDSupported} or higher is required.", TraceEventType.Warning);
}
}
}
@@ -544,7 +553,7 @@ namespace Microsoft.PowerPlatform.Dataverse.Client
if (_connectionSvc?.OrganizationVersion != null)
{
_connectionSvc.SessionTrackingId = null; // Null value as this is not supported for this version.
- _logEntry.Log($"Setting SessionTrackingId ID not supported in version {_connectionSvc?.OrganizationVersion}");
+ _logEntry.Log($"Setting SessionTrackingId ID not supported in version {_connectionSvc?.OrganizationVersion}. Dataverse version {Utilities.FeatureVersionMinimums.SessionTrackingSupported} or greater is required.", TraceEventType.Warning);
}
}
}
@@ -576,7 +585,7 @@ namespace Microsoft.PowerPlatform.Dataverse.Client
if (_connectionSvc?.OrganizationVersion != null)
{
_connectionSvc.ForceServerCacheConsistency = false; // Null value as this is not supported for this version.
- _logEntry.Log($"Setting ForceServerMetadataCacheConsistency not supported in version {_connectionSvc?.OrganizationVersion}");
+ _logEntry.Log($"Setting ForceServerMetadataCacheConsistency not supported in version {_connectionSvc?.OrganizationVersion}. Dataverse version {Utilities.FeatureVersionMinimums.ForceConsistencySupported} or higher is required." , TraceEventType.Warning);
}
}
}
diff --git a/src/GeneralTools/DataverseClient/UnitTests/CdsClient_Core_Tests/ServiceClientTests.cs b/src/GeneralTools/DataverseClient/UnitTests/CdsClient_Core_Tests/ServiceClientTests.cs
index 14a6dd3..fee6f01 100644
--- a/src/GeneralTools/DataverseClient/UnitTests/CdsClient_Core_Tests/ServiceClientTests.cs
+++ b/src/GeneralTools/DataverseClient/UnitTests/CdsClient_Core_Tests/ServiceClientTests.cs
@@ -743,9 +743,8 @@ namespace Client_Core_Tests
[SkippableConnectionTest]
[Trait("Category", "Live Connect Required")]
- public void RetrieveSolutionImportResultAsyncTest()
+ public void RetrieveSolutionImportResultAsyncTestWithSyncImport()
{
- // Import
var client = CreateServiceClient();
if (!Utilities.FeatureVersionMinimums.IsFeatureValidForEnviroment(client._connectionSvc?.OrganizationVersion, Utilities.FeatureVersionMinimums.AllowRetrieveSolutionImportResult))
{
@@ -754,11 +753,9 @@ namespace Client_Core_Tests
return;
}
+ // import solution without async
client.ImportSolution(Path.Combine("TestData", "TestSolution_1_0_0_1.zip"), out var importId);
- // Wait a little bit because solution might not be immediately available
- System.Threading.Thread.Sleep(30000);
-
// Response doesn't include formatted results
var resWithoutFormatted = client.RetrieveSolutionImportResultAsync(importId);
resWithoutFormatted.Should().NotBeNull();
@@ -769,6 +766,33 @@ namespace Client_Core_Tests
resWithFormatted.FormattedResults.Should().NotBeEmpty();
}
+ [SkippableConnectionTest]
+ [Trait("Category", "Live Connect Required")]
+ public void RetrieveSolutionImportResultAsyncTestWithAsyncImport()
+ {
+ var client = CreateServiceClient();
+ if (!Utilities.FeatureVersionMinimums.IsFeatureValidForEnviroment(client._connectionSvc?.OrganizationVersion, Utilities.FeatureVersionMinimums.AllowRetrieveSolutionImportResult))
+ {
+ // Not supported on this version of Dataverse
+ client._logEntry.Log($"RetrieveSolutionImportResultAsync request is calling RetrieveSolutionImportResult API. This request requires Dataverse version {Utilities.FeatureVersionMinimums.AllowRetrieveSolutionImportResult.ToString()} or above. The current Dataverse version is {client._connectionSvc?.OrganizationVersion}. This request cannot be made", TraceEventType.Warning);
+ return;
+ }
+ // import solution with async
+ client.ImportSolutionAsync(Path.Combine("TestData", "TestSolution_1_0_0_1.zip"), out var asyncImportId);
+
+ // Wait a little bit because solution might not be immediately available
+ System.Threading.Thread.Sleep(30000);
+
+ // Response doesn't include formatted results
+ var resWithoutFormatted = client.RetrieveSolutionImportResultAsync(asyncImportId);
+ resWithoutFormatted.Should().NotBeNull();
+
+ // Response include formatted results
+ var resWithFormatted = client.RetrieveSolutionImportResultAsync(asyncImportId, true);
+ resWithFormatted.Should().NotBeNull();
+ resWithFormatted.FormattedResults.Should().NotBeEmpty();
+ }
+
[SkippableConnectionTest]
[Trait("Category", "Live Connect Required")]
public void ConnectUsingServiceIdentity_ClientSecret_CtorV1()
diff --git a/src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.Dynamics.nuspec b/src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.Dynamics.nuspec
index 248e9f5..7ff9d3b 100644
--- a/src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.Dynamics.nuspec
+++ b/src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.Dynamics.nuspec
@@ -9,8 +9,8 @@
https://github.com/microsoft/PowerPlatform-DataverseServiceClient
images\Dataverse.128x128.png
true
- This package contains the .net core ServiceClient Dynamics Extensions. Used to connect to Microsoft Dataverse. This Package has been authored by the Microsoft Dataverse SDK team.
- ServiceClient and supporting libraries for use in building client applications to interact with the Dataverse
+ This package contains a set of Dynamics 365 specific extensions, used with the Dataverse ServiceClient. This Package has been authored by the Microsoft Dataverse SDK team.
+ This package contains a set of Dynamics 365 specific extensions, used with the Dataverse ServiceClient.
© Microsoft Corporation. All rights reserved.
Dynamics CommonDataService CDS PowerApps PowerPlatform ServiceClient Dataverse
diff --git a/src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.ReleaseNotes.txt b/src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.ReleaseNotes.txt
index 84cca9f..f27ad8c 100644
--- a/src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.ReleaseNotes.txt
+++ b/src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.ReleaseNotes.txt
@@ -7,6 +7,14 @@ Notice:
Note: Only AD on FullFramework, OAuth, Certificate, ClientSecret Authentication types are supported at this time.
++CURRENTRELEASEID++
+Refactored CurrentAccessToken property to avoid async call.
+Fix for min version of default client, pre-connection so it is recognized by features that require 9.0 or greater.
+Fix for notification of unsupported features when not 'breaking' to alert as 'warnings' in log vs information.
+Dependency changes:
+ Microsoft.Rest.Client moved to 2.3.24 due to CVE-2022-26907.
+
+
+1.1.9:
REMOVED .net 3.1 and .net 5 support as they are out of support frameworks.
Added new DiscoverOnlineOrganizationsAsync which supports CancellationToken
Added new RetrieveSolutionImportResultAsync for retrieving solution import result from Dataverse
diff --git a/src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.nuspec b/src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.nuspec
index 576015c..f93f8cf 100644
--- a/src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.nuspec
+++ b/src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.nuspec
@@ -21,7 +21,7 @@
-
+
@@ -32,7 +32,7 @@
-
+
@@ -43,7 +43,7 @@
-
+
@@ -67,7 +67,7 @@
-
+
@@ -75,6 +75,7 @@
+