示例#1
0
        public override void ExecuteCmdlet()
        {
            ExecutionBlock(() =>
            {
                if (ObjectId != Guid.Empty)
                {
                    WriteObject(ActiveDirectoryClient.GetApplication(ObjectId.ToString()));
                }
                else
                {
                    Rest.Azure.OData.ODataQuery <Application> odataQueryFilter = new Rest.Azure.OData.ODataQuery <Application>();

                    if (ApplicationId != Guid.Empty)
                    {
                        string appId     = ApplicationId.ToString();
                        odataQueryFilter = new Rest.Azure.OData.ODataQuery <Application>(a => a.AppId == appId);
                    }
                    else if (!string.IsNullOrEmpty(DisplayNameStartWith))
                    {
                        odataQueryFilter = new Rest.Azure.OData.ODataQuery <Application>(a => a.DisplayName.StartsWith(DisplayNameStartWith));
                    }
                    else if (!string.IsNullOrEmpty(IdentifierUri))
                    {
                        odataQueryFilter = new Rest.Azure.OData.ODataQuery <Application>(a => a.IdentifierUris.Contains(IdentifierUri));
                    }

                    WriteObject(ActiveDirectoryClient.GetApplicationWithFilters(odataQueryFilter), enumerateCollection: true);
                }
            });
        }
示例#2
0
        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);
            }
        }
示例#3
0
        public override void ExecuteCmdlet()
        {
            ExecutionBlock(() =>
            {
                if (this.IsParameterBound(c => c.InputObject))
                {
                    ObjectId = InputObject.ObjectId;
                }
                else if (this.IsParameterBound(c => c.ApplicationId))
                {
                    ObjectId = ActiveDirectoryClient.GetAppObjectIdFromApplicationId(ApplicationId);
                }

                ApplicationUpdateParameters parameters = new ApplicationUpdateParameters
                {
                    DisplayName             = DisplayName,
                    Homepage                = HomePage,
                    IdentifierUris          = IdentifierUri,
                    ReplyUrls               = ReplyUrl,
                    AvailableToOtherTenants = AvailableToOtherTenants
                };

                if (ShouldProcess(target: ObjectId.ToString(), action: string.Format("Updating an application with object id '{0}'", ObjectId)))
                {
                    ActiveDirectoryClient.UpdateApplication(ObjectId, parameters);
                    WriteObject(ActiveDirectoryClient.GetApplication(ObjectId));
                }
            });
        }
示例#4
0
        public override void ExecuteCmdlet()
        {
            ExecutionBlock(() =>
            {
                if (this.IsParameterBound(c => c.ObjectId))
                {
                    WriteObject(ActiveDirectoryClient.GetApplication(ObjectId));
                }
                else
                {
                    Rest.Azure.OData.ODataQuery <Application> odataQueryFilter = new Rest.Azure.OData.ODataQuery <Application>();

                    if (this.IsParameterBound(c => c.ApplicationId))
                    {
                        string appId     = ApplicationId.ToString();
                        odataQueryFilter = new Rest.Azure.OData.ODataQuery <Application>(a => a.AppId == appId);
                    }
                    else if (this.IsParameterBound(c => c.DisplayNameStartWith))
                    {
                        odataQueryFilter = new Rest.Azure.OData.ODataQuery <Application>(a => a.DisplayName.StartsWith(DisplayNameStartWith));
                    }
                    else if (this.IsParameterBound(c => c.IdentifierUri))
                    {
                        odataQueryFilter = new Rest.Azure.OData.ODataQuery <Application>(a => a.IdentifierUris.Contains(IdentifierUri));
                    }
                    else if (this.IsParameterBound(c => c.DisplayName))
                    {
                        odataQueryFilter = new Rest.Azure.OData.ODataQuery <Application>(a => a.DisplayName == DisplayName);
                    }

                    ulong first = MyInvocation.BoundParameters.ContainsKey("First") ? this.PagingParameters.First : ulong.MaxValue;
                    ulong skip  = MyInvocation.BoundParameters.ContainsKey("Skip") ? this.PagingParameters.Skip : 0;
                    WriteObject(ActiveDirectoryClient.GetApplicationWithFilters(odataQueryFilter, first, skip), enumerateCollection: true);
                }
            });
        }