• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

GRISCHKE SOLUTIONS

Website and Software Development | IT | Office

  • Home
  • About
  • Services
    • Web Development & Hosting
    • IT, Networking and Cloud Solutions
    • Email and Office Solutions
    • Design Services
    • Quality Management
    • Document Management
    • Performance Dashboard
    • HR Management
    • Payroll Solutions
    • IT Support
    • GDPR
  • Blog
    • Delete Deleted Users in Office 365 – Using Power Apps App
    • Start Jaguar Engine Remotely with Siri
    • Backup and restore IONOS DNS records using Power Automate, API, including SOA record
    • How to build an Email Parser in Microsoft Flow (Extract text from email body)
    • Windows 10 1803 new OEM (or ESP) Partition
    • Unprotect Excel Worksheets without Password
    • Data protection law is changing – you need to act now
    • Calculate Ratio Between Two Numbers
    • Charts in SharePoint
    • Microsoft SharePoint Services – What you need to know
    • Hide Featured Images in Genesis using 3 lines of code
    • Workflow loop through SharePoint list
  • Products
    • Basket
  • Enquiry

Delete Deleted Users in Office 365 – Using Power Apps App

13th March 2023 By Maciek Grischke Leave a Comment

Sometimes we need to delete a user from deleted users in Office 365 Admin Portal.

You can do most things using PowerShell, but that’s too much for such a simple task.

Step 1

First things first, we need to register an app in Azure. Go to Azure Active Directory > App Registrations and create a new app. Write down the (Application) Client ID and Directory (tenant) ID.

Go to API permissions and add the following “Application” permissions:

Application.ReadWrite.All
Directory.ReadWrite.All
Group.ReadWrite.All
User.ReadWrite.All

…then click Grant admin consent.

In Certificates & secrets click New client secret and create a new App Secret. Note it down now. Make sure you take note of the Value and not the Secret ID.

Step 2

Create a custom connector in Power Platform and call it Graph AD Directory. Go to Power Automate or Power Apps > Data > Custom Connectors. Give your connector a name and configure base URL as below:

Click next and under the authentication, select OAuth 2.0, select Azure Active Directory under identify provider.

Paste Client ID, Secret and Tenant ID from your notes. Use https://login.microsoftonline.com in Authorization URL and https://graph.microsoft.com/ in Resource URL and .default in scope.

Step 3

Create two definitions: ListDeletedItems and PermanentlyDeleteItem.

Create the first definition: Name it as ListDeletedItems and click Import from sample and paste this link: https://graph.microsoft.com/v1.0/directory/deletedItems/microsoft.graph.group?$orderBy=displayName – the orderBy parameter is optional. Paste Accept application/json in headers, and click Import.

Create the second definition: Name it as PermanentlyDeleteItem and click Import from sample and paste this link: https://graph.microsoft.com/v1.0/directory/deletedItems/{object-id}. Paste Accept application/json in headers, and click Import.

Step 4

Create an app. Go to the Data tab, add a new connection, and search for the custom connector you created in Step 3.

Add a New Blank Screen. Create a button, rename it to btnListDeletedItems and paste the following into the OnSelect property:

ClearCollect(colDeletedItems,GraphADDirectory.ListDeletedItems({'$orderBy':"userPrincipalName"}).value)

Add a new Gallery control, and in Items, enter:

Sort(colDeletedItems,displayName,SortOrder.Ascending)

In the Screen OnVisible property, paste:

Select(btnListDeletedItems)

Inside the galley, you have a few properties to choose from, I selected: ThisItem.displayName, ThisItem.jobTitle and ThisItem.userPrincipalName. I also added a Trash icon and in the OnSelect property, paste the following:

GraphADDirectory.PermanentlyDeleteItem(ThisItem.id,{Accept:"application/json"});Select(btnListDeletedItems)

The first action is to delete the current object ID and the second action is to refresh the list of Deleted Items.

That’s it.

Filed Under: Tutorials

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

  • Delete Deleted Users in Office 365 – Using Power Apps App
    By Maciek Grischke
    13th March 2023
  • Lock and Unlock your Jaguar with Siri
    By Maciek Grischke
    21st January 2023
  • Start Jaguar Engine Remotely with Siri
    By Maciek Grischke
    6th December 2022
  • Travel Mileage Claim Form in Power Apps using TomTom API
    By Maciek Grischke
    24th September 2022
  • Backup and restore IONOS DNS records using Power Automate, API, including SOA record
    By Maciek Grischke
    14th August 2022
  • Home
  • About
  • Services
  • Blog
  • Products
  • Enquiry

 

Designed in-house by GRISCHKE SOLUTIONS © 2022 · Log in

Address

GRISCHKE SOLUTIONS
8 Sycamore Cottages
High Street
Pembury
TN2 4PJ

Site Info

Privacy Statement

Cookies Policy