protected override void ExecuteCmdlet()
        {
            CustomActionEntity ca = new CustomActionEntity
            {
                Title    = Title,
                Location = "ClientSideExtension.ApplicationCustomizer",
                ClientSideComponentId         = ClientSideComponentId,
                ClientSideComponentProperties = ClientSideComponentProperties,
                ClientSideHostProperties      = ClientSideHostProperties
            };

            switch (Scope)
            {
            case CustomActionScope.Web:
                SelectedWeb.AddCustomAction(ca);
                break;

            case CustomActionScope.Site:
                ClientContext.Site.AddCustomAction(ca);
                break;

            case CustomActionScope.All:
                WriteWarning("CustomActionScope 'All' is not supported for adding CustomActions");
                break;
            }
        }
Esempio n. 2
0
        protected override void ExecuteCmdlet()
        {
            var permissions = new BasePermissions();

            if (Rights != null)
            {
                foreach (var kind in Rights)
                {
                    permissions.Set(kind);
                }
            }
            CustomActionEntity ca = null;

            if (ParameterSetName == "Default")
            {
                ca = new CustomActionEntity
                {
                    Name               = Name,
                    ImageUrl           = ImageUrl,
                    CommandUIExtension = CommandUIExtension,
                    RegistrationId     = RegistrationId,
                    RegistrationType   = RegistrationType,
                    Description        = Description,
                    Location           = Location,
                    Group              = Group,
                    Sequence           = Sequence,
                    Title              = Title,
                    Url    = Url,
                    Rights = permissions,
                };
            }
            else
            {
#if !ONPREMISES
                ca = new CustomActionEntity()
                {
                    Name     = Name,
                    Title    = Title,
                    Location = Location,
                    ClientSideComponentId         = ClientSideComponentId.Id,
                    ClientSideComponentProperties = ClientSideComponentProperties
                };
#endif
            }

            switch (Scope)
            {
            case CustomActionScope.Web:
                SelectedWeb.AddCustomAction(ca);
                break;

            case CustomActionScope.Site:
                ClientContext.Site.AddCustomAction(ca);
                break;

            case CustomActionScope.All:
                WriteWarning("CustomActionScope 'All' is not supported for adding CustomActions");
                break;
            }
        }
Esempio n. 3
0
        protected override void ExecuteCmdlet()
        {
            var permissions = new BasePermissions();

            foreach (var kind in Rights)
            {
                permissions.Set(kind);
            }
            var ca = new CustomActionEntity {
                Description = Description, Location = Location, Group = Group, Sequence = Sequence, Title = Title, Url = Url, Rights = new BasePermissions()
            };

            foreach (var permission in Rights)
            {
                ca.Rights.Set(permission);
            }

            if (Scope == CustomActionScope.Web)
            {
                SelectedWeb.AddCustomAction(ca);
            }
            else
            {
                ClientContext.Site.AddCustomAction(ca);
            }
        }
Esempio n. 4
0
        protected override void ExecuteCmdlet()
        {
            var permissions = new BasePermissions();

            if (Rights != null)
            {
                foreach (var kind in Rights)
                {
                    permissions.Set(kind);
                }
            }

            var ca = new CustomActionEntity
            {
                Name               = Name,
                ImageUrl           = ImageUrl,
                CommandUIExtension = CommandUIExtension,
                RegistrationId     = RegistrationId,
                RegistrationType   = RegistrationType,
                Description        = Description,
                Location           = Location,
                Group              = Group,
                Sequence           = Sequence,
                Title              = Title,
                Url    = Url,
                Rights = permissions,
            };

#if !ONPREMISES
            if (ClientSideComponentId.Id != Guid.Empty)
            {
                ca.ClientSideComponentId = ClientSideComponentId.Id;
            }
            if (!string.IsNullOrEmpty(ClientSideComponentProperties))
            {
                ca.ClientSideComponentProperties = ClientSideComponentProperties;
            }
#endif

            switch (Scope)
            {
            case CustomActionScope.Web:
                SelectedWeb.AddCustomAction(ca);
                break;

            case CustomActionScope.Site:
                ClientContext.Site.AddCustomAction(ca);
                break;

            case CustomActionScope.All:
                WriteWarning("CustomActionScope 'All' is not supported for adding CustomActions");
                break;
            }
        }
        protected override void ExecuteCmdlet()
        {
            var permissions = new BasePermissions();

            if (Rights != null)
            {
                foreach (var kind in Rights)
                {
                    permissions.Set(kind);
                }
            }

            var ca = new CustomActionEntity
            {
                Name               = Name,
                ImageUrl           = ImageUrl,
                CommandUIExtension = CommandUIExtension,
                RegistrationId     = RegistrationId,
                RegistrationType   = RegistrationType,
                Description        = Description,
                Location           = Location,
                Group              = Group,
                Sequence           = Sequence,
                Title              = Title,
                Url    = Url,
                Rights = permissions
            };

            switch (Scope)
            {
            case CustomActionScope.Web:
                SelectedWeb.AddCustomAction(ca);
                break;

            case CustomActionScope.Site:
                ClientContext.Site.AddCustomAction(ca);
                break;

            case CustomActionScope.All:
                WriteWarning("CustomActionScope 'All' is not supported for adding CustomActions");
                break;
            }
        }
Esempio n. 6
0
        protected override void ExecuteCmdlet()
        {
            var permissions = new BasePermissions();

            if (Rights != null)
            {
                foreach (var kind in Rights)
                {
                    permissions.Set(kind);
                }
            }

            var ca = new CustomActionEntity
            {
                Name               = Name,
                ImageUrl           = ImageUrl,
                CommandUIExtension = CommandUIExtension,
                RegistrationId     = RegistrationId,
                RegistrationType   = RegistrationType,
                Description        = Description,
                Location           = Location,
                Group              = Group,
                Sequence           = Sequence,
                Title              = Title,
                Url    = Url,
                Rights = permissions
            };

            if (Scope == CustomActionScope.Web)
            {
                SelectedWeb.AddCustomAction(ca);
            }
            else
            {
                ClientContext.Site.AddCustomAction(ca);
            }
        }