During SharePoint Online discussion a question popped up “How to get all installed application information in SharePoint Online?” a simple answer is Get-SPOAppInfo cmdlet! But, wait we are partially correct but read this documentation https://technet.microsoft.com/en-us/library/fp161398.aspx. The below image illustrates the parameters of Get-SPOAppInfo both set to be false and it’s not $TRUE – This cmdlet needs either Name or Product ID! So, we can’t use this cmdlet to retrieve all the apps installed in the given Tenant!
Issue:
So we can Get installed apps information by using below
Enough! We are not going to use this. Let’s use Client Side Object Model in PowerShell and solve the issue.
Output
Code:
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() $Appinfo = $Tenant.GetAppInfoByName([string]::Empty) $Tenant.Context.Load($Appinfo) $Tenant.Context.ExecuteQuery() $Appinfo $ClientContext.Dispose() } Get-SPOAppInformation -SPOUrl "https://contoso-admin.sharepoint.com" -SPOCredential "TenantAdmin@contoso.onmicrosoft.com"
Bit more to organize it, we can use PSObject!
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"