Questions tagged [client-object-model]

API for interacting with SharePoint from .NET, Silverlight, and JavaScript.

This feature was introduced with SharePoint 2010.

The client-side object model (CSOM) provides client-side applications with access to a subset of the SharePoint Foundation server object model, including core objects such as site collections, sites, lists, and list items. As described in Data Access for Client Applications, the CSOM actually consists of three distinct APIs—the ECMAScript object model, the Silverlight client object model, and the .NET managed client object model—that target distinct client platforms. The ECMAScript object model and the Silverlight client object model provide a smaller subset of functionality. This is designed to enhance the user experience, because it minimize the time it takes Silverlight applications or JavaScript functions running in a Web page to load the files required for operation. The .NET managed client object model provides a larger subset of functionality for standalone client applications. However, these APIs provide a broadly similar developer experience and work in a similar wa

1832 questions
16
votes
2 answers

Pass parameters in ExecuteOrDelayuntilScriptLoaded in Javascript client Object model

I have written a javascript client-object model code and I am calling it through the below line code from content editor webpart: ExecuteOrDelayUntilScriptLoaded(getWebSiteData(sys), "sp.js");// throwing error But it is throwing javascript error in…
user9167
  • 335
  • 1
  • 4
  • 12
11
votes
1 answer

Manage links for shared files

I want to create a link using SharePoint CSOM API so anonymous user can read/edit file. I found the following workaround to get it via adding role assignment: var newRoleAssignment = new UserRoleAssignment() { Role = Role.Edit, UserId = userId…
user2017507
  • 111
  • 3
8
votes
3 answers

CSOM move the files one folder another folder

I have to all files from one folder another folder using CSOM and C# Thanks for your replay Huge Wood my code is below var targetSite = new Uri("https://hello.com//teams/Worldwide_Site"); string src = @"/teams/Worldwide_Site/Shared…
sriven
  • 109
  • 2
  • 3
  • 5
7
votes
4 answers

Is it possible to create site collection using CSOM?

I have been trying out to create site collection using CSOM but unable to fins and class which creates site collection. I have read in MSDN that CSOM runs as site collection scope hence creating site collection permission is not available. Sub-Site…
Rahul Barua
  • 329
  • 2
  • 7
  • 14
7
votes
4 answers

List of Sites and Subsites in the Given URL

How do I convert this into Client Object Model, please. I have no full SP installed on the Machine. I just need the list of sites and subsites in the Given URL.. public List GetAllSites(string spURL) { IList
Hari Gillala
  • 419
  • 2
  • 6
  • 17
7
votes
4 answers

How to use "SPContext.Current.Web.Url" in client object model?

When working with server side code we can use the following line to obtain the url of the current web site: var url = SPContext.Current.Web.Url; How can we do the same when working with the client object model?
Sakthi
  • 113
  • 2
  • 3
  • 8
7
votes
2 answers

SharePoint 2010 ClientObjectModel : Find Item by GUID

I have a list of 6000 listitem GUIDs. I need to check if each item still exist on the Web. Previously, I was using the SPWeb.GetFile(GUID) method to check the item. But now I need to convert that process usinig the ClientObjectModel. I cannot find a…
danbord
  • 309
  • 1
  • 3
  • 8
7
votes
1 answer

CSOM: How to get user groups specific to a site and not all the user groups in the site collection?

I am trying to get the list of user groups specific to a site (within a site collection) but the Web.SiteGroups is returning all the user groups at the site collection level, and therefore I am unable to determine which group has permissions to a…
Karthic
  • 71
  • 1
  • 2
7
votes
2 answers

Get all subsites and rootweb of a site collection using JSOM

I have used the following code from Most efficient way to get all sub sites under a site collection/sub site using JSOM? function getAllWebs(success,error) { var ctx = SP.ClientContext.get_current(); var web =…
Catmun
  • 81
  • 1
  • 3
6
votes
1 answer

Get Master Page Gallery via CSOM

How to get master page gallery via CSOM so that we would support language packs / we cannot use Lists.GetByTitle("Master Page Gallery"). So how to get list "_catalogs/masterpage"?
thomius
  • 2,808
  • 8
  • 35
  • 50
6
votes
3 answers

How to create List and libraries with CustomSchemaXml property using SchemaXml with CSOM in SharePoint online2010?

How to create List and libraries with CustomSchemaXml property using SchemaXml with CSOM in sharePoint online2010???? I am using following Code... // Create new list for restore List Item from List Schema XML ListCreationInformation…
6
votes
2 answers

SharePoint 2010 .NET Client Object Model - add item to Web property bag

I'm trying to add a new item to the Web property bag using the SharePoint managed client object model, but it fails to persist. I'm using the following code: using (var context = new ClientContext("http://projectdev:82/PWA")) { var web =…
iulianchira
  • 163
  • 1
  • 4
6
votes
1 answer

How to create a group in a subweb using CSOM?

I need to create a site with broken permission inheritance. Then I need to create a Members group with contribute access and add people to it. The following code adds the group to the site collection level, and it also adds the people, but my…
Luis Valencia
  • 5,201
  • 22
  • 118
  • 219
5
votes
1 answer

What would cause CSOM.GetSubWebsForCurrentUser to return Access Denied

When using the CSOM Microsoft.SharePoint.Client.Web.GetSubWebsForCurrentUser returns a 'security trimmed' collection of all sub webs that the current user has access to. e.g. string currentWeb = website.Title; // Just prove have access to root…
Ryan
  • 5,835
  • 8
  • 28
  • 54
5
votes
1 answer

Get ContentType Name in Client ObjectModel GetItems call

I'm using the SharePoint 2010 Managed Client Object Model to retrieve a list of listitems: string formattedDate = theDate.ToString("yyyy-MM-ddTHH:mm:ssZ"); CamlQuery absenceQuery = new CamlQuery(); absenceQuery.ViewXml…
RussGove
  • 1,254
  • 1
  • 17
  • 24
1
2 3
8 9