cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowAuto
New Member

Find Users Not in O365 / Not Working for the Company Anymore / Offboarding Emails

Solution for Finding Users Not in O365 / Not Working for the Company Anymore / Offboarding Emails

In my case the solution needed to check all registered 'Authors' and 'Owners' of documents in a Sharepoint library, find any users that were no longer working for the company, and then send alert emails so new Owners or Authors could be assigned the documents.

The challenge was getting a Compare function to match users that were not found in the O365 tenancy, as using the Search For User function simply returned an empty object, which I couldn't then get the Condition function to recognise.

PowAuto_0-1634796005112.png

 


The answer was to use Compose function with the Length expression first to render an output integer for the length of the response to the user Search, which would then allow the Condition function to operate on it.

Solution

  1. Recurrence function - so the job runs weekly 
  2. Get Items (Sharepoint) function to call the Sharepoint Library
  3. Apply to Each function, using the 'value' from the Get Items step - @{outputs('Get_items')?['body/value']} 
    1. Search For User v2 (O365), searching with an an outputted User field value from the Get Items step (in my case, Document Author Display Name)
    2. Compose function, using a Length expression to output a number - @{length(body('Search_for_users_(V2)')?['value'])}
    3. Condition function, using the Outputs from the Compose step, Is Less Than, 1. This will answer True if a user is not found in O365 as the response body's  value is empty and has 0 length.
      1. If True: Send an Email function
      2. If False: do nothing
  4. Terminate

PowAuto_0-1634795649504.png

 

0 REPLIES 0

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,657)