csom

SharePoint CSOM, retrieving site collections. Limited to 300?

余生颓废 提交于 2019-12-06 04:39:23
问题 I am trying to retrieve the site collections list from a SharePoint Online domain. I am using C# and client object model. The following code returns only 300 site collections. var tenant = new Tenant(ctx); spp = tenant.GetSiteProperties(0, true); ctx.Load(spp); ctx.ExecuteQuery(); Any idea on how to retrieve ALL site collections with CSOM ? Thanks 回答1: I found the answer to this question, the first parameter of the method GetSiteProperties is the index from which site collection retrieval

The proper way to write a SharePoint User to a User Field in a SharePoint list

安稳与你 提交于 2019-12-06 03:37:53
问题 I'm writing a user to a SharePoint list. I've read that the SharePoint User field has a string like this inside of it: userId;#userLoginName I've tried formatting in the same way when writing to a User field, for example when I write this string it works: 9;#i:0#.f|membership|ectropy@example.org But what is strange (to me at least) is that 9;# seems to work or even 9 . Even if I don't pass the userLoginName info at all, the loginId seems to be enough for it to recognize which User I'm talking

The remote server returned an error: (401) Unauthorized. Using CSOM in ASP.NET

為{幸葍}努か 提交于 2019-12-05 23:29:20
问题 I'm tried to pull some SharePoint 2013 list data I created which works fine when running locally on my machine and when run locally one the server. I'm user the same credentials when running both locally and locally on the server. The issue is when I publish and navigate to my ASP.NET app on the server I get the "The remote server returned an error: (401) Unauthorized." Error... I've looked at a bunch of the posts on stackoverflow and some other articles on the web This points out that the

Moving a SharePoint folder and contents to different location in same Document Library

谁都会走 提交于 2019-12-05 00:11:14
问题 I'm looking for a way to move a folder and all it's contents to a different location in the same library using the Client Object Model for SharePoint 2010 (C#). For example we have a folder for a project (say 12345) and it's URL is http://sharepoint/site/library/2012/12345 where 2012 represents a year. I'd like to programmatically move the 12345 folder to a different year, say 2014 which probably exists already but may not. I've searched around but the solutions I'm getting seem extremely

How to add a Web Part into a SitePages/Home.aspx using CSOM

大兔子大兔子 提交于 2019-12-04 11:36:54
has anyone managed to add a Web Part into a Wiki page using CSOM? Background: Home.aspx is a Wiki page and all its WPs are located in the rich text zone (in fact a "WikiField" column). Technically they are located in a hidden "wpz" web part zone and in addition to this there is always a placeholder with WP's ID in the WikiField column. I've modified the existing server-side code seen on http://blog.mastykarz.nl/programmatically-adding-web-parts-rich-content-sharepoint-2010/ and http://640kbisenough.com/2014/06/26/sharepoint-2013-moving-webparts-programmatically-to-rich-content-zone/ into this:

Change permissions of a SharePoint list using JavaScript

我的未来我决定 提交于 2019-12-04 10:56:01
I have an app that creates a list. I'd like the app to also set the list permissions to only allow admins to make changes to the list. I know how to hide the list, but I understand that this will not prevent clever users from typing in the URL of the list and modifying it anyway. I don't see a way of changing list permissions with JavaScript. The functions available to me for lists don't seem to allow for modification of permissions, but it's possible I overlooked the correct one(s). Any pointers on what functions I should be looking at? How to enable unique permissions for a List object via

SharePoint CSOM, retrieving site collections. Limited to 300?

对着背影说爱祢 提交于 2019-12-04 10:08:13
I am trying to retrieve the site collections list from a SharePoint Online domain. I am using C# and client object model. The following code returns only 300 site collections. var tenant = new Tenant(ctx); spp = tenant.GetSiteProperties(0, true); ctx.Load(spp); ctx.ExecuteQuery(); Any idea on how to retrieve ALL site collections with CSOM ? Thanks I found the answer to this question, the first parameter of the method GetSiteProperties is the index from which site collection retrieval starts. I tried the the following command spp = tenant.GetSiteProperties(300, true); which returned site

Creating Folders programmatically in SharePoint 2013

喜你入骨 提交于 2019-12-04 09:15:00
问题 Currently I have code that creates a Folder in the Documents directory when run: using (var context = new Microsoft.SharePoint.Client.ClientContext(sharePointSite)) { context.Credentials = new Microsoft.SharePoint.Client.SharePointOnlineCredentials(user, password); Web web = context.Web; Microsoft.SharePoint.Client.List docs = web.Lists.GetByTitle(<upper level folder>); docs.EnableFolderCreation = true; docs.RootFolder.Folders.Add(folderName); context.ExecuteQuery(); return true; } I am

The proper way to write a SharePoint User to a User Field in a SharePoint list

痴心易碎 提交于 2019-12-04 08:58:55
I'm writing a user to a SharePoint list. I've read that the SharePoint User field has a string like this inside of it: userId;#userLoginName I've tried formatting in the same way when writing to a User field, for example when I write this string it works: 9;#i:0#.f|membership|ectropy@example.org But what is strange (to me at least) is that 9;# seems to work or even 9 . Even if I don't pass the userLoginName info at all, the loginId seems to be enough for it to recognize which User I'm talking about. This seems to imply that when writing to the SharePoint User field, you only need the id, and

Check if a List Column Exists using SharePoint Client Object Model?

别来无恙 提交于 2019-12-04 04:45:11
Using the Client Object Model (C#) in SharePoint 2010, how can I determine if a specified column (field) name exists in a given List? Thanks, MagicAndi. Just found this while searching for the same thing, but it looks like Sharepoint 2010 has something built in for this, at least for the Server model: list.Fields.ContainsField("fieldName"); Not sure if it exists for Client side though. Figured it would be a good place to store this information however. Ashutosh Singh-MVP SharePoint Server Object Model string siteUrl = "http://mysite"; using (SPSite site = new SPSite(siteUrl)) { using (SPWeb