public override void ExecuteCmdlet()
        {
            if (ApplicationObjectId != Guid.Empty)
            {
                WriteObject(ActiveDirectoryClient.GetApplication(ApplicationObjectId.ToString()));
            }
            else
            {
                ApplicationFilterParameters parameters = new ApplicationFilterParameters();
                if (ApplicationId != Guid.Empty)
                {
                    parameters.AppId = ApplicationId;
                }
                else if (!string.IsNullOrEmpty(DisplayNameStartWith))
                {
                    parameters.DisplayNameStartsWith = DisplayNameStartWith;
                }
                else if (!string.IsNullOrEmpty(IdentifierUri))
                {
                    parameters.IdentifierUri = IdentifierUri;
                }

                WriteObject(ActiveDirectoryClient.GetApplicationWithFilters(parameters), enumerateCollection: true);
            }
        }
 /// <summary>
 /// Get applications by filters.  (see
 /// http://msdn.microsoft.com/en-us/library/azure/hh974476.aspx for
 /// more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.Azure.Graph.RBAC.IApplicationOperations.
 /// </param>
 /// <param name='parameters'>
 /// Required. Application filter parameters
 /// </param>
 /// <returns>
 /// Server response for List application information API call
 /// </returns>
 public static Task<ApplicationListResult> ListAsync(this IApplicationOperations operations, ApplicationFilterParameters parameters)
 {
     return operations.ListAsync(parameters, CancellationToken.None);
 }
 /// <summary>
 /// Get applications by filters.  (see
 /// http://msdn.microsoft.com/en-us/library/azure/hh974476.aspx for
 /// more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.Azure.Graph.RBAC.IApplicationOperations.
 /// </param>
 /// <param name='parameters'>
 /// Required. Application filter parameters
 /// </param>
 /// <returns>
 /// Server response for List application information API call
 /// </returns>
 public static ApplicationListResult List(this IApplicationOperations operations, ApplicationFilterParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IApplicationOperations)s).ListAsync(parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
 public IList<Application> ListApplicationsByFilters(ApplicationFilterParameters parameters)
 {
     return GraphClient.Application.List(parameters).Applications;
 }
 public IEnumerable<PSADApplication> GetApplicationWithFilters(ApplicationFilterParameters parameters)
 {
     return GraphClient.Application.List(parameters).Applications.Select(a => a.ToPSADApplication());
 }