Solved

Using the SharePoint 2010 Client Object Model with JavaScript/JQuery

Posted on 2010-09-15
4
1,091 Views
Last Modified: 2012-05-10
How can I loop through an SPWebCollection (WebCollection) object in JQuery/Javascript using the SharePoint 2010 Client Object Model?

I have a collection of Webs, and I want to look at each of them to see if they have a certain property (a custom property that I set).  What is the easiest way to do this on the client side, without refreshing the page?
0
Comment
Question by:MSEC
  • 2
  • 2
4 Comments
 
LVL 51

Expert Comment

by:tedbilly
ID: 33695078
You cannot.  Access to the API is only available with managed code installed on the server.

You can use Sharepoint web services remotely to access site information but that is limited by the security permissions of the user and only reflects information available on the web UI.  It will not provide full access to the Sharepoint API.
0
 

Author Comment

by:MSEC
ID: 33695326
But I thought the whole point of the SharePoint Client Object Model was to expose the API to the client?
0
 
LVL 51

Accepted Solution

by:
tedbilly earned 500 total points
ID: 33696308
Not exactly.  Full JavaScript access from the client is VERY risky.

JavaScript isn't intended for full web UI development and customization because as an interpreted language on the client it is slow, insecure and can be altered easily by people without the best intentions.

So, if you want to use AJAX type technology from the client you have to expose the server side data yourself in a controlled manner.

Sharepoint 2010 uses REST services to simplify this work but once again there are limits to protect the security of the system.
0
 

Author Closing Comment

by:MSEC
ID: 33697336
Thanks.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now