sharepoint-clientobject

SharePoint 2010 Client Object Model + set the value of a multiple lookup field with Javascript

六眼飞鱼酱① 提交于 2019-12-13 06:16:25
问题 I'm trying to update a list item with the SharePoint 2010 Client Object Model and Javascript. The item I am trying to update has a Multiple Value Lookup field. I can successfully set this field, but only with one value. Does anyone know how to set it with multiple values? var _newLookupField = new SP.FieldLookupValue(); _newLookupField.set_lookupId(itemArray.toString()); //this works if array is only 1 item currentItem.set_item('Lookup_x0020_Field', _newLookupField); 回答1: var lookupsIds = [1

SharePoint Server Authentication Error

岁酱吖の 提交于 2019-12-13 05:16:40
问题 So I was working with a hosted SharePoint site before and everything was working fine when I authenticated to that site using the code below: private static NetworkCredential credentials = new NetworkCredential(username, password, domain); private static ClientContext clientContext = new ClientContext("https://thisonesite.com/hosting/151"); private static Web site = clientContext.Web; private static List list = site.Lists.GetByTitle(listName); private static void sharepointLogin() { try { /

How to read a column type SPUser, DateTime, Currency with EcmaScript?

岁酱吖の 提交于 2019-12-12 09:23:51
问题 I have a list in SharePoint 2010 with some columns. All are default types. So I have "Single line of text" "Multiple line of text" "Date and Time" "Choice" "Number" "Currency" "Person or Group" My aim is to have a custom ribbon tab or group where I can perform some action on this list. As a starting point I created an Empty Element in my Visual Studio solution and put inside Elements.xml my buttons. This works so far. I also figured out how to do a postback to react on pressed button. This

SharePoint.Client Get all folders recursively

心已入冬 提交于 2019-12-12 09:01:38
问题 I would like to call clientContext.ExecuteQuery() once for a site to improve performance. The collections of things I want to load includes all the folders and files for all document libraries within the site. When I say ALL I really do mean ALL. i.e. If there are folders within folders, within folders, I want them all in one go. Is this possible or do I have to stick with recursively loading each child folder and loading it's folders and files explicitly. What I have right now which gets the

Sharepoint Online: Copy attachment of list item to a new item using Client object model

末鹿安然 提交于 2019-12-12 02:54:22
问题 I want to read the attachments from one list item (in ItemCreated event) to another, new ListItem. How can I do this with the Client Object Model ? All I found is server-side code... Another question: Are the attachments also deleted when I delete a list item or are they still existing on the server? 回答1: I got it! The following code worked for me: private static void NewTryToAttachFiles(ClientContext ctx, Web web, List fromList, ListItem fromItem, List toList, ListItem toItem) { string src =

cannot find the SPSite name space

半城伤御伤魂 提交于 2019-12-10 21:32:13
问题 I am unable to find the name space for the SPSite I have imported these so far: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using Microsoft.SharePoint; using System.Collections; using Microsoft.SharePoint.Client; using Microsoft.SharePoint; using System.Data.SqlClient; using SP = Microsoft.SharePoint.Client; using System.Data; namespace GrandPermission { class Program { static void Main(string[] args) { SPSite oSPSite = new SPSite(

client object model add content type to list

血红的双手。 提交于 2019-12-10 11:23:07
问题 I have created an SP.List item "lst". I also: lst.ContentTypesEnabled = true; lst.Update(); clientContext.ExecuteQuery(); I have searched the AvailableContentTypes and found the one I want to add to lst. I then: SP.ContentTypeCollection lstTypeCollection = lst.ContentTypes; ... now I'm stuck. the lstTypeCollection.Add() wants a ContentTypeCreationInformation object at that point I'm wandering in the dark. Can you shed light? Thanks in Advance :-) 回答1: Use ContentTypeCollection

Access SharePoint online using client object model- Forbidden error

雨燕双飞 提交于 2019-12-08 09:14:27
问题 I tried to Create a new list item using client object model. I have created an asp.net application to do the task. It works if I pass the URL of SharePoint server which is installed in my machine. But if I give my SharePoint online URL it is not working as below code shows. I get "The remote server returned an error: (403) Forbidden. " error. Any idea? ClientContext context = new ClientContext("https://xxx.sharepoint.com/SitePages/"); List announcementsList = context.Web.Lists.GetByTitle(

Is there a way to get Folder object from ListItem one?

久未见 提交于 2019-12-07 13:11:11
问题 I'm trying to get Folder object by its path in SharePoint 2010 client application using Client Side Object Model (.Net 4.0). I need to check whether folder described by 'folderPath' variable exists in the library and then get the Folder object for further operations. To enhance performance, I chose to use CAML query to filter the list. My code: IEnumerable<List> library = this.clientContext.LoadQuery( this.clientContext.Web.Lists.Where(p => p.Title == this.documentLibrary)); this

Is there a way to get Folder object from ListItem one?

僤鯓⒐⒋嵵緔 提交于 2019-12-05 21:50:59
I'm trying to get Folder object by its path in SharePoint 2010 client application using Client Side Object Model (.Net 4.0). I need to check whether folder described by 'folderPath' variable exists in the library and then get the Folder object for further operations. To enhance performance, I chose to use CAML query to filter the list. My code: IEnumerable<List> library = this.clientContext.LoadQuery( this.clientContext.Web.Lists.Where(p => p.Title == this.documentLibrary)); this.clientContext.ExecuteQuery(); List libraryList = library.FirstOrDefault(); //code to handle libraryList == null