Share via


Get-SPOAppInfo | SharePoint Online | PowerShell | CSOM

Summary

During a SharePoint discussion, a good question was raised “How to get all SharePoint Online Apps?”. A quick reply was to use Get-SPOAppInfo cmdlet! That’s not correct and let’s see the solution in this TechNet Wiki Article.

Link to know about the SharePoint Online Management Shell

Link to download SharePoint Online Management Shell

Link to download SharePoint Online SDK

Issue

As per the TechNet Documentation for Get-SPOAppInfo cmdlet either Name or ProductID must be given. Look at the image below!

 

Solution

To get all the apps, simply use CSOM and meet the requirement.

Import-Module C:\SPPowerKit\Microsoft.SharePoint.Client.dll
Import-Module C:\SPPowerKit\Microsoft.SharePoint.Client.Runtime.dll
#Import-Module C:\SPPowerKit\Microsoft.SharePoint.Client.UserProfiles.dll
Import-Module C:\SPPowerKit\Microsoft.Online.SharePoint.Client.Tenant.dll
function Get-SPOAppInformation
{
    param(
    [Parameter(Mandatory=$true)]
    [string]$SPOUrl,
 
    [Parameter(Mandatory=$true)]
    [System.Management.Automation.CredentialAttribute()]$SPOCredential
    )
 
    $ClientContext = [Microsoft.SharePoint.Client.ClientContext]::new($SPOUrl)
    $ClientContext.Credentials = [Microsoft.SharePoint.Client.SharePointOnlineCredentials]::new($SPOCredential.UserName,$SPOCredential.Password)
    $Tenant = New-Object Microsoft.Online.SharePoint.TenantAdministration.Tenant -ArgumentList $ClientContext
    $Tenant.Context.Load($Tenant)
    $Tenant.Context.ExecuteQuery()
    $Appinfocollection = $Tenant.GetAppInfoByName([string]::Empty)
    $Tenant.Context.Load($Appinfocollection)
    $Tenant.Context.ExecuteQuery()
    foreach($Apps in  $Appinfocollection)
    {
        $Results = New-Object psobject -Property ([Ordered]@{
        Name = $Apps.Name
        ProductID = $Apps.ProductID
        Source = $Apps.Source
        })
        $Results
    }
    $ClientContext.Dispose()
}
 
Get-SPOAppInformation -SPOUrl "https://contoso-admin.sharepoint.com" -SPOCredential "TenantAdmin@contoso.onmicrosoft.com"

It's that easy! See the output below: