0

i have a concern about which is better option to fetch list items from sharepoint 2010 list in javascript

there are 2 available options

1) sharepoint 2010 client object model

http://msdn.microsoft.com/en-us/library/hh185011.aspx

2) jquery spservices

http://spservices.codeplex.com/documentation

but i am not able to understand which one is better is option in terms of safety,security & stability / low maintenance

and also i have a doubt with sharepoint2010 JSOM is that it has a method

var oList = clientContext.get_web().get_lists().getByTitle('Announcements');

but does not have any method for getListByUrl

Is getListByTitle is safe to use (as in sharepoint Object Model it is generally preferred to use GetListByUrl instead of GetListByTitle)?

please share your experience

thanks

Ishaan Puniani
  • 646
  • 2
  • 10
  • 23

2 Answers2

0

Both frameworks are sitting on top of SharePoint's business logic, so safety, security and stability are given.

As mentioned by Nico, there are several tasks you can't do with the CSOM. In common, you've to use SharePoint WebServices in order to attach files for example, SPServices offers you a JS wrapper around SharePoint's OOB WebServices. So it's easier to include in your existing JS code.

By using SPServices you don't have to care about all the Request, Response plumbing, it's all done by SPServices.

In most of our projects we're mixing CSOM and SPServices in order to get all the things done. Marc (the author of SPServices) has also a great documentation on SPService's capabilities on Codeplex (see http://spservices.codeplex.com/documentation)

Thorsten Hans
  • 2,675
  • 19
  • 21
0

I usually use JavaScript object model when I can, because it's provided by Microsoft. So it is supported, and supposed to be more tested and stable. It's also more viable in the long term compare to old school .asmx webservices used by SPServices.

However, for some functionality not available in JavaScript OM, SPServices is a good choice.

About GetListByTitle, it's usually safe and effective, especially for your own list. However, there is a catch for SharePoint list because title may not be the same depending on your web language ('Announcements' in EN, 'Annonces' in FR).
Depending on what you want to do you can use GetFolderByUrl, or loop all lists and check url, etc..

Nico
  • 13,320
  • 6
  • 32
  • 33