Exemplo n.º 1
0
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPWeb web = (properties.Feature.Parent as SPSite).RootWeb;

            var button1 = ControlLibrary.CreateRandomButton();

            var ribbonCustomAction = new RibbonCustomAction();

            // We need assign TemplateAlias manually to buttons, if they will be deployed separately
            button1.TemplateAlias = "o1";
            ribbonCustomAction.AddControl(button1, "Ribbon.ListItem.New", 1);

            ribbonCustomAction.Provision(properties.Feature.DefinitionId, web, ListTypes.GenericList);
        }
Exemplo n.º 2
0
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            var web = properties.Feature.Parent as SPWeb;

            var button = new ButtonDefinition()
            {
                Id                      = "EmailsButton",
                Title                   = "Emails button",
                Image                   = ImageLibrary.GetStandardImage(14, 4),
                CommandJavaScript       = "PopupEmailsDialog();",
                CommandEnableJavaScript = "SP.ListOperation.Selection.getSelectedItems().length > 0",
                TemplateAlias           = "o1"
            };

            var ribbonCustomAction = new RibbonCustomAction();

            ribbonCustomAction.AddControl(button, SPRibbonIds.ListItem.Groups.Actions.Id, 10);
            ribbonCustomAction.Provision(properties.Definition.Id, web, ListTypes.ContactsList);
        }
Exemplo n.º 3
0
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPSite site = properties.Feature.Parent as SPSite;

            var buttonDelete = ControlLibrary.StandardButtons.ListItem.Manage_Delete("");

            buttonDelete.Title = "Remove";

            var buttonNew = new ButtonDefinition()
            {
                Id    = "NewProject",
                Title = "New",
            };

            var group = new GroupDefinition()
            {
                Id       = "MyGroup",
                Title    = "Custom controls",
                Template = Libraries.GroupTemplateLibrary.SimpleTemplate,
                Controls = new ControlDefinition[]
                {
                    buttonNew,
                    buttonDelete
                }
            };

            var ribbonCustomAction = new RibbonCustomAction();

            ribbonCustomAction.AddControlGroup(group, SPRibbonIds.ListItem.Id, 25);
            ribbonCustomAction.RemoveRibbonElement(SPRibbonIds.ListItem.Groups.New.Id);

            // We need assign TemplateAlias manually to buttons, if they will be deployed separately
            var button1 = ControlLibrary.CreateRandomButton();

            button1.TemplateAlias = "o1";
            ribbonCustomAction.AddControl(button1, SPRibbonIds.ListItem.Groups.Manage.Id, 1);
            ribbonCustomAction.Provision(properties.Definition.Id, site, ListTypes.GenericList);
        }
Exemplo n.º 4
0
        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            var web = properties.Feature.Parent as SPWeb;

            RibbonCustomAction.RemoveAllCustomizations(web, properties.Definition.Id);
        }
Exemplo n.º 5
0
        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            SPSite site = properties.Feature.Parent as SPSite;

            RibbonCustomAction.RemoveAllCustomizations(site, properties.Definition.Id);
        }