2

I want to create a sharepoint 2013 app with asp.net mvc http://blogs.msdn.com/b/bspann/archive/2013/01/19/asp-net-mvc-based-apps-for-sharepoint-2013-on-premises.aspx

The thing is we want to rely on the knowledge of our asp.net developers, and with one sharepoint developer help to help in the integration process.

We dont want to rely on web.config for connectionstrings, but instead on the property bag. The question is from the sharepoint app, is it possible to read a value in the SPFarm object property bag? and how?

1
  • Nope, you will never be able to read the SPFarm object from an app. Maybe the site in which the app is installed... – James Love Jun 4 '13 at 8:07
4

Maybe not the SPFarm property bag, but potentially the app web's property bag, using JavaScript Client Object Model: http://e-junkie-chronicles.blogspot.co.uk/2011/10/making-use-of-property-bag-in.html

function getWebProperty() {
    var ctx = new SP.ClientContext.get_current();
    var web = ctx.get_site().get_rootWeb();
    this.props =  web.get_allProperties();
    this.props.set_item(“aProperty”, “aValue”);
    ctx.load(web);

    ctx.executeQueryAsync(Function.createDelegate(this, gotProperty), Function.createDelegate(this, failedGettingProperty));
}

function gotProperty() {
    alert(this.props.get_item(“aProperty”));
}

function failedGettingProperty() {
    alert("failed");
}
1
  • I am going to create an asp.net mvc application, therefore I will need to pass the querystring in server side to the data access layer. I guess I can use the Sharepoint Client Api instead of javascript. – Luis Valencia Jun 4 '13 at 21:06

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.