Skip to content

Commit 7b19d84

Browse files
authored
Merge pull request #2421 from MicrosoftDocs/pehecke-solution-async
Solution import/export async APIs
2 parents 8ebb9db + 6c95281 commit 7b19d84

File tree

9 files changed

+297
-25
lines changed

9 files changed

+297
-25
lines changed

.openpublishing.publish.config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@
5757
"url": "https://github.com/Microsoft/templates.docs.msft.pdf",
5858
"branch": "main",
5959
"branch_mapping": {}
60+
},
61+
{
62+
"path_to_root": "powerapps-samples",
63+
"url": "https://github.com/microsoft/PowerApps-Samples",
64+
"branch": "master",
65+
"branch_mapping": {}
6066
}
6167
],
6268
"branch_target_mapping": {

power-platform/alm/TOC.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,15 @@
126126
href: checker-api/retrieve-rulesets.md
127127
- name: Upload a file for analysis
128128
href: checker-api/upload-file.md
129-
- name: Manage solutions using custom code
129+
- name: Manage solutions using code
130130
href:
131131
items:
132132
- name: Use PowerShell
133133
href: powershell-api.md
134-
- name: Work with solutions (SDK API)
134+
- name: Work with solutions
135135
href: solution-api.md
136+
- name: Stage, import, and export
137+
href: solution-async.md
136138
- name: Create patches
137139
href: create-patches-simplify-solution-updates.md
138140
- name: Edit the customizations file

power-platform/alm/solution-api.md

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
---
2-
title: "Work with solutions using the SDK APIs | Microsoft Docs"
3-
description: "Learn about the APIs that are available to manage Microsoft Dataverse solutions."
2+
title: "Work with solutions using the Dataverse SDK | Microsoft Docs"
3+
description: "Learn about the .NET APIs that are available to manage Microsoft Dataverse solutions."
44
keywords:
55
author: mikkelsen2000
6-
ms.subservice: alm
6+
ms.service: powerapps
77
ms.author: pemikkel
88
manager: kvivek
99
ms.custom: ""
10-
ms.date: 05/05/2020
11-
ms.reviewer: "pehecke"
12-
10+
ms.date: 04/05/2022
11+
ms.reviewer: pehecke
1312
ms.topic: "article"
1413
search.audienceType:
1514
- developer
@@ -18,15 +17,15 @@ search.app:
1817
- D365CE
1918
---
2019

21-
# Work with solutions using the SDK APIs
20+
# Work with solutions using the Dataverse SDK
2221

2322
As part of your development to production lifecycle you may want to create
2423
custom automation to handle certain tasks. For example, in your DevOps project
2524
pipeline you might want to execute some custom code or script that creates a
2625
sandbox environment, imports an unmanaged solution, exports that unmanaged
2726
solution as a managed solution, and, finally, deletes the environment. You can do
2827
this and more by using the APIs that are available to you. Below are some examples
29-
of what you can accomplish using the .NET SDK APIs, the SOAP 2011 endpoint, and custom code.
28+
of what you can accomplish using the [Dataverse SDK for .NET](https://www.nuget.org/packages/Microsoft.CrmSdk.CoreAssemblies/) and custom code.
3029

3130
> [!NOTE]
3231
> You can also perform these same operations using the Web API. The related actions are: [ImportSolution](/dynamics365/customer-engagement/web-api/importsolution), [ExportSolution](/dynamics365/customer-engagement/web-api/exportsolution), [CloneAsPatch](/dynamics365/customer-engagement/web-api/cloneaspatch), and [CloneAsSolution](/dynamics365/customer-engagement/web-api/cloneassolution).
@@ -135,7 +134,7 @@ Solution solution = new Solution
135134
Version = "1.0"
136135
};
137136

138-
//Check whether the solution already exists
137+
// Check whether the solution already exists
139138
QueryExpression queryCheckForSampleSolution = new QueryExpression
140139
{
141140
EntityName = Solution.EntityLogicalName,
@@ -322,7 +321,7 @@ The following code uses the <xref:Microsoft.Crm.Sdk.Messages.AddSolutionComponen
322321

323322
```csharp
324323
// Add an existing Solution Component
325-
//Add the Account entity to the solution
324+
// Add the Account entity to the solution
326325
RetrieveEntityRequest retrieveForAddAccountRequest = new RetrieveEntityRequest()
327326
{
328327
LogicalName = Account.EntityLogicalName
@@ -342,8 +341,8 @@ _serviceProxy.Execute(addReq);
342341
This sample shows how to remove a solution component from an unmanaged solution. The following code uses the <xref:Microsoft.Crm.Sdk.Messages.RemoveSolutionComponentRequest> to remove an entity solution component from an unmanaged solution. The `solution.UniqueName` references the solution created in [Create an unmanaged solution](#create-an-unmanaged-solution).
343342

344343
```csharp
345-
// Remove a Solution Component
346-
//Remove the Account entity from the solution
344+
// Remove a Solution Component
345+
// Remove the Account entity from the solution
347346
RetrieveEntityRequest retrieveForRemoveAccountRequest = new RetrieveEntityRequest()
348347
{
349348
LogicalName = Account.EntityLogicalName
@@ -459,20 +458,20 @@ The `DependencyReport` method is in the following code sample.
459458
460459
```csharp
461460
/// <summary>
462-
/// Shows how to get a more friendly message based on information within the dependency
463-
/// <param name="dependency">A Dependency returned from the RetrieveDependentComponents message</param>
464-
/// </summary>
461+
/// Shows how to get a more friendly message based on information within the dependency
462+
/// <param name="dependency">A Dependency returned from the RetrieveDependentComponents message</param>
463+
/// </summary>
465464
public void DependencyReport(Dependency dependency)
466-
{
467-
//These strings represent parameters for the message.
465+
{
466+
// These strings represent parameters for the message.
468467
String dependentComponentName = "";
469468
String dependentComponentTypeName = "";
470469
String dependentComponentSolutionName = "";
471470
String requiredComponentName = "";
472471
String requiredComponentTypeName = "";
473472
String requiredComponentSolutionName = "";
474473

475-
//The ComponentType global Option Set contains options for each possible component.
474+
// The ComponentType global Option Set contains options for each possible component.
476475
RetrieveOptionSetRequest componentTypeRequest = new RetrieveOptionSetRequest
477476
{
478477
Name = "componenttype"
@@ -492,7 +491,7 @@ public void DependencyReport(Dependency dependency)
492491
requiredComponentTypeName = opt.Label.UserLocalizedLabel.Label;
493492
}
494493
}
495-
//The name or display name of the compoent is retrieved in different ways depending on the component type
494+
// The name or display name of the compoent is retrieved in different ways depending on the component type
496495
dependentComponentName = getComponentName(dependency.DependentComponentType.Value, (Guid)dependency.DependentComponentObjectId);
497496
requiredComponentName = getComponentName(dependency.RequiredComponentType.Value, (Guid)dependency.RequiredComponentObjectId);
498497

@@ -514,15 +513,15 @@ public void DependencyReport(Dependency dependency)
514513
);
515514
requiredComponentSolutionName = requiredSolution.FriendlyName;
516515

517-
//Display the message
516+
// Display the message
518517
Console.WriteLine("The {0} {1} in the {2} depends on the {3} {4} in the {5} solution.",
519518
dependentComponentName,
520519
dependentComponentTypeName,
521520
dependentComponentSolutionName,
522521
requiredComponentName,
523522
requiredComponentTypeName,
524523
requiredComponentSolutionName);
525-
}
524+
}
526525
```
527526

528527
### Detect whether a solution component may be deleted
@@ -545,7 +544,7 @@ RetrieveOptionSetResponse retrieveOptionSetResponse =
545544
_globalOptionSetId = retrieveOptionSetResponse.OptionSetMetadata.MetadataId;
546545
if (_globalOptionSetId != null)
547546
{
548-
//Use the global OptionSet MetadataId with the appropriate componenttype
547+
// Use the global OptionSet MetadataId with the appropriate componenttype
549548
// to call RetrieveDependenciesForDeleteRequest
550549
RetrieveDependenciesForDeleteRequest retrieveDependenciesForDeleteRequest = new RetrieveDependenciesForDeleteRequest
551550
{
@@ -581,5 +580,4 @@ if (_globalOptionSetId != null)
581580
}
582581
```
583582

584-
585583
[!INCLUDE[footer-include](../includes/footer-banner.md)]

0 commit comments

Comments
 (0)