Office 365 Dev Tip - Getting all Apps from your Tenant App Catalog using the Office 365 (CSOM) API

Tobias Zimmergren
Tobias Zimmergren

Here’s another quick-tip when working with Office 365 dev / SharePoint Online CSOM. A lot of people have asked me by e-mail, comments and twitter on how to get information about their apps in their tenants programmatically.

With that, I thought it’d be fun to post another code snippet with details on how to retrieve information about your Apps in your SharePoint Online tenant.


In order to run the code in the snippet you should already have:

Office 365 dev – Code snippet

It’s pretty straight forward to pull out information about the apps, as seen in this snippet.

using (ClientContext context = new ClientContext("")) 
    // Create a new Microsoft.Online.SharePoint.TenantAdministration.Tenant object and reference the client context of your Admin site 
    Tenant tenant = new Tenant(context);

// If you define an empty string for GetAppInfoByName, you'll get ALL Apps.
    var appCatalogAppInfoCollection = tenant.GetAppInfoByName(string.Empty);

    foreach (var app in appCatalogAppInfoCollection)
        Debug.WriteLine("APP: " + app.Name);
        Debug.WriteLine("Source: " + app.Source);

Snippet note: You can see I’m using ClientContext.ExecuteQueryRetry() rather then just ClientContext.ExecuteQuery(). This is an extension-method from the Office 365 PnP Core library, which I would urge you to use. In case of your request being throttled by SharePoint Online, this method will retry the action a few times (or as many times as you specify in the method as parameters).

Here’s all the AppInfo properties you can retrieve:

public string Name { get; set; }
public Guid ProductId { get; set; }
public AppSource Source { get; set; }


Office 365Office 365 APICSOMSharePoint

Tobias Zimmergren Twitter

Hi, I'm Tobias! 👋 I write about Microsoft Azure, security, cybersecurity, compliance, cloud architecture, Microsoft 365, and general tech!

Reactions and mentions

Hi, I'm Tobias 👋

Tobias Zimmergren profile picture

Find out more about me.

Recent comments