次の方法で共有


Using the SharePoint 2010 Managed Client Object Model

The SharePoint 2010 Client Object Model is a very cool feature of SharePoint 2010 Foundation Server that enables developers to write applications that access SharePoint data from a .NET application running on a client computer, from a Silverlight application, and from JavaScript running client-side in a SharePoint web part.  The client object model enables this without requiring the developer to write or install code on the SharePoint server.  The client object model makes it possible to build new categories of applications that integrate with Microsoft SharePoint Foundation 2010, including writing .NET applications, rich interactive web parts, and Silverlight applications.

This blog is inactive.
New blog: EricWhite.com/blog

Blog TOC

I've written an MSDN article, Using the SharePoint 2010 Managed Client Object Model, that provides the basics on using the Client Object Model.  Many thanks to Michael Cheng of the client object model team for technically reviewing the article, and providing me with many suggestions that improved it.

The article Using the SharePoint 2010 Client Object Model with the Open XML SDK 2.0 provides additional information around uploading and downloading files from a document library, as well as examples that modify Open XML documents using the Open XML SDK.

Comments

  • Anonymous
    December 15, 2009
    Very good, detailed and neat article.. Thanks Ashwin, I'm glad you like it. -Eric

  • Anonymous
    January 11, 2010
    Hi Eric, Very nice article. I'm running into a problem though with your very simple first example code.  I'm getting an (500) Internal Server Error when the call to ExecuteQuery runs.  I've looked through the server side logs, to no avail.  I've tried "googling" for any hint I could find, also to no avail. I've checked and double checked the DB permissions, and they seem correct.  Note for my testing purposes, I installed SP in "standalone" mode (using local admin acct to install everything). (500) is a pretty vague error.  Do you have hints on where I might start to ferret out the problem?  I've been at this the better part of the day and I'm out of ideas.  I admit I'm a complete SP newbie. Thanks, Cole Hi Cole, I don't have any idea about this. One thing to check - make sure that you are using the right client-side DLLs for the specific build of SP. -Eric

  • Anonymous
    January 11, 2010
    Hi Eric, Very nice article. Every byte has been explained in detail. Keep it up. Thanks! -Eric

  • Anonymous
    January 15, 2010
    The comment has been removed

  • Anonymous
    January 27, 2010
    Cool 1 :) keep up the gud work . . Thanks, I will! -Eric

  • Anonymous
    January 28, 2010
    Eric Its a avery good article. you article is one stop shop for Client Object Model Hi Vamsi, glad you like it. I'm very enthused about the client object model. I have more to write about it when I get time! -Eric

  • Anonymous
    February 23, 2010
    Eric Really nice article with most of the crucial info required to startup with client object model. However, do u know how to check whether a particular field title exists in a list or not. Thanks AD

  • Anonymous
    February 28, 2010
    Eric, i have following queries, can you please reply.

  1. How to check for null value of a variable which stores either a list ,library, field etc when we just assign its value from the ClientContext.Web
  2. How to check whether a list/library contains a particular field or not -Vamsi
  • Anonymous
    March 01, 2010
    Hello Eric,I have a Question, I am developing assembly free solutions using client object model and Ecma script,i have created a leave application using sharepoint designer which talks with the lists and server data using ecma script with client object model and Jquery,In that i have created a workflow using sharepoint designer,i.e is leave approvell workflow,there is a list "LeaveApplications".whenever a new item created or updated in this list a workflow get initiated which have some procedures to work through.i am saving this site as a template and later uploading the same solution to create another site using this template,the issue is my workflow is giving an error ,it gets initiated but not works,Can i make somehow my workflow to workflow..In an assemblly free way.??? Please reply : ankur@zevenseas.com

  • Anonymous
    March 02, 2010
    Hi Ankur, I checked with the dev team, here's what they said:


Looks like his workflow is not working after packaging. I think he might be using an Approval workflow and an Approval workflow when run on packaged site threw errors in older builds. This should work in the newer builds.

  1. The workarounds for him might be republishing the workflow  (or)
  2. Deleting the xsn forms and republishing the workflows -Eric
  • Anonymous
    March 02, 2010
    Thanks, i have allready tried with republishing it let me check one more time by deleting xsn forms. Regards, Ankur...

  • Anonymous
    March 02, 2010
    Vamsi, I have an answer for you... I am using sharepoint designer for my ecma script code,in the early phrase of my development i also used to get such creepy errors "this field doesnt exist in the list", So what i do these days : Actually in sharepoint we have two names associted for a field,one which we display and other which is used for retrieving values from it i.e static name. like if i use "End Date" as field name, but its static name will be "End_x200_Date"something. So thats why we usually get error,even if we have field there in list, So while debugging sometime i check with fieldvalues(); to get the field names. Or we can get the field static name by checking the source of the list page and also by looking into the "url" when click on that field in the list. I dont know what is the need for using two different names like this,and why not they have solved this field name spacing problem in sharepoint2010. regards, Ankur Madaan

  • Anonymous
    March 13, 2010
    Excellent post. I also have written some articles on SharePoint 2010. Check it here. http://praveenbattula.blogspot.com/search/label/SharePoint%202010

  • Anonymous
    March 24, 2010
    Hi Eric, i am trying to connect to a SharePoint over HTTPS(SSL). I am getting an error when I call ExecuteQuery(). I am using the RemoteCertificateValidationCallback to authorize the certificate. Please help.

  • Anonymous
    March 24, 2010
    Sorry, I didnt mention the error. "The remote server returned an error: (500) Internal Server Error". Thaks, Sanjay

  • Anonymous
    April 08, 2010
    thank you for the post - most helpful. Question: there seems to be a limit on the size of the queued transactions before a clientcontext.executequery() needs to be called. example: if you modify your code which adds 20 test rows (for the pagging sample) to say 1000 rows - the app will exception with a 400 bad request. I can reproduce this with my own program as well - i.e. try to insert 50 or so rather large list items. Unless I call executequery every few rows I always get a 400 error. this is very frustrating as it's impossible to know how much data one needs to upload to a list and hence makes the 'batching' a guess work. have you come across this? the best I've found is something with the msg size for a web request but have not found anything indicating where this can be changed in clientcontext. As is, I'm left with a very slow insert program which does an executequery at every row. much appreciated

  • Anonymous
    March 02, 2011
    There no code sample for all the classes such list, site, web, listitem and so on .. plz update the code sample. all the comments are useless which is here right below....

  • Anonymous
    March 04, 2011
    Why was there no VB code listed in the atrticle? Is it not supported? Thanks

  • Anonymous
    March 09, 2011
    The comment has been removed

  • Anonymous
    May 11, 2011
    Hi... Will this sharepoint client object model using javascript (ECMA Script) works when a normal read only user visits the site? currently i am not able to use it for a normal reader user on the site. please help me. thanks raj

  • Anonymous
    June 02, 2011
    Thanks for the blog. Can I access Sharepoint Online 2010 / Office 365 using the Managed client object model? If not, can you point me on to how to do so?

  • Anonymous
    June 20, 2012
    hi, i have installed sharepoint server 2010, and i wonna know how can install it in client side. please help