I work in a farm environment and i want to add a CustomAction in a specific SPList. The list is created programmatically, so i cannot know the ID. For that i tried to register the action with RegistrationId="{$ListId:Lists/MyList;}".




As i read and figure out, there is a bug in farm environment and i cannot register the action this way. I decided to add the action programmatically

SPUserCustomAction action = splist.UserCustomActions.Add();
action.Location = "CommandUI.Ribbon.ListView";
action.CommandUIExtension = @"
    <CommandUIExtension xmlns='http://schemas.microsoft.com/sharepoint/'>
            <CommandUIDefinition Location='Ribbon.ListItem.Actions.Controls._children'>



Now action is registered successfully but the problem is with the button label text. How it can be localized through code?


There is the property CommandUIExtensionResource in SPUserCustomAction, that i suppose i could use, but i cannot find any example. I have use TitleResource in SPList, but the same usage in this case does not work.


I have the same problem. It seems to be that there is no way to add programmatically a localizable custom action.

Declarative custom actions are localizable. But to target them to a specific list in a declarative way we need to make templates of the custom list. I did not found a way to build a template for external lists.

So it seems to be impossible to add localizable custom actions to a specific external list.

Just because RegistrationId="{$ListId:Lists/MyList;}" does not work in farm solutions.

Do you have solved your problem?

  • no unfortunately i haven't found a solution – pbaris Oct 8 '13 at 16:24
  • 1
    OK thank you! It is too bad that MS does not fix RegistrationId="{$ListId:Lists/MyList;}" for farm solutions. – Yavuz Oct 9 '13 at 8:43

you can use MS SPUtility class to read resource files:

string.Format("$Resources:{0}", resourceKey), 
"name of your resource file", 

Hope it helps,


  • 1
    If you are suggesting to localize the string to the current locale before creating the action, that would mean that the action will use a constant text. That also means that the action would not support MUI usage. – BlueSoul Apr 10 '13 at 12:56

You can also use GetGlobalResourceObject to get the localized string

HttpContext.GetGlobalResourceObject("name of your resource file", "resourceKey").ToString();
  • i think you didn't understand the question @Nizar – pbaris Aug 13 '13 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.