7

It it possible to access the Web application/Farm level property bag using jQuery/Javscript/ClientContext? If not, then what are the possible alternatives to access Web Application Farm level property bags using jQuery/Javascript

I will appreciate the code example.

Geek
  • 545
  • 1
  • 13
  • 29
  • hard to give you code without knowing what you want to do. Simply pushing property bag values to a web service is probably not a good idea (it can expose sensitive data). – Steve B Jun 18 '12 at 12:19
  • I want to get only the property value from a Web Application using client script. Security is not important for me. – Geek Jun 18 '12 at 12:21
  • I would appreciate any code example of retrieving the Web Application level property using the web service. – Geek Jun 18 '12 at 12:22
  • Still unclear about your goal. If you want to access a specific set of items in the bag will lead to a different kind of answer that if you want to return all items in the bag. In the former case, I would create a custom DTO class with your very specific data and a custom wcf service to return this data. In the later, if you are ok with the security and privacy impact, I would create a simple OData like service that wrap the property bag. – Steve B Jun 18 '12 at 12:36
  • Steve, thank you for your concern. I just to want to access key/value pair in my javascript. – Geek Jun 18 '12 at 13:57

4 Answers4

4

If you are going to get the property bags of your web application or farm OFTEN, you could create a custom HttpHandler to create a dynamic javascript file which will load the properties you want. See my blog post about how to create an httphandler. The idea is partly inspired from loading _spPageContextInfo If you think it is the way to go, I can tell more.

EDIT: I found this question very interesting and I created a simple solution which registers a httphandler. When you add this as script in your site you'll get all web properties. The http handler can be altered to suit different purposes. Details are on my blog.

Anatoly Mironov
  • 5,750
  • 2
  • 29
  • 56
  • 1 I think it could be a good start as long as I will be available to acheive my goal. Please go ahead I'm open to your suggestion
  • – Geek Jun 18 '12 at 13:54
  • I would appreciate the implementation with an example. – Geek Jun 18 '12 at 14:00
  • I'll try to find some time as soon as possible :) – Anatoly Mironov Jun 18 '12 at 15:14
  • Ok, I will test and get back to you. – Geek Jun 21 '12 at 17:06