The following example shows how to get the application by its name
public static class WebExtensions { public static IEnumerable<AppInstance> GetAppInstanceByTitle(this Web web,string appTitle) { var ctx = web.Context; var apps = AppCatalog.GetAppInstances(ctx, web); var result = ctx.LoadQuery(apps.Where(a => a.Title == appTitle)); return result; } }
Using
using (var ctx = new ClientContext(webUri)) { var appTitle = "\"Napa\" Office 365 Development Tools"; var result = ctx.Web.GetAppInstanceByTitle(appTitle); ctx.ExecuteQuery(); var app = result.FirstOrDefault(); if (app != null) Console.WriteLine(app.Id);
source share