static void RetrieveApps() { Console.WriteLine("Start to sync AAD Apps ..."); IPagedCollection<IApplication> applications = null; try { applications = activeDirectoryClient.Applications.Take(999).ExecuteAsync().Result; } catch (Exception e) { Console.WriteLine("\nError getting Applications {0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""); } if (applications != null) { do { List<IApplication> appsList = applications.CurrentPage.ToList(); foreach (IApplication app in appsList) { var newApp = new AppEntity(app.AppId, app.DisplayName); newApp.AppRoles = app.AppRoles.Count; newApp.AppType = app.ObjectType; newApp.HomePage = app.Homepage; newApp.IdentifierUris = app.IdentifierUris.Count; appTableOper.InsertEntity(newApp); } applications = applications.GetNextPageAsync().Result; } while (applications != null); } }
public bool InsertEntity(AppEntity app) { var operation = TableOperation.InsertOrReplace(app); _table.Execute(operation); return true; }