Home > SharePoint 2010 > Replace the In place Record Action Item in Ribbon

Replace the In place Record Action Item in Ribbon

August 26th, 2011

Recently I worked on an interesting work item. I have been asked to change the In place record action item image in SharePoint ribbon. As you might know adding a custom action in ribbon is just a piece of cake. But when I started looking for records action item, I couldn’t find it in the list of all default custom actions.

So I did some more work on it and found the feature which is adding the custom action.  It is available in 14 hives with the name InPlaceRecords. It uses an action.xml element file. This file defines the custom action for In place record icon in ribbon. Here is the xml for this action file.

<?xml version="1.0" encoding="utf-8"?>
<!-- _lcid="1033" _version="14.0.4758" _dal="1" -->
<!-- _LocalBinding -->
<Elements xmlns="<a href="http://schemas.microsoft.com/sharepoint/">http://schemas.microsoft.com/sharepoint/</a>">
    <Control
        Id="AdditionalPageHead"
        Sequence="70"
        ControlSrc="~/_controltemplates/recordsribbon.ascx">
    </Control>
    <CustomAction
        Id="InPlaceRecordsSettingsSite"
        GroupId="SiteCollectionAdmin"
        Location="Microsoft.SharePoint.SiteSettings"
        Rights="ManageWeb"
        Sequence="110"
        Title="$Resources:dlccore, InPlaceRecords_SettingsLink">
            <UrlAction Url="_layouts/InPlaceRecordsSettings.aspx?Source=settings.aspx" />
    </CustomAction>
    <CustomAction
        Id="InPlaceRecordsSettingsList"
        GroupId="Permissions"
        Location="Microsoft.SharePoint.ListEdit"
        Rights="ManageLists"      �
        Sequence="110"
        Title="$Resources:dlccore, InPlaceRecords_ListSettingsLink">
            <UrlAction Url="_layouts/InPlaceRecordsListSettings.aspx?List={ListId}" />
    </CustomAction>
    <CustomAction
        Id="Ribbon.Documents.Manage.DeclareRecord"
        Location="CommandUI.Ribbon"
        Rights="EditListItems"
        Sequence="17"
        Title="$Resources:dlccore, InPlaceRecords_DeclareRecordButtonText">
     <CommandUIExtension>
      <CommandUIDefinitions>
       <CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children">
              <Button
                Id="Ribbon.Documents.Manage.DeclareRecord"
                Sequence="25"
                Command="DeclareRecord"
                LabelText="$Resources:dlccore, InPlaceRecords_DeclareRecordButtonText"
                Image16by16="/_layouts/images/declarerecorditemhs.png"
                Image32by32="/_layouts/images/declarerecorditemhh.png"
                ToolTipTitle="$Resources:dlccore, InPlaceRecords_DeclareRecordButtonText"
                ToolTipDescription="$Resources:dlccore, InPlaceRecords_DeclareRecordButtonToolTipDescription"
                TemplateAlias="o1"
              />
       </CommandUIDefinition>
      </CommandUIDefinitions>
     </CommandUIExtension>
    </CustomAction>
    <CustomAction
        Id="Ribbon.ListItems.Manage.DeclareRecord"
        Location="CommandUI.Ribbon"
        Rights="EditListItems"
        Sequence="17"
        Title="$Resources:dlccore, InPlaceRecords_DeclareRecordButtonText">
     <CommandUIExtension>
      <CommandUIDefinitions>
       <CommandUIDefinition Location="Ribbon.ListItem.Manage.Controls._children">
              <Button
                Id="Ribbon.ListItem.Manage.DeclareRecord"
                Sequence="25"
                Command="DeclareRecord"
                LabelText="$Resources:dlccore, InPlaceRecords_DeclareRecordButtonText"
                Image16by16="/_layouts/images/declarerecorditemhs.png"
                Image32by32="/_layouts/images/declarerecorditemhh.png"
                ToolTipTitle="$Resources:dlccore, InPlaceRecords_DeclareRecordButtonText"
                ToolTipDescription="$Resources:dlccore, InPlaceRecords_DeclareRecordButtonToolTipDescription"
                TemplateAlias="o1"
              />
       </CommandUIDefinition>
      </CommandUIDefinitions>
     </CommandUIExtension>
    </CustomAction>
</Elements>

Now in order to replace it I created a new feature and added an element file in it. I copied the whole action.xml in it and changed the images icon for 32 and 64 sizes. Then I deployed my solution and activated the feature. I realised it worked fine but not as expected. My new custom action was visible there but alongside default action item for In place record. So to remove the default action item, I deactivated site level feature named In Place Record Management feature. This is OOTB feature and required for In place record management.

If you select and item in a list, default In place record action item looks like this.

So that’s all really. My new custom action menu for In place record custom action look like this.

Isn’t this simple. I hope you would have enjoyed it.

Regards

Comments are closed.