Vue normale

Il y a de nouveaux articles disponibles, cliquez pour rafraîchir la page.
À partir d’avant-hierFlux principal

Microsoft Releases Cmdlet to Retrieve Disposition Review Items

Export Details of Disposition Review Items

Message Center notification MC521457 (Microsoft 365 roadmap item 106102) might have passed you buy on February 27 when Microsoft announced a new PowerShell cmdlet for disposition review. Relatively few people are concerned with Microsoft Purview Data Lifecycle Management to care that a new cmdlet is available to export (not just “to support”) disposition review items, so it’s entirely natural that you might have gone on to read about other announcements occurring around the same time, like Exchange Online’s improved message recall feature.

Roll-out of the new Get-ReviewItems cmdlet is now complete. The cmdlet is available after loading the latest version of the Exchange Online management module.

Disposition Items

Microsoft 365 retention labels often result in the deletion of items after the lapse of their retention periods. This is enough for most organizations, but those that want oversight over the final processing of selected items can configure retention labels to invoke a disposition review, part of the Microsoft Purview records management solution. Disposition reviews are often used to retain messages and documentations such as those for project documentation until the organization is absolutely sure that it’s safe to remove individual items.

Using a disposition review with retention labels requires advanced licenses, like Office 365 E5. An organization can put items through a single-stage or multi-stage review (Figure1) leading to final deletion, retention for another period, or assignment of a new retention label. The reviewers who decide on the disposition of content are selected by the organization because they have the expertise and experience to know if items are still needed or can progress to final disposition. It’s also possible to configure a custom automated disposition process using Power Automate.

Viewing disposition review items for a retention label
Figure 1: Viewing disposition review items for a retention label

Exporting Disposition Review Items

The Get-ReviewItems cmdlet doesn’t affect disposition outcomes. It’s a utility cmdlet to export details of disposition review items for a specific retention label in a pending or disposed (processed) state. The reason why the cmdlet exists is that the Purview GUI (Figure 1) supports export of up to 50,000 items. Although it’s unlikely that an organization will have more than 50,000 items awaiting disposition review, it is possible that they might have more than 50,000 disposed (processed) items. The Get-ReviewItems cmdlet can export details of all those items.

Microsoft’s documentation for Get-ReviewItems includes examples of using the cmdlet. One in particular is noteworthy because it explains how to fetch pages of review items until all items have been recovered. Fetching pages of data is common practice in the Graph API world and it’s done to reduce the strain on the service imposed if administrators requested very large numbers of items at one time.

I expanded the example to create a report of all disposition review items for a tenant (all items for all retention labels with a disposition review). Here’s the code:

Connect-IPPSSession

[array]$ReviewTags = Get-ComplianceTag | Where-Object {$_.IsReviewTag -eq $True} | Sort-Object Name
If (!($ReviewTags)) { Write-Host "No retention tags with manual disposition found - exiting"; break }

Write-Host ("Looking for Review Items for {0} retention tags: {1}" -f $ReviewTags.count, ($ReviewTags.Name -join ", "))

$Report = [System.Collections.Generic.List[Object]]::new() 

[array]$ItemsForReport = $Null
ForEach ($ReviewTag in $ReviewTags) {
 Write-Host ("Processing disposition items for the {0} label" -f $ReviewTag.Name)
 [array]$ItemDetails = $Null; [array]$ItemDetailsExport = $Null
 # Fetch first page of review items for the tag and extract the items to an array
 [array]$ReviewItems = Get-ReviewItems -TargetLabelId $ReviewTag.ImmutableId -IncludeHeaders $True -Disposed $False  
 $ItemDetails += $ReviewItems.ExportItems
 # If more pages of data are available, fetch them and add to the Item details array
 While (![string]::IsNullOrEmpty($ReviewItems.PaginationCookie))
 {
    $ReviewItems = Get-ReviewItems -TargetLabelId $ReviewTag.ImmutableId -IncludeHeaders $True -PagingCookie $ReviewItems.PaginationCookie
    $ItemDetails += $ReviewItems.ExportItems
 }
 # Convert data from CSV
 If ($ItemDetails) {
   [array]$ItemDetailsExport = $ItemDetails | ConvertFrom-Csv -Header $ReviewItems.Headers 
   ForEach ($Item in $ItemDetailsExport) {
     # Sometimes the data doesn't include the label name, so we add the label name to be sure
     $Item | Add-Member -NotePropertyName Label -NotePropertyValue $ReviewTag.Name }
   $ItemsForReport += $ItemDetailsExport
 }
}

ForEach ($Record in $ItemsForReport) {
  If ($Record.ItemCreationTime) {
   $RecordCreationDate =  Get-Date($Record.ItemCreationTime) -format g 
  } Else {
   $RecordCreationDate = "Unknown" }
 
   $DataLine  = [PSCustomObject] @{
     TimeStamp       = $RecordCreationDate
     Subject         = $Record.Subject
     Label           = $Record.Label
     AppliedBy       = $Record.LabelAppliedBy
     RecordType      = $Record.RecordType
     'Last Reviewed' = Get-Date($Record.ItemLastModifiedTime) -format g
     'Review Action' = $Record.ReviewAction
     Comment         = $Record.Comment
     'Deleted Date'  = $Record.DeletedDate
     Author          = $Record.Author
     Link            = $Record.InternetMessageId
     Location        = $Record.Location
   } 
   $Report.Add($DataLine)
}

Everything works – until you meet an item with a comma in its subject or the comment captured when a reviewer decides upon a disposition outcome. After discussing the issue with Microsoft, its root cause is that the export is in CSV format and the comma in these fields causes problems when converting from CSV format. Microsoft is working on a fix which might be present as you read this.

The Lesson of Export

The Get-ReviewItems cmdlet will be a useful tool for those involved in disposition processing. They can extract details of items and report that information in whatever way they wish. The comma issue proves that documentation is not always perfect. It’s important to test examples to make sure that they work as they should.


Insight like this doesn’t come easily. You’ve got to know the technology and understand how to look behind the scenes. Benefit from the knowledge and experience of the Office 365 for IT Pros team by subscribing to the best eBook covering Office 365 and the wider Microsoft 365 ecosystem.

Mastering the Foibles of the Microsoft Graph PowerShell SDK

He looks happy, but he hasn't hit some of the Microsoft Graph PowerShell SDK foibles yet...
He looks happy, but he hasn’t hit some of the SDK foibles yet…

Translating Graph API Requests to PowerShell Cmdlets Sometimes Doesn’t Go So Well

The longer you work with a technology, the more you come to know about its strengths and weaknesses. I’ve been working with the Microsoft Graph PowerShell SDK for about two years now. I like the way that the SDK makes Graph APIs more accessible to people accustomed to developing PowerShell scripts, but I hate some of the SDK’s foibles.

This article describes the Microsoft Graph PowerShell SDK idiosyncrasies that cause me most heartburn. All are things to look out for when converting scripts from the Azure AD and MSOL modules before their deprecation (speaking of which, here’s an interesting tool that might help with this work).

No Respect for $Null

Sometimes you just don’t want to write something into a property and that’s what PowerShell’s $Null variable is for. But the Microsoft Graph PowerShell SDK cmdlets don’t like it when you use $Null. For example, let’s assume you want to create a new Azure AD user account. This code creates a hash table with the properties of the new account and then runs the New-MgUser cmdlet.

$NewUserProperties = @{
    GivenName = $FirstName
    Surname = $LastName
    DisplayName = $DisplayName
    JobTitle = $JobTitle
    Department = $Null
    MailNickname = $NickName
    Mail = $PrimarySmtpAddress
    UserPrincipalName = $UPN
    Country = $Country
    PasswordProfile = $NewPasswordProfile
    AccountEnabled = $true }
$NewGuestAccount = New-MgUser @NewUserProperties

New-MgUser fails because of an invalid value for the department property, even though $Null is a valid PowerShell value.

New-MgUser : Invalid value specified for property 'department' of resource 'User'.
At line:1 char:2
+  $NewGuestAccount = New-MgUser @NewUserProperties
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: ({ body = Micros...oftGraphUser1 }:<>f__AnonymousType64`1) [New-MgUser
   _CreateExpanded], RestException`1
    + FullyQualifiedErrorId : Request_BadRequest,Microsoft.Graph.PowerShell.Cmdlets.NewMgUser_CreateExpanded

One solution is to use a variable that holds a single space. Another is to pass $Null by running the equivalent Graph request using the Invoke-MgGraphRequest cmdlet. Neither are good answers to what should not happen (and we haven’t even mentioned the inability to filter on null values).

Ignoring the Pipeline

The pipeline is a fundamental building block of PowerShell. It allows objects retrieve by a cmdlet to pass to another cmdlet for processing. But despite the usefulness of the pipeline, the SDK cmdlets don’t support it and the pipeline stops stone dead whenever an SDK cmdlet is asked to process incoming objects. For example:

Get-MgUser -Filter "userType eq 'Guest'" -All | Update-MgUser -Department "Guest Accounts"
Update-MgUser : The pipeline has been stopped

Why does this happen? The cmdlet that receives objects must be able to distinguish between the different objects before it can work on them. In this instance, Get-MgUser delivers a set of guest accounts, but the Update-MgUser cmdlet does not know how to process each object because it identifies an object is through the UserId parameter whereas the inbound objects offer an identity in the Id property.

The workaround is to store the set of objects in an array and then process the objects with a ForEach loop.

Property Casing and Fetching Data

I’ve used DisplayName to refer to the display name of objects since I started to use PowerShell with Exchange Server 2007. I never had a problem with uppercasing the D and N in the property name until the Microsoft Graph PowerShell SDK came along only to find that sometimes SDK cmdlets insist on a specific form of casing for property names. Fail to comply, and you don’t get your data.

What’s irritating is that the restriction is inconsistent. For instance, both these commands work:

Get-MgGroup -Filter "DisplayName eq 'Ultra Fans'"
Get-MgGroup -Filter "displayName eq 'Ultra Fans'"

But let’s say that I want to find the group members with the Get-MgGroupMember cmdlet:

[array]$GroupMembers = Get-MgGroupMember -GroupId (Get-MgGroup -Filter "DisplayName eq 'Ultra Fans'" | Select-Object -ExpandProperty Id)

This works, but I end up with a set of identifiers pointing to individual group members. Then I remember from experience gained from building scripts to report group membership that Get-MgGroupMember (like other cmdlets dealing with membership like Get-MgAdministrationUnitMember) returns a property called AdditionalProperties holding extra information about members. So I try:

$GroupMembers.AdditionalProperties.DisplayName

Nope! But if I change the formatting to displayName, I get the member names:

$GroupMembers.AdditionalProperties.displayName
Tony Redmond
Kim Akers
James Ryan
Ben James
John C. Adams
Chris Bishop

Talk about frustrating confusion! It’s not just display names. Reference to any property in AdditionalProperties must use the same casing as used the output, like userPrincipalName and assignedLicenses.

Another example is when looking for sign-in logs. This command works because the format of the user principal name is the same way as stored in the sign-in log data:

[array]$Logs = Get-MgAuditLogSignIn -Filter "UserPrincipalName eq 'james.ryan@office365itpros.com'" -All

Uppercasing part of the user principal name causes the command to return zero hits:

[array]$Logs = Get-MgAuditLogSignIn -Filter "UserPrincipalName eq 'James.Ryan@office365itpros.com'" -All

Two SDK foibles are on show here. First, the way that cmdlets return sets of identifiers and stuff information into AdditionalProperties (something often overlooked by developers who don’t expect this to be the case). Second, the inconsistent insistence by cmdlets on exact matching for property casing.

I’m told that this is all due to the way Graph APIs work. My response is that it’s not beyond the ability of software engineering to hide complexities from end users by ironing out these kinds of issues.

GUIDs and User Principal Names

Object identification for Graph requests depends on globally unique identifiers (GUIDs). Everything has a GUID. Both Graph requests and SDK cmdlets use GUIDs to find information. But some SDK cmdlets can pass user principal names instead of GUIDs when looking for user accounts. For instance, this works:

Get-MgUser -UserId Tony.Redmond@office365itpros.com

Unless you want to include the latest sign-in activity date for the account.

Get-MgUser -UserId Tony.Redmond@office365itpros.com -Property signInActivity
Get-MgUser :
{"@odata.context":"http://reportingservice.activedirectory.windowsazure.com/$metadata#Edm.String","value":"Get By Key
only supports UserId and the key has to be a valid Guid"}

The reason is that the sign-in data comes from a different source which requires a GUID to lookup the sign-in activity for the account, so we must pass the object identifier for the account for the command to work:

Get-MgUser -UserId "eff4cd58-1bb8-4899-94de-795f656b4a18" -Property signInActivity

It’s safer to use GUIDs everywhere. Don’t depend on user principal names because a cmdlet might object – and user principal names can change.

No Fix for Problems in V2 of the Microsoft Graph PowerShell SDK

V2.0 of the Microsoft Graph PowerShell SDK is now in preview. The good news is that V2.0 delivers some nice advances. The bad news is that it does nothing to cure the weaknesses outlined here. I’ve expressed a strong opinion that Microsoft should fix the fundamental problems in the SDK before doing anything else.

I’m told that the root cause of many of the issues is the AutoRest process Microsoft uses to generate the Microsoft Graph PowerShell SDK cmdlets from Graph API metadata. It looks like we’re stuck between a rock and a hard place. We benefit enormously by having the SDK cmdlets but the process that makes the cmdlets available introduces its own issues. Let’s hope that Microsoft gets to fix (or replace) AutoRest and deliver an SDK that’s better aligned with PowerShell standards before our remaining hair falls out due to the frustration of dealing with unpredictable cmdlet behavior.


Insight like this doesn’t come easily. You’ve got to know the technology and understand how to look behind the scenes. Benefit from the knowledge and experience of the Office 365 for IT Pros team by subscribing to the best eBook covering Office 365 and the wider Microsoft 365 ecosystem.

Manually re-register a Windows 10 / Windows 11 or Windows Server machine in Hybrid Azure AD Join

Hybrid Azure AD Join devices are machines under Windows 10+ or Windows Server 2016+ that are:

  • Joined to an on-premises Active Directory domain
  • Registered in Azure AD as a hybrid device

Having a Hybrid Azure AD Joined device enables the following features:

  • Automatic device enrollment in Microsoft Intune
  • Device-based conditional access for corporate devices
  • Backup of the BitLocker recovery key in Azure AD
  • Sync of some Windows settings by the Enterprise State Roaming

Sometimes, a machine can be in an inconsistent registration state in Azure Active Directory. This can happen because:

  • The machine was shut down during a long time, and the Azure AD device registration certificate is expired (located in Local Machine / Certificates / Personal)
  • Someone manually deleted the device registration certificate
  • Someone manually deleted the device object in the Azure AD portal
  • The machine is registered in another Azure AD tenant

Please note that this method will only succeed if your organization meets all the prerequisites for Hybrid Azure AD Join. For more information, please refer to this documentation.

Step 1: Unregister the device from Azure AD

Follow this procedure:

  • On the machine to unregister, launch a Command Prompt as an administrator and type the following command:
dsregcmd /leave

  • Make sure the certificates issued by “MS-Organization-Access” and “MS-Organization-P2P-Access [xxxx]” have been deleted from the local machine Personal certificate store:

  • Type the command dsregcmd /status in a Command Prompt, and make sure the following parameters have the appropriate values:
dsregcmd /status

+----------------------------------------------------------------------+
| Device State                                                         |
+----------------------------------------------------------------------+
AzureAdJoined : NO  <-----
EnterpriseJoined : NO
DomainJoined : YES  <-----

Step 2: Re-register the device as a Hybrid Azure AD Join

Follow this procedure:

  • On the machine to re-register, run the Task Scheduler as an administrator.

  • Go to Task Scheduler Library > Microsoft > Windows > Workplace Join and manually start the task “Automatic-Device-Join“.

  • Make sure the certificates issued by “MS-Organization-Access” and “MS-Organization-P2P-Access [xxxx]” have been created in the local machine Personal certificate store:

  • Type the command dsregcmd /status in a Command Prompt, and make sure the following parameters have the appropriate values:
dsregcmd /status

+----------------------------------------------------------------------+
| Device State                                                         |
+----------------------------------------------------------------------+
AzureAdJoined : YES  <-----
EnterpriseJoined : NO
DomainJoined : YES

  • Reboot the PC.

  • Start an Azure AD Connect delta synchronization.

aOS Monaco – 26/09/2019 – Sécurisez vos services Office 365 avec la suite Microsoft 365

La communauté aOS (Azure Office 365 SharePoint) et le Monaco Microsoft User Group (MMUG) vous invitent à la 1ère édition de la journée aOS Monaco le 26 Septembre 2019.

Pendant une journée entière, vous pouvez rencontrer et échanger avec des experts des technologies Office 365 et Azure. Différentes sessions vous seront proposées où nous vous apporteront des retours terrain. Il vous sera ainsi possible de découvrir ou approfondir vos connaissances sur :

  • Azure
  • Office 365
  • Microsoft Teams, SharePoint
  • Power Platform : Power BI, PowerApps, Microsoft Flow

Ce sera aussi l’occasion de partager et échanger entre utilisateurs et professionnels, locaux, nationaux et internationaux, de l’offre Cloud Microsoft.

J’animerai un atelier deep-dive “Sécurisez votre SI et vos services Office 365“, alors n’hésitez pas à réserver vos agendas 🙂

agenda aos monaco 2019

Digital Experience – Bordeaux – Nouveau poste de travail à l’heure du cloud et de la mobilité

J’ai l’honneur de vous annoncer la création de l’évènement Digital Experience à Bordeaux, en collaboration avec AZEO et Microsoft. Cet évènement gratuit se déroulera à l’hôtel Mercure Bordeaux Château Chartrons.

J’aurais l’opportunité de présenter une conférence sur la gestion moderne du poste de travail Windows, à l’heure du cloud et de la mobilité. Nous discuterons des sujets comme le management via Intune, le provisioning via AutoPilot et bien d’autres.

N’hésitez pas à vous inscrire maintenant, les places étant limitées.

Tour de France Microsoft 365 – Paris – 11 Avril 2018

Microsoft organise un Tour de France afin de présenter plus en détails la suite Microsoft 365.

J’aurais l’opportunité de présenter la version parisienne en collaboration avec quelques collègues de Microsoft France, qui se déroulera le 11 Avril 2018 chez Microsoft France, à Issy-Les-Moulineaux.

Voici le plan de cette demi-journée :

  • 9:00-9:30 : Accueil & petit-déjeuner
  • 9:30-10:00 : Découverte de la solution Microsoft 365 pour les entreprises et les collectivités
  • 10:00-10:15 : Annonce de l’arrivée des Data Center Office 365 en France
  • 10:15-11:00 : Focus sur la sécurité et GDPR au sein de votre entreprise
  • 11:00-11:30 : Présentation des offres et de l’expertise AZEO

N’hésitez pas à vous inscrire ici.

How to remove items from a collection in Power Apps [With Examples]

This Power Apps tutorial will walk you through several examples of how to remove items from a Power Apps collection within apps.

I recently received a request while working in a canvas app to remove item(s) from the Power Apps collection and display the remaining items. As a result, I did a lot of research and came up with this tutorial on how to remove items from the Power Apps collection.

  • How to remove items from the Power apps collection?
  • How to remove all items from the Power apps collection?
  • How to remove the last item from the Power apps collection?
  • How to remove the first item from the Power apps collection?
  • How to remove multiple items from the Power apps collection?
  • How to remove items from the Power apps collection while unchecking the checkbox?
  • How to remove empty items from the Power apps collection?
  • How to remove items from the Power Apps collection by id?
  • How to remove items from the Power Apps collection based on condition?
  • How to remove Power Apps collection items via dropdown control?
  • How to remove items in the Sharepoint list via power apps collection?
  • What is the limitation to removing items from the Power Apps collection?

How to remove items from the Power Apps collection

We’ll go over how to remove a specific item from the Power Apps collection in this section. When a user selects a collection item, it is removed from the Power Apps collection. To meet this requirement, we are going to create a collection while the button is clicking, and the required following steps are:

  • On the Power Apps canvas app screen, add a button control.
  • Set the Text as Create Collection.
  • Insert the below expression on the button’s OnSelect property. As a result, the collection will create when the button is clicked.
OnSelect = Collect(ColCapital,{Country: "USA", Captial: "WASHINGTON"}, {Country: "UNITED KINGDOM", Captial: "LONDON"}, {Country: "VIETNAM", Captial: "HANOI"}, {Country: "THAILAND", Captial: "BANGKOK"}, {Country: "SPAIN", Captial: "MADRID"}, {Country: "RUSSIA", Captial: "MOSCOW"}, {Country: "UKRAINE", Captial: "KIEV"} )

Where,

  1. ColCapital is the name of the new collection.
  2. Country and Captial are the names of the collection’s columns.
Power Apps collection remove a row
Power Apps collection removes a row
  • To display the collected items, add a vertical gallery to the Power Apps screen.
  • Set the Items as ColCapital. But initially, the data will not visible in the gallery. For this, click on the button first. Then we can see the collected data will be shown below:
PowerApps collection remove a row
PowerApps collection removes a row
  • Now, add a trash icon to the above vertical gallery.
  • Insert the below expression on the icon’s OnSelect property.
OnSelect = Remove(ColCapital, ThisItem)

where ColCapital is the name of the collection that we have created, and ThisItem is the specific item to remove.

Power Apps collection remove item
Power Apps collection removes item

That’s it! Preview the app for now. As we can see, when we click the icon, the corresponding item is removed from the collection.

PowerApps collection remove item
PowerApps collection removes the item

From the above collection, we have removed 2 items by clicking on the trash icon. This is how to remove the item from the Power Apps collection.

Read How to remove all items from a collection in PowerApps

Power apps remove all items from collection

Similarly, in this section, we will see how to remove all items from the Power Apps collection. That means we can remove all the collection items via a button click.

To implement this need, we will create a collection on the button’s OnSelect property by using the below expression. So that, when the button is clicked a collection will create.

OnSelect = Collect(ColCapital,{Country: "USA", Captial: "WASHINGTON"}, {Country: "UNITED KINGDOM", Captial: "LONDON"}, {Country: "VIETNAM", Captial: "HANOI"}, {Country: "THAILAND", Captial: "BANGKOK"}, {Country: "SPAIN", Captial: "MADRID"}, {Country: "RUSSIA", Captial: "MOSCOW"}, {Country: "UKRAINE", Captial: "KIEV"} )

Where,

  1. ColCapital is the name of the new collection.
  2. Country and Captial are the names of the collection’s columns.

Next, add a vertical gallery to display the collected data and connect that vertical gallery to the collection i.e., ColCapial. Once the button is clicked the items will be visible in the vertical gallery.

Power Apps removes all from collection
Power Apps removes all from collection
  • Next, to remove all items from the collection, add another button control to the screen and make sure to place the button outside of the gallery.
  • Set the text property as Clear All.
  • Insert the below expression on the button’s OnSelect property.
OnSelect = Clear(ColCapital)

Where ColCapital is the name of an existing collection that we previously created.

Power Apps collection remove all
Power Apps collection remove all

Now preview the app and we can see all the items will be removed from the collection once the button is clicked.

PowerApps collection remove all
PowerApps collection removes all

This is how to remove all items from the Power Apps collection.

Also Read: Power Apps collection filter [With real examples]

Power apps remove the last item from collection

In this section, we will see how to remove the last item from the Power Apps collection. For this, we will create a collection in the Power Apps and add a button to the Power Apps screen. When the user clicks on the button, the last item will be removed from the respective collection.

To work with this scenario, the following steps are:

  • On the Power Apps screen, add a button control and insert the below expression on the OnSelect property to create the collection.
OnSelect = Collect(ProductModelCol, 'Product Model')

Where ProductModelCol is the name of the new collection and ‘Product Model’ is the name of the SharePoint data source.

Power apps remove last item from collection
Power apps remove the last item from collection
  • Again add another button control to the Power Apps screen. Insert the below expression on the button’s OnSelect property to remove the last item of the collection.
OnSelect = Remove(ProductModelCol, LastN(ProductModelCol,1))
PowerApps remove last item from collection
PowerApps remove the last item from collection

That’s it! Let’s click on the second button while clicking on the Alt key. We can see that it will remove the last item from the collection with every click.

This is how to remove the last item from the Power Apps collection.

Check out: Power Apps Create Collection Using Excel [Complete Guide]

How to remove the first item from the Power Apps collection

Similarly, let’s take another example, to see how to remove the first item from the Power Apps collection. That means, we are going to use the above example of collection, where we will remove the first item from the collection when the user clicks on the button.

To work with this scenario, the following steps are:

  • On the above Power Apps screen, update the button’s Text property to “Remove First Item”.
  • Insert the below expression on the button’s OnSelect property.
OnSelect = Remove(ProductModelCol, FirstN(ProductModelCol,1))
Power apps remove first item from collection
Power apps remove first item from collection

That’s all! Now, when the user clicks on the button while clicking on the Alt key, we can see that it will remove the first item from the data table on every click.

That is how to remove the first item from the Power Apps collection.

How to remove multiple items from the Power apps collection

In this section, we will see how to remove multiple items from the Power Apps collection at once. That means we are going to use the above Power Apps collection to remove multiple items at once via a button click.

Suppose, from the above collection, we want to remove the items whose Product type is equal to Laptop.

For this, the required following steps are:

  • On the above Power Apps screen, add a button control and give a Text property as per the need. (Ex- Remove Multiple Items)
  • Insert the below expression on the button’s OnSelect property to remove multiple items at once from the Power Apps collection.
OnSelect = RemoveIf(ProductModelCol, Product = "Laptop")

Where ProductModelCol is the name of the above-created Power Apps collection.

Power Apps remove multiple items from collection
Power Apps remove multiple items from collection

While clicking on the Alt key, press the above-mentioned button. We can see, it will remove all those items whose product type equals Laptop.

PowerApps remove multiple items from collection
PowerApps remove multiple items from collection

This is how to remove multiple items from the Power Apps collection.

Have a look: Power Apps Create Collection Using SharePoint List

How to remove items from the Power apps collection while unchecking the checkbox?

In this section, we will see how to work with Power apps to remove items from collection on uncheck. That means the item will remove from the Power Apps collection while we uncheck the checkbox control.

To work with this scenario, we are going to use the above collection, i.e., ProductModelCol, and the following steps are necessary:

  • On the Power Apps screen, add a vertical gallery and connect that gallery with the Collection to display the collected data shown below:
Power apps remove items from collection on uncheck
Power apps remove items from collection on uncheck
  • On the above gallery, add a Power Apps check box control. So that it will visible in every row of the vertical gallery.
  • Insert the below expression on the check box control’s OnCheck property.
OnCheck = Collect(CollSelectedProducts,ThisItem)

Where CollSelectedProducts is the name of the new collection to store the checked item from the gallery.

PowerApps remove items from collection on uncheck
PowerApps remove items from collection on uncheck
  • Similarly, insert the below expression on the checkbox control’s OnUncheck property to remove the items from the collection while the respective item will uncheck on the Power Apps gallery.
OnUncheck = Remove(CollSelectedProducts,ThisItem)
How to remove items from Power Apps collection on uncheck
How to remove items from Power Apps collection on uncheck
  • Next, add a Power Apps data table control and connect that data table with the CollSelectedProducts collection to display the stored items as well as removed items.
How to remove items from PowerApps collection on uncheck
How to remove items from PowerApps collection on uncheck

Let’s preview the app, and check some items (Suppose 3 items) from the Power Apps gallery.

Remove items from Power Apps collection on uncheck
Remove items from Power Apps collection on uncheck

Once we uncheck the items(Ex- remove 2 items) from the Power Apps gallery, it will remove those items from the Power Apps data table control.

Remove items from PowerApps collection on uncheck
Remove items from PowerApps collection on uncheck

This is how to remove items from the PowerApps collection on uncheck.

Read: Power Apps Timer Control Examples

How to remove empty items from the Power apps collection

Now, we will see how to remove the empty items from the Power Apps collection. That means we will remove the empty or blank items from the Power Apps collection if they contain some such items.

Suppose, we have a collection named CollCapital, having some blank items in it. We have displayed that collection with the collected data within a Power Apps gallery as shown below:

Power Apps remove empty items from collection
Power Apps remove empty items from collection
  • To remove the empty items from the above Power Apps collection, add a button control and set the Text property as per the need. (Ex- Remove Empty items)
  • Insert the below expression on the button’s OnSelect property.
OnSelect = Remove(ColCapital, Filter(ColCapital, Country =" " Or Captial = " "))

Where,

  1. ColCapital is the name of the existing collection that we have created.
  2. Country and Captial are the names of the collection header.
PowerApps remove empty items from collection
PowerApps remove empty items from collection

Let’s preview the app and click on the mentioned button. We can see that the empty items will be removed from the data table control while clicking on the button.

Remove empty items from PowerApps collection
Remove empty items from the PowerApps collection

This is how to remove empty items from the PowerApps collection.

Check Post: Power Apps Notify() function [How to use with examples]

Power Apps collection removes items by id

In this section, we will see how to remove the items from the Power Apps collection by id. That means the user can remove the item from the Power Apps collection based on id with a button tap.

Suppose, we have a SharePoint list named Projects having some different types of columns including the default ID column shown below:

Power Apps collection removes items by id
Power Apps collection removes items by id

Let’s remove the item from the above SharePoint list whose ID equals to 68 by using the Power Apps collection. If this is the case, then the required following steps are:

  • On the Power Apps screen, add a button control and insert the below expression on the button’s OnSelect property to create a collection within the Power Apps.
OnSelect = Collect(collProject, Projects)

Where, collProject is the name of the new Power Apps collection and Projects is the name of the SharePoint data source.

  • Let’s click on the button while clicking on the Alt key. It will create the collection. To display those collected data within the Power Apps screen, add a data table control and connect with the collection.
PowerApps collection removes items by id
PowerApps collection removes items by id
  • Let’s add another button and set the Text property as per the need.(Ex- Remove by ID)
  • Insert the below expression on the button’s OnSelect property.
OnSelect = Remove(collProject,LookUp(collProject,ID = 68))
How to remove item from Power Apps collection by id
power apps collection removes items by index

Let’s preview the app and we can see that while clicking on the mentioned button, the specified id will be removed from the Power Apps collection.

power apps collection removes items by value
power apps collection removes items by value

This is how to removes items by id on the Power Apps collection.

Read: Power Apps Filter With Date Picker

Power Apps collection removes items based on condition

In this section, we will see how to remove the items based on the condition from the Power Apps collection. For this, we are going to use the above Power Apps collection i.e., “ProductModelCol” where we will remove items using condition via Power Apps.

Suppose, we want to remove the items whose title contains a specific text i.e., Lenovo or manaufacturer is equals to Lenovo.

Power Apps collection removes items based on condition
Power Apps collection removes items based on condition

To fulfill this requirement, the following steps are:

  • On this above Power Apps screen, add a button control.
  • Give a Text to the button for user understanding.
  • Insert the below expression on the button’s OnSelect property.
OnSelect = RemoveIf(ProductModelCol, Manufacturer.Value = "Lenovo" Or "Lenovo" in Title)

Where,

  1. ProductModelCol is the name of the existing collection.
  2. Manufacturer.Value is the name of the choice column of the collection as well as the SharePoint list.
  3. Title is the name of the text column of the collection.
PowerApps collection removes items based on condition
PowerApps collection removes items based on condition

We can see that while we click on the button, the items will be removed from the above collection that satisfies the mentioned conditions.

Removing Items from Power Apps Collection based on conditions
Removing Items from Power Apps Collection based on conditions

This is how to remove Items from the Power Apps Collection based on conditions.

Also, Check: How To Set Default Date in Power Apps Date Picker

How to remove Power Apps collection items via dropdown control?

We’ll see how to remove items from the Power Apps collection using a dropdown control in this example. That is, we will use the above Power Apps collection and add a dropdown column that will display the Manufacturer’s options. When a user selects an option from the dropdown control and clicks on the specified button control, the items in the Power Apps collection are removed.

To work with this scenario, we are going to use the above example of the Power Apps collection, and the following steps are:

  • On the above screen, add a Power Apps dropdown control to display the items from the SharePoint choice column i.e., Manufacturer.
power apps collection removes items dropdown
power apps collection removes items dropdown
  • Add a button control to the screen, and insert the below expression on the button’s OnSelect property.
OnSelect = RemoveIf(ProductModelCol, Manufacturer.Value = 'Manufacturer_dd'.Selected.Value)

Where ProductModelCol is the name of the collection and Manufacturer_dd is the name of the dropdown control.

PowerApps collection removes items dropdown
PowerApps collection removes items dropdown

That’s it! Let’s preview the app and test it. Select an item from the Power Apps drop-down control (Ex- Lenovo). Then click on the above-mentioned button and we can see that it will remove the items from the Power Apps collection.

PowerApps collection removes items via dropdown
PowerApps collection removes items via dropdown

This is how to remove items from the Power Apps collection via dropdown control.

Read Post: How to Patch Power Apps Date Picker

Power Apps collection removes items in SharePoint list

We saw how to remove items from the Power Apps collection based on different scenarios. In this section, we will see how to remove items from within the SharePoint list.

That means we will remove an item from the SharePoint list via Power Apps. To work with this scenario, the following steps are:

  • Assume we’re going to use the above-mentioned SharePoint list called ‘Product Model,’ and we want to remove an item only from the list (Ex- Dell vostro 3510), not from the Power Apps collection.
power apps collection removes item in SharePoint list
power apps collection removes items in the SharePoint list
  • We have created a collection using the above SharePoint list on the Power Apps screen. Also, we have displayed those data via the Power Apps gallery shown below:
PowerApps collection removes item in SharePoint
PowerApps collection removes items in SharePoint
  • Add a button control to the above Power Apps screen and insert the below expression on the button’s OnSelect property.
OnSelect = RemoveIf('Product Model', Title = "Dell vostro 3510")
Delete SharePoint Item from PowerApps
Delete SharePoint Item from PowerApps
  • Let’s preview the App and we can see the specified item will be removed only from the SharePoint list once we click on the button.
PowerApps collection removes item in SharePoint list
PowerApps collection removes items in the SharePoint list

This is how to remove items from the SharePoint list via Power Apps.

Power Apps collection removes item limit

Do you know about the limitation when removing items from the Power Apps collection? We recently published an article in which we discussed the limitations of the Power Apps collection.

We recommend that you click on the above-mentioned link to learn more about the limitation.

Conclusion

From this Power Apps tutorial, we have learned how to remove items from the Power Apps collection based on different scenarios such as:

  • Power apps remove items from a collection
  • Power apps remove all items from the collection
  • Power apps remove the last item from the collection
  • Power apps remove the first item from the collection
  • Power apps remove multiple items from the collection
  • Power apps remove items from the collection on uncheck
  • Power apps remove empty items from the collection
  • Power Apps collection removes items by id
  • Power Apps collection removes items based on condition
  • Power apps collection removes items dropdown
  • Power apps collection removes items in the SharePoint list
  • Power apps collection removes item limit

Additionally, you may like some more Power Apps tutorials:

Manually re-register a Windows 10 / Windows 11 or Windows Server machine in Hybrid Azure AD Join

Hybrid Azure AD Join devices are machines under Windows 10+ or Windows Server 2016+ that are:

  • Joined to an on-premises Active Directory domain
  • Registered in Azure AD as a hybrid device

Having a Hybrid Azure AD Joined device enables the following features:

  • Automatic device enrollment in Microsoft Intune
  • Device-based conditional access for corporate devices
  • Backup of the BitLocker recovery key in Azure AD
  • Sync of some Windows settings by the Enterprise State Roaming

Sometimes, a machine can be in an inconsistent registration state in Azure Active Directory. This can happen because:

  • The machine was shut down during a long time, and the Azure AD device registration certificate is expired (located in Local Machine / Certificates / Personal)
  • Someone manually deleted the device registration certificate
  • Someone manually deleted the device object in the Azure AD portal
  • The machine is registered in another Azure AD tenant

Please note that this method will only succeed if your organization meets all the prerequisites for Hybrid Azure AD Join. For more information, please refer to this documentation.

Step 1: Unregister the device from Azure AD

Follow this procedure:

  • On the machine to unregister, launch a Command Prompt as an administrator and type the following command:
dsregcmd /leave

  • Make sure the certificates issued by “MS-Organization-Access” and “MS-Organization-P2P-Access [xxxx]” have been deleted from the local machine Personal certificate store:

  • Type the command dsregcmd /status in a Command Prompt, and make sure the following parameters have the appropriate values:
dsregcmd /status

+----------------------------------------------------------------------+
| Device State                                                         |
+----------------------------------------------------------------------+
AzureAdJoined : NO  <-----
EnterpriseJoined : NO
DomainJoined : YES  <-----

Step 2: Re-register the device as a Hybrid Azure AD Join

Follow this procedure:

  • On the machine to re-register, run the Task Scheduler as an administrator.

  • Go to Task Scheduler Library > Microsoft > Windows > Workplace Join and manually start the task “Automatic-Device-Join“.

  • Make sure the certificates issued by “MS-Organization-Access” and “MS-Organization-P2P-Access [xxxx]” have been created in the local machine Personal certificate store:

  • Type the command dsregcmd /status in a Command Prompt, and make sure the following parameters have the appropriate values:
dsregcmd /status

+----------------------------------------------------------------------+
| Device State                                                         |
+----------------------------------------------------------------------+
AzureAdJoined : YES  <-----
EnterpriseJoined : NO
DomainJoined : YES

  • Reboot the PC.

  • Start an Azure AD Connect delta synchronization.

aOS Monaco – 26/09/2019 – Sécurisez vos services Office 365 avec la suite Microsoft 365

La communauté aOS (Azure Office 365 SharePoint) et le Monaco Microsoft User Group (MMUG) vous invitent à la 1ère édition de la journée aOS Monaco le 26 Septembre 2019.

Pendant une journée entière, vous pouvez rencontrer et échanger avec des experts des technologies Office 365 et Azure. Différentes sessions vous seront proposées où nous vous apporteront des retours terrain. Il vous sera ainsi possible de découvrir ou approfondir vos connaissances sur :

  • Azure
  • Office 365
  • Microsoft Teams, SharePoint
  • Power Platform : Power BI, PowerApps, Microsoft Flow

Ce sera aussi l’occasion de partager et échanger entre utilisateurs et professionnels, locaux, nationaux et internationaux, de l’offre Cloud Microsoft.

J’animerai un atelier deep-dive “Sécurisez votre SI et vos services Office 365“, alors n’hésitez pas à réserver vos agendas 🙂

agenda aos monaco 2019

Digital Experience – Bordeaux – Nouveau poste de travail à l’heure du cloud et de la mobilité

J’ai l’honneur de vous annoncer la création de l’évènement Digital Experience à Bordeaux, en collaboration avec AZEO et Microsoft. Cet évènement gratuit se déroulera à l’hôtel Mercure Bordeaux Château Chartrons.

J’aurais l’opportunité de présenter une conférence sur la gestion moderne du poste de travail Windows, à l’heure du cloud et de la mobilité. Nous discuterons des sujets comme le management via Intune, le provisioning via AutoPilot et bien d’autres.

N’hésitez pas à vous inscrire maintenant, les places étant limitées.

Tour de France Microsoft 365 – Paris – 11 Avril 2018

Microsoft organise un Tour de France afin de présenter plus en détails la suite Microsoft 365.

J’aurais l’opportunité de présenter la version parisienne en collaboration avec quelques collègues de Microsoft France, qui se déroulera le 11 Avril 2018 chez Microsoft France, à Issy-Les-Moulineaux.

Voici le plan de cette demi-journée :

  • 9:00-9:30 : Accueil & petit-déjeuner
  • 9:30-10:00 : Découverte de la solution Microsoft 365 pour les entreprises et les collectivités
  • 10:00-10:15 : Annonce de l’arrivée des Data Center Office 365 en France
  • 10:15-11:00 : Focus sur la sécurité et GDPR au sein de votre entreprise
  • 11:00-11:30 : Présentation des offres et de l’expertise AZEO

N’hésitez pas à vous inscrire ici.

Run PowerShell script on Windows 10 PC through the MDM Channel in Intune

In the last couple of weeks I've been working on an internal project that includes software distribution of Windows apps on MDM enrolled Windows 10 PCs using cloud only Intune deployment. Yes that's right, no SharePoint in this post, but a real world EMS story.
The easiest way to publish classic windows apps on Windows 10 PC that is MDM enrolled will be by publishing Windows Installer through MDM (*.msi) installer.
The important thing with this installer type is that the installation should go without any user interaction required especially when you use "Required Install".
The issue I hit is related to Dell software that is essential for the remote work and almost everyone in the company is using it. However for some reason the software publisher (Dell Software) is considered not trusted in Windows 10. There is this great thing in Windows (since Win 7) called SmartScreen that will pop-up a question asking if we trust the software publisher, before running executable with not trusted publisher. If we manually install the software we are clicking Yes and everithing is fine, the signing certificate is added to the Trusted Publishers certificate store.
However, when we are deploying the package over Intune this issue will cause the installation to fail with exit code 1603.
The way to fix this is to extract the signing certificate and install it in the Trusted Publisher on the target computer or to turn off SmartScreen with a policy, but the second is not a good security practice. The issue is that we cannot deploy cert to the Trusted Publishers store using Intune configuration policy.
My solution is to use PowerShell script that will be deployed and executed over the MDM channel.
The issue is that Intune does not support direct script deployment. There are some articles on the net that are demonstrating how to package batch script in self-extracting executable using IExpress.
However we need to wrap PowerShell script in MSI package suitable for MDM deployment.
I think that this is a very useful technique and I will try to put all the peaces together in this post, so you can deploy and run every PowerShell script on Windows 10 MDM PCs.
The easiest(and free) way to do this will be to create a self-extracting exe with IExpress, wrap the exe in MSI and publish it to Intune.
In order to reliably wrap the PS script in exe I used a script that I found in the TechNet Gallery called Create-EXEFrom.ps1. It will do a really good job wrapping the PS script and you can also add additional files in the package, like in my case I will need Dell Software certificate that should be installed on the target machine. Below is an example line for wrapping MyApp.ps1 script (this will be name used in all sample code) including the certificate we need.

.\Create-EXEFrom.ps1 -PSScriptPath "C:\MyApp.ps1" -SupplementalFilePaths "C:\Certificate.cer"


The exe will be created in the same folder and will be called "MyApp.exe".
The tricky part is that our exe and msi package should also be executed without any interaction required, including bypassing of the SmartScreen. This can be done by properly signing both packages with valid code signing certificate. In my case I have used the certificate that we normally use in bluesource for signing mobile apps. In order to sign the packages you can use the signtool.
If the signing is successful you should see below in your file properties and you should be able to run the exe without SmartScreen alerts.
Publisher Certificate

Now when we have signed exe we should wrap it in MSI package.
The easiest free way for me was to use WiX Toolset to do that. I put together really simple WiX project with only one custom action that will execute the exe. Below you can see the sample xml with the cmd commands I used to compile the WiX project.
If you are new to WiX  you should have your WiX bin folder in the PATH variable to make the cmd script work as it is. In my case it is "C:\Program Files (x86)\WiX Toolset v3.10\bin"(I know it is not the newest version).
Note that the package will be installed under the SYSTEM account and you should consider that in your scripts. You can find how to test MSI package in following article.
Next step is to publish the MSI as "Windows Installer through MDM (*.msi)" installer type as it is shown below.
Intune Publish MSI

The last thing that's left is to deploy the newly published app and maybe running some tests won't be a bad idea :).

I hope that this non-SharePoint post, written by a SharePoint guy will be helpful!
❌
❌