Solved

Using the SharePoint 2010 Client Object Model with JavaScript/JQuery

Posted on 2010-09-15
4
1,119 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:Ted Bouskill
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:
Ted Bouskill 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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'…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

776 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