SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to access some configuration data stored in the property bag. I want to access this information from a elements.xml file. This elements.xml file contains a Ribbon with Tabs and Buttons. Is there a way to do this? Or a way to access a static public string from an elements.xml file?

The Ribbon and its child controls are all inside a element.

share|improve this question
up vote 2 down vote accepted

Not in then xml, but when you create ribbon buttons you specify javascript to execute when clicked.

You then have two options:

  1. Use Client Object Model in this javascript to retrieve the property and do the navigation
  2. Navigate to a trampolin page which reads the property and redirects
share|improve this answer

As far as I'm aware, there's no way to access the object model in that way from a static XML file. You'd need code to pull the property you're referring to.

share|improve this answer
I can pull the property via code, and store it in a public string. Is there anyway to access that string from the xml file? – Meyer Denney May 25 '12 at 2:05
XML is markup... it can't pull dynamic values. – webdes03 May 25 '12 at 2:23
What if it was a public static string that was setup on PreLoad or something like that? Before the control got rendered the string would already be populated with the correct property value. – Meyer Denney May 25 '12 at 2:26
There's no such thing as a variable or a placeholder for the XML. Short of having something else generate the entire elements.xml file, I don't believe what you're doing is possible. Even considering that the elements.xml file is a static file stored within the solution and 14 hive, I'm not sure how you'd accomplish this. What are you trying to do? – webdes03 May 25 '12 at 2:28
I had part of a url stored in the property bag. I also have a ribbon with buttons. When a user clicks one of the buttons, it is supposed to go to a certain url stored in the property bag. I have the buttons declared through xml rather than code behind. I would like to set the buttons commanduihandler to the url stored in the property bag. – Meyer Denney May 25 '12 at 2:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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