Solved

New ribbon button not working in production

Posted on 2013-01-24
8
623 Views
Last Modified: 2013-01-24
I have created a solution that adds a new button to the ribbon, it works fine in the test environment where I could deploy it with Visual Studio 2010. I have deployed the solution in the production environment by first adding the solution with SharePoint 2010 Management Shell, then deploying it in Central Administration (had to do that because it was global), and finally activating the feature in the solution. I have also added the button image files. I get no error messages, but the button is not there in the lists (in views, in List Tools) where it is supposed to be. Any ideas?
0
Comment
Question by:kasperEH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 38813918
Hi,
could you perhaps share the button definition?
Just to verify registration ids,...

Can you test it on a second web app on your test machine?
(just to check if its web app or machine related)
0
 

Author Comment

by:kasperEH
ID: 38813928
This is the Like button, you helped me with, so I guess it's OK :-) Anyway, here is the button definition:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
  Location="EditControlBlock"
  RegistrationId="101"
   RegistrationType="List"
  Id="LikeSingleItem"
  Title="Like Single Item"
  Rights="ViewListItems,EditListItems"
  ImageUrl="/_layouts/images/DevLeap.SP2010.UIExtensions/IconArchive.gif"
  Description="Like this item">
    <UrlAction Url="~site/_layouts/DevLeap.SP2010.UIExtensions/DevLeapInvoiceChangeStatus.aspx?ItemId={ItemId}&amp;ListId={ListId}&amp;Status=Archived" />
  </CustomAction>
  <CustomAction
   Id="RibbonAlert"
   RegistrationId="100"
   RegistrationType="List"
   Location="CommandUI.Ribbon">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.ListItem.Actions.Controls._children">
          <Button Id="SampleRibbonCommand"
                  Alt="Like"
                  Description="Like button"
                  Sequence="5"
                  Command="LikeDocs"
                  Image16by16="/_layouts/images/Like/Thumbs up_16x16.png"
                  Image32by32="/_layouts/images/Like/Thumbs up_32x32.png"
                  LabelText="Like"
                  TemplateAlias="o1" />
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler Command="LikeDocs"
                          EnabledScript="javascript:
                          
                             function checkDocsSelected()
                             {
                               // Check the number of selected items
                               var items = SP.ListOperation.Selection.getSelectedItems();
                               return (items.length >= 1);
                             }
                             checkDocsSelected();"
                          CommandAction="javascript:
                          
                             // Shared variables
                             var ctx;
                             var itemsToLike;
                             var notifyId = '';

                             // Function that archives the selected items
                             function likeDocs() {
                             
                               // Notify the end user about the work in progress
                               this.notifyId = SP.UI.Notify.addNotification('Liking docs...', true);
                          
                               // Get the current ClientContext
                               this.ctx = new SP.ClientContext.get_current();

                               // Get the current Web
                               var web = this.ctx.get_web();

                               // Get the currently selected list
                               var listId = SP.ListOperation.Selection.getSelectedList();
                               var sourceList = web.get_lists().getById(listId);

                               // Get the selected items and like each of them
                               var items = SP.ListOperation.Selection.getSelectedItems(this.ctx);
                               
                               var item;      
                               this.itemsToLike = new Array(items.length);
                               for(var i in items) {
                                 item = items[i];
                                 
                                 // Get each selected item
                                 var listItem = sourceList.getItemById(item.id);
                                 this.itemsToLike.push(listItem);
                                 this.ctx.load(listItem);
                               }
                               
                               // Effectively load items from SharePoint
                               this.ctx.executeQueryAsync(Function.createDelegate(this, onQuerySucceeded), Function.createDelegate(this, onQueryFailed));
                             }
                             
                             // Delegate called when server operation is completed upon success
                             function onQuerySucceeded(sender, args) {
                               // Mark each item as Like
                               var item = null;
                               do {
                                 item = this.itemsToLike.pop();
                                 if (item != null) {
                                   var prevvalue = item.get_item('Like');
                                   if (prevvalue == null)
                                   {
                                        prevvalue = '';
                                   }
                                   if (CheckLike(prevvalue) == false)
                                   {
                                    var newvalue = RibbonLike(prevvalue);
                                    item.set_item('Like', newvalue);
                                    item.update();                                  
                                   }
                                 }
                               } while (item != null);
                               
                               // Effectively update items in SharePoint
                               this.ctx.executeQueryAsync(Function.createDelegate(this, onUpdateSucceeded), Function.createDelegate(this, onQueryFailed));
                             }

                             // Delegate called when server operation is completed upon success
                             function onUpdateSucceeded(sender, args) {
                               SP.UI.Notify.removeNotification(this.notifyId);
                               SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
                             }
                             
                             // Delegate called when server operation is completed with errors
                             function onQueryFailed(sender, args) {
                               alert('The requested operation failed: ' + args.toString());
                             }

                             likeDocs();" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>

Open in new window

0
 

Author Comment

by:kasperEH
ID: 38813963
One thing I've been thinking about is: In Visual Studio in the Site URL for the solution I wrote the URL for the test environment, deployed and tested it. Then I changed it to the URL for the production and rebuilt, but the WSP didn't seem to be updated. The file still has the same date. Could that be part of the problem?
0
Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 38814020
Hi,
normally not. The url is just used when you click "Deploy" as it then add / readd the solution, run the deploy and feature activation (if not configured differently).

To re-create the solution you can run "Rebuild" and "Package".
0
 

Author Comment

by:kasperEH
ID: 38814078
I tried to re-create the solution with the production server's site URL but that didn't change anything.
0
 

Author Comment

by:kasperEH
ID: 38814083
The first custom action (the one with registration id 101) was just en experiment, so I have removed it.
0
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 38814125
Did you change the "Solution Configuration" from "Debug" to "Release"?
Perhaps you are looking the the wrong path.

I assume your solution do not only contain the feature for the new button but also some other files / features?
Is the solution deployed for the first time?

I have just tested: the custom action definition works as expected (OK, I am missing the pics and ...) but at least on my custom lists the button shows up.

If there is nothing else in there which is already used, I would try to:
- Deactivate all activated features of the solution (through Site Settings)
- Retract the solution (through Central Admin)
- Wait until finished
- Remove solution (through Central Admin)

Then I would Rebuild, re-package the WSP file. Then make a copy, change extension to ".cab" and review the content, if the above element is in there.
Then add the solution through SharePoint management shell, deploy it through Central Admin and activate the feature.

HTH
Rainer
0
 

Author Closing Comment

by:kasperEH
ID: 38814516
When I went through your list, I found out that the feature wasn't activated in Site Settings even though I had issued an stsadm command to activate it, but apparently that wasn't enough. Thanks a lot, Rainer.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary In SharePoint 2010 it is easy to create custom color themes to jazz up a site. Theme colors can also be created in PowerPoint 2010 with a few clicks. But how do the chosen colors actually look in the SharePoint site? The attached PowerPoint…
The vision: A MegaMenu for a SharePoint portal home page The mission: Make it easy to maintain. Allow rich content and sub headers as well as standard links. Factor in frequent changes without involving developers or a lengthy Dev/Test/Prod rel…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question