Skip to content

Commit

Permalink
Merge branch 'master' into v-ljoel-how-to-architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
tapanm-MSFT committed Jun 25, 2021
2 parents e6b9195 + ee823da commit 5aa53f3
Show file tree
Hide file tree
Showing 412 changed files with 3,075 additions and 854 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ powerapps-docs/.vs/slnx.sqlite
powerapps-docs/.vs/VSWorkspaceState.json
/.vs/slnx.sqlite-journal
powerapps-docs/teams/media/how-to-architecture/Thumbs.db
powerapps-docs/teams/media/milestones-broad-distribution/Thumbs.db
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ The following is the list of blogs created by Power Apps community.

## Tools

The [Code component builder](https://www.xrmtoolbox.com/plugins/Maverick.PCF.Builder/) is a tool that enables you to build code components with ease where you do not need to write the CLI commands but still use the [Microsoft Power Platform CLI](/powerapps/developer/data-platform/powerapps-cli) under the hood. Most of the commands are consolidated, making it easier to build components.
It has two versions:
1. https://www.xrmtoolbox.com/plugins/Maverick.PCF.Builder/ is for XrmToolBox.
2. [Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=danish-naglekar.pcf-builder) both of them are called **PCF Builder**.
The [code component builder](https://www.xrmtoolbox.com/plugins/Maverick.PCF.Builder/) is a tool that enables you to build code components with ease where you do not need to write the CLI commands but still use the [Microsoft Power Platform CLI](/powerapps/developer/data-platform/powerapps-cli) under the hood. Most of the commands are consolidated, making it easier to build components.

There are two versions of the code component builder. Both of them are called **PCF Builder** and are listed below:
1. [PCF Builder](https://www.xrmtoolbox.com/plugins/Maverick.PCF.Builder/) for XrmToolBox.
2. [PCF Builder](https://marketplace.visualstudio.com/items?itemName=danish-naglekar.pcf-builder) for Visual Studio Code.

[PCF Builder for XrmToolBox](https://www.xrmtoolbox.com/plugins/Maverick.PCF.Builder/) provides a graphical user interface that lets you create code components in visual manner using Microsoft Power Platform CLI.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,146 +25,15 @@ search.app:
[!INCLUDE [cc-discovery-service-description](../includes/cc-discovery-service-description.md)]

To access the Discovery Service using SDK assembly APIs, add a reference to the `Microsoft.Xrm.Sdk.dll` assembly in your Visual Studio project, and then add a `using` statement to access the <xref:Microsoft.Xrm.Sdk.Discovery> namespace.

The <xref:Microsoft.Xrm.Sdk.WebServiceClient.DiscoveryWebProxyClient> implements the <xref:Microsoft.Xrm.Sdk.Discovery.IDiscoveryService> interface.

The <xref:Microsoft.Xrm.Sdk.Discovery.IDiscoveryService> interface provides <xref:Microsoft.Xrm.Sdk.Discovery.IDiscoveryService.Execute(Microsoft.Xrm.Sdk.Discovery.DiscoveryRequest)> method you will use to pass a instance of the abstract <xref:Microsoft.Xrm.Sdk.Discovery.DiscoveryRequest> class.

## Regional Discovery services

When you instantiate the <xref:Microsoft.Xrm.Sdk.WebServiceClient.DiscoveryWebProxyClient> you will need to provide a URL for a regional data center using one of the following values.

[!INCLUDE [regional-discovery-services](../../../includes/regional-discovery-services.md)]

> [!NOTE]
> If you do not know the user's region, you need to loop through the available regions until you get results. A single global Discovery Service is also available. More information: [Discover the URL for your organization](../webapi/discover-url-organization-web-api.md)
## Discovery service messages

There are three messages that you can use which all inherit from the abstract <xref:Microsoft.Xrm.Sdk.Discovery.DiscoveryRequest> class.

The following table lists the messages that are supported with <xref:Microsoft.Xrm.Sdk.Discovery.IDiscoveryService.Execute(Microsoft.Xrm.Sdk.Discovery.DiscoveryRequest)> method.

|Message|Description|
|-------------|-----------------|
|<xref:Microsoft.Xrm.Sdk.Discovery.RetrieveUserIdByExternalIdRequest>|Retrieves the logged-on user's ID in Microsoft Dataverse|
|<xref:Microsoft.Xrm.Sdk.Discovery.RetrieveOrganizationRequest>|Retrieves information about a single organization.|
|<xref:Microsoft.Xrm.Sdk.Discovery.RetrieveOrganizationsRequest>|Retrieves information about all organizations to which the user belongs.|

## Example

The following code for a console application uses the <xref:Microsoft.Xrm.Sdk.Discovery.RetrieveOrganizationsRequest> message to retrieve all the organizations for a user.

```csharp
using System;
using System.Linq;
using Microsoft.Xrm.Sdk.Discovery;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.Xrm.Sdk.WebServiceClient;

namespace DiscoveryServiceSample
{
class Program
{
//These sample application registration values are available for all online instances.
// this sample requires ADAL.net 5.2 or later
public static string clientId = "51f81489-12ee-4a9e-aaae-a2591f45987d";

static OrganizationDetailCollection GetOrganizationDetails(DiscoveryWebProxyClient svc)
{

var request = new RetrieveOrganizationsRequest()
{
AccessType = EndpointAccessType.Default,
Release = OrganizationRelease.Current
};
try
{
var response = (RetrieveOrganizationsResponse)svc.Execute(request);
return response.Details;
}
catch (Exception)
{
throw;
}
}
static void Main(string[] args)
{
string authority = @"https://login.microsoftonline.com/common";
string northAmericaResourceUrl = "https://disco.crm.dynamics.com";
string discoveryUrl = $"{northAmericaResourceUrl}/XRMServices/2011/Discovery.svc/web";
Uri discoveryUri = new Uri(discoveryUrl);

AuthenticationContext authContext = new AuthenticationContext(authority, false);
string username = "you@yourorg.onmicrosoft.com";
string password = "yourPassword";

AuthenticationResult authResult = null;
if (username != string.Empty && password != string.Empty)
{
UserPasswordCredential cred = new UserPasswordCredential(username, password);
authResult = authContext.AcquireTokenAsync(northAmericaResourceUrl, clientId, cred).Result;
}


using (var svc = new DiscoveryWebProxyClient(discoveryUri))
{
svc.HeaderToken = authResult.AccessToken;

OrganizationDetailCollection details = GetOrganizationDetails(svc);

details.ToList().ForEach(x =>
{
Console.WriteLine("Organization Name: {0}", x.FriendlyName);
Console.WriteLine("Unique Name: {0}", x.UniqueName);
Console.WriteLine("Endpoints:");
foreach (var endpoint in x.Endpoints)
{
Console.WriteLine(" Name: {0}", endpoint.Key);
Console.WriteLine(" URL: {0}", endpoint.Value);
}
Console.WriteLine();
});
};
Console.ReadLine();
}
}
}

```

The results may look like this for a user with access to two instances:

```
Organization Name: Organization A
Unique Name: orga
Endpoints:
Name: WebApplication
URL: https://orgaservice.crm.dynamics.com/
Name: OrganizationService
URL: https://orgaservice.api.crm.dynamics.com/XRMServices/2011/Organization.svc
Name: OrganizationDataService
URL: https://orgaservice.api.crm.dynamics.com/XRMServices/2011/OrganizationData.svc
Organization Name: Organization B
Unique Name: orgb
Endpoints:
Name: WebApplication
URL: https://orgbservice.crm.dynamics.com/
Name: OrganizationService
URL: https://orgbservice.api.crm.dynamics.com/XRMServices/2011/Organization.svc
Name: OrganizationDataService
URL: https://orgbservice.api.crm.dynamics.com/XRMServices/2011/OrganizationData.svc
```

> [!NOTE]
> The `OrganizationDataService` is the deprecated Organization Data Service, not the Web API. This service does not include a URL for the Web API.
- Regional Discovery Services are no longer avaialble.
- To access Global Discovery functionality with the SDK going fowarded, see [here](/powerapps-docs/developer/data-platform/org-service/samples/access-discovery-service.md)

## Globla Discovery Service Endpoints:
[!INCLUDE [global-discovery-services](../../../includes/global-discovery-services.md)]

### See also

[Discovery Services](../discovery-service.md)<br />
[Global Discovery Service Sample](https://github.com/Microsoft/PowerApps-Samples/tree/master/cds/orgsvc/C%23/DiscoveryService)<br />
[Discover the URL for your organization](../webapi/discover-url-organization-web-api.md)

[!INCLUDE[footer-include](../../../includes/footer-banner.md)]
[!INCLUDE[footer-include](../../../includes/footer-banner.md)]
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ If you have set and values in the App.config connection strings, it will use t

## What this sample does

This sample uses the SDK Assembly `DiscoveryServiceProxy` to query the discovery service with a user's credentials to determine which environments they can connect with.
This sample uses the SDK Assembly `CrmServiceClient` to query the global discovery service with a user's credentials to determine which environments they can connect with.

If one or more environments are returned, the sample will prompt the user to choose one, and then use a `WhoAmIRequest` to return the `SystemUser.UserId` for that environment.

Expand All @@ -43,17 +43,17 @@ This sample requires no special setup except that there are valid user credentia

If you know the regional data center that your environments are in, the sample will run faster if you set this value at line 40 of the SampleProgram.cs file.

In SampleMethods.cs there is a `DataCenter` enumeration for each of the known data centers. Each enumeration member is decorated with a `Description` notation. All of these members except `Unknown` have the URL for the regional discovery service set as the description.
In SampleMethods.cs there is a `Clouds` enumeration for each of the known global discovery centers. Each enumeration member is decorated with a `Description` notation. All of these members except `Unknown` have the URL for the global discovery service set as the description.


### Demonstrate

1. Using the user credentials and the `dataCenter` value, the program uses the `GetAllOrganizations` static method to retrieve all known environments for the user.
1. The `GetAllOrganizations`method detects whether the `dataCenter` value is set to `DataCenter.Unknown`. If it is set to this member, this method will loop through all the other members in the `DataCenter` enum and retrieve any environments that are found using the `GetOrganizationsForDataCenter` static method.
1. Using the user credentials and the `cloud` value, the program uses the `GetAllOrganizations` static method to retrieve all known environments for the user.
1. The `GetAllOrganizations`method detects whether the `cloud` value is set to `Cloud.Unknown`. If it is set to this member, this method will choose the commerical `Cloud` enum and retrieve any environments that are found using the `GetOrganizationsForCloud` static method.

If a specific data center is set, `GetAllOrganizations` will simply call `GetOrganizationsForDataCenter` with those values.
If a specific data center is set, `GetAllOrganizations` will simply call `GetOrganizationsForCloud` with those values.

1. The `GetOrganizationsForDataCenter` method extracts the data center discovery service Url from the member `Description` decoration and uses it together with the user credentials to execute the `RetrieveOrganizationsRequest` discovery service message.
1. The `GetOrganizationsForCloud` method extracts the cloud's discovery service Url from the member `Description` decoration and uses it together with the user credentials to execute the `DiscoverGlobalOrganizations` CrmServiceClient helper message.

A `System.ServiceModel.Security.SecurityAccessDeniedException` is expected when the user has no environments in a specific data center.

Expand Down
67 changes: 35 additions & 32 deletions powerapps-docs/guidance/patterns/inspection-pattern.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ author: kathyos
ms.service: powerapps
ms.topic: conceptual
ms.custom: guidance
ms.date: 07/20/2020
ms.date: 06/21/2021
ms.author: kathyos
ms.reviewer: kathyos

---

# Pattern: Inspection

<!--![Collage of inspection app screenshots](media/inspection-collage.png "Collage of inspection app screenshots")-->

There are a variety of reasons why organizations need to perform inspections,
and Microsoft Power Platform provides a no-code or low-code solution for enabling
inspection, analysis, and action. In this pattern, an app user fills out a
Expand Down Expand Up @@ -53,6 +51,40 @@ In a typical inspection scenario:
decide to take it out of service. Or the centralized report might show that daily
maintenance standards need to be improved in a particular location.

## Template: Inspection solution for Microsoft Teams

The Inspection solution for Microsoft Teams is a general inspection app that can be used to inspect anything from a location (such as a retail store or manufacturing plant) to assets and equipment (such as vehicles and machines). The solution includes an app for performing inspections as well as an app for configuring and managing inspections.

![Screenshot of the Inspection app for Microsoft Teams](media/review-inspection.png "Screenshot of the Inspection app for Microsoft Teams")

Learn more about the solution: [Video](https://aka.ms/TeamsInspectionVideo) | [Documentation](https://aka.ms/TeamsInspectionDocs) | [Teams app installer](https://aka.ms/TeamsInspection)

## Template: Hospital Emergency Response sample solution

The Hospital Emergency Response sample solution provides a set of capabilities
for healthcare organizations to collect data for situational awareness of
available beds and supplies, COVID-19&ndash;related patients, staffing, and pending
discharges. This solution implements the inspection pattern by collecting an
inventory of available hospital beds and supplies. It also uses dashboards to
summarize key data and insights for users to make informed decisions, resulting
in efficient deployment and usage of resources.

![Screenshots of the Hospital Emergency Response app](media/hospital-emergency-response-app.png "Screenshots of the Hospital Emergency Response app")

The main components of the Hospital Emergency Response solution are:

- **Mobile app for frontline staff**: Frontline staff, such as nurses and
medical practitioners, can use the mobile app to quickly view and enter
information as required.

- **Web app for hospital admins**: Hospital admins can use this app to add and
manage system data required for the solution to work.

- **Dashboards for healthcare decision makers**: Decision makers can use dashboards to quickly
view important data and metrics to help make decisions efficiently.

Learn more about the solution: [Video](https://youtu.be/Dg-i3F9G01I) | [Documentation](../../sample-apps/emergency-response/overview.md) | [Blog post](https://powerapps.microsoft.com/blog/emergency-response-solution-a-microsoft-power-platform-solution-for-healthcare-emergency-response/)

## How customers are using the inspection pattern

### Virgin Atlantic safety and compliance app
Expand Down Expand Up @@ -125,34 +157,6 @@ as oral reading goals and comprehension goals.

![Screenshots of the Tacoma Public Schools DRA2 app](media/tacoma-schools-dra-app.png "Screenshots of the Tacoma Public Schools DRA2 app")

### Hospital Emergency Response sample solution

The Hospital Emergency Response sample solution provides a set of capabilities
for healthcare organizations to collect data for situational awareness of
available beds and supplies, COVID-19&ndash;related patients, staffing, and pending
discharges. This solution implements the inspection pattern by collecting an
inventory of available hospital beds and supplies. It also uses dashboards to
summarize key data and insights for users to make informed decisions, resulting
in efficient deployment and usage of resources.

![Screenshots of the Hospital Emergency Response app](media/hospital-emergency-response-app.png "Screenshots of the Hospital Emergency Response app")

The main components of the Hospital Emergency Response solution are:

- **Mobile app for frontline staff**: Frontline staff, such as nurses and
medical practitioners, can use the mobile app to quickly view and enter
information as required.

- **Web app for hospital admins**: Hospital admins can use this app to add and
manage system data required for the solution to work.

- **Dashboards for healthcare decision makers**: Decision makers can use dashboards to quickly
view important data and metrics to help make decisions efficiently.



Learn more about the solution: [video](https://youtu.be/Dg-i3F9G01I) | [documentation](../../sample-apps/emergency-response/overview.md) | [blog post](https://powerapps.microsoft.com/blog/emergency-response-solution-a-microsoft-power-platform-solution-for-healthcare-emergency-response/)

### Additional stories

- [Pinnacle Group – Helpdesk employee leads transition from paper to digital](https://powerapps.microsoft.com/blog/pinnacle-group/)
Expand All @@ -164,4 +168,3 @@ Learn more about the solution: [video](https://youtu.be/Dg-i3F9G01I) | [document

- [App sample gallery: Audit](https://powerusers.microsoft.com/t5/forums/searchpage/tab/message?advanced=false&allow_punctuation=false&filter=location&location=forum-board:AppFeedbackGallery&q=audit)

[!INCLUDE[footer-include](../../includes/footer-banner.md)]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions powerapps-docs/includes/global-discovery-services.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
|Location|Global Discovery Web service URL|
|--------------|-------------------------------|
|Commercial|`https://disco.crm.dynamics.com/XRMServices/2011/Discovery.svc`|
|North America 2 (GCC)|`https://globaldisco.crm9.dynamics.com`|
|US Government L5 (DOD)|`https://globaldisco.crm.appsplatform.us`|
|US Government L4 (USG)|`https://globaldisco.crm.microsoftdynamics.us`|
|China operated by 21Vianet|`https://globaldisco.crm.dynamics.cn`|
Loading

0 comments on commit 5aa53f3

Please sign in to comment.