Solved

Using the SharePoint 2010 Client Object Model with JavaScript/JQuery

Posted on 2010-09-15
4
1,104 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Animated .jpg? 13 57
what is the difference between currentTarget and target 4 34
sharepoint online 3 32
Enter key on html form page 11 44
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
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…

930 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

12 Experts available now in Live!

Get 1:1 Help Now