Skip to content

Commit 13a85ce

Browse files
authored
Merge pull request MicrosoftDocs#2309 from MicrosoftDocs/pehecke-msdn-sample-migration
Added page for migrated sample from MSDN
2 parents 4f9a16f + 8427d43 commit 13a85ce

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: " Disable or enable a user (Common Data Service) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
3+
description: "This sample shows how to disable and enable a system user." # 115-145 characters including spaces. This abstract displays in the search result.
4+
ms.custom: ""
5+
ms.date: 1/27/2020
6+
ms.reviewer: ""
7+
ms.service: powerapps
8+
ms.topic: "samples"
9+
author: "JimDaly" # GitHub ID
10+
ms.author: "jdaly" # MSFT alias of Microsoft employees only
11+
manager: "ryjones" # MSFT alias of manager or PM counterpart
12+
search.audienceType:
13+
- developer
14+
search.app:
15+
- PowerApps
16+
- D365CE
17+
---
18+
19+
# Sample: Disable or enable a user
20+
21+
This sample shows how to disable and enable a system user account in an online or on-premise/IFD environment.
22+
23+
You can download the sample from [here](https://github.com/microsoft/PowerApps-Samples/tree/master/cds/orgsvc/C%23/DisableOrEnableUser)
24+
25+
## How to run this sample
26+
27+
The Customer Engagement user account under which you run this program must have the System Administrator role in order to enable/disable a system user.
28+
29+
Before building this sample, open the solution in Visual Studio and select **View** > **Task List**. There are two TODO comments that you must follow to provide the required information about an existing system user in your organization.
30+
31+
See [How to run samples](https://github.com/microsoft/PowerApps-Samples/blob/master/cds/README.md) for information about how to run this sample.
32+
33+
## What this sample does
34+
35+
The sample obtains the identifier of an existing system user and either disables or enables that user account.
36+
37+
## How this sample works
38+
39+
In order to simulate the scenario described in [What this sample does](#what-this-sample-does), the sample will do the following:
40+
41+
### Setup
42+
43+
Retrieves the identifier of an existing system user that you specify (see [How to run this sample](#how-to-run-this-sample)).
44+
45+
### Demonstrate
46+
47+
Demonstrates using`SetStateRequest` to disable and enable a system user. Also shows how to retrieve information about a system user.
48+
49+
To view the summary of the specified system user in Customer Engagement, navigate to **Settings** > **Security** > **Users** and select the target system user account in the list. If desired, choose the **Disabled Users** system view to filter the list of all users. The user's status should be "Disabled".
50+
51+
### Clean up
52+
53+
Displays an option to enable the user account that was disabled in the `Main()` method.
54+
55+
Answering "yes" is optional in case you want to examine the disabled user account in Customer Engagement. You can manually enable the user account in Active Directory or Office 365 to achieve the same result.

powerapps-docs/developer/common-data-service/org-service/samples/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
href: associate-security-role-user.md
2929
- name: Determine whether a user has a role
3030
href: determine-whether-user-has-role.md
31+
- name: Disable or enable a user
32+
href: disable-a-user.md
3133
- name: Remove a role for a user
3234
href: remove-role-for-user.md
3335
- name: Retrieve license information

0 commit comments

Comments
 (0)