Questions tagged [client-object-model]

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

1
vote
2answers
250 views

Using Object Model to Find Groups' Members Produces Frankentable

I modified the code here: How to get all users From Owners Group in SharePoint 2013 for a subsite to search for groups named "xxx Members" and their members. To the code, I added: function ...
4
votes
1answer
182 views

Is there a way to create a new list item with other user using Microsoft.SharePoint.Client namespace

We have a SharePoint list in which each user has permission to view only records created by him. I have a task to write a service that generates list items, list item must be created by another user ...
2
votes
1answer
441 views

Retrieve Followed sites of Office365 group team sites

i have below code to fetch the followed sites of my online and its working fine ..but when i am trying to retrieve the office365 group sites... this code doesn't return me those sites.. Any ...
0
votes
1answer
36 views

FieldLookupValue[] next assignment always replacing all previous positions - SharePoint Online

I have a ; separated string BusinessCategories. These values should be found as List Items in a custom list BusinessCategoryList, and I want to create a link to them in a multi value lookup field and ...
0
votes
0answers
70 views

Issue in adding multiple Managed Matadata fields

I am adding multiple managed matadata fields using CSOM. public static void createItem(){ // This is not working ListItem newListItem = existingList.AddItem(newItemInfo); string termguid1 ...
0
votes
2answers
158 views

executeQueryAsync not working in for loop

I have a function to start a workflow on multiple checked list items. It successfully identifies which items are selected and successfully starts the workflow, however it is only doing it on the last ...
1
vote
0answers
124 views

Custom Outlook form that saves data to SharePoint list

My requirement: A form with check-boxes, labels and buttons inside a outlook email that can take input from the recipient of the email and when submit button is hit should save data to SharePoint ...
0
votes
2answers
60 views

Can one install a C# program that uses `Microsoft.SharePoint.Client` into Sharepoint?

I wrote a C# Console Application that uses the Sharepoint ClientContext to access SharePoint. See https://gist.github.com/nddipiazza/d11423323e5febf8175a1c19e892ac9a for the example. I would like to ...
1
vote
1answer
66 views

Retrieve PDF file from Sharepoint 2010 using Context

Am struggling to get a pdf file from a Sharepoint 2010 site, I have managed to get a list of entries and found the file details. How do I now download the file? I got a root folder file downloaded ...
1
vote
1answer
89 views

How to determine if object is loaded or not?

It's very easy. Just share some pieces of advice with me. Example - I need to load a view of a list: var view = _list.Views.GetByTitle("title"); //but returned view always is not null if(view != ...
1
vote
1answer
53 views

How to change a url of the list's view via client model?

I know how to create a view via ViewCreationInformation class using client SP model. But how I can specify a url for this view ? Is it possible ? In other words: var test = _list.Views.GetByTitle("...
2
votes
2answers
2k views

CAML Query on SharePoint Online View

I have a very large library in a SharePoint Online environment: > 3000 (document sets) in the root folder and more than 7000 (document sets, folders and documents) in total. The system is mainly based ...
1
vote
1answer
158 views

Access denied while getting favorite sites from SharePoint Online using CSOM

I am trying to get favorite sites of a user from SharePoint Online using CSOM. I am creating a ClientContext first using an access token and then trying to get the favorite sites using below code: ...
0
votes
1answer
749 views

How can I get groups and users that has been assigned to Sharepoint List using Client Side Script

How can I get groups and users that has been assigned to Sharepoint List using Client Side Script. Please help me to on this
1
vote
2answers
298 views

Do I need to load SP.ClientContext More Than Once?

I have a script that begins as follows: SP.SOD.executeFunc('sp.js','SP.ClientContext',auditCheck); function auditCheck() { var clientContext = new SP.ClientContext(); var oList = clientContext....
0
votes
1answer
56 views

Receiving 500 internal server error while generating metadata

Receiving 500 internal server error while generating metadata for custom lists. When trying to access the service an internal server error is received. I have attached the screenshot of an error.
4
votes
1answer
473 views

Using `SP.ClientContext` vs REST APIs in JavaScript

We are currently building an application and we have to create/update/fetch items in SharePoint lists. We are currently using REST APIs for just about every functionality. But now we need to update ...
0
votes
2answers
182 views

CSOM ExecuteQuery Invalid file name while acquiring lists

I just started learning CSOM, I want to get all lists from specific site provided by user, and display them in WinForms app. Here is the code of acquiring lists: class ListCheckRepo : ...
0
votes
2answers
677 views

How to get Items from whole site collection using Content type?

I create multiple Lists using Content type in different sites.I want to get all Items from this Content type using Client context object(Caml Query) in C#.
2
votes
5answers
265 views

SP 2010: JSOM function not working on page load

I am running a function on page load to update list item. Here's my complete code - jQuery(document).ready(function(){ updatePageViewCount(); }); function updatePageViewCount() { var ...
1
vote
2answers
174 views

Is there a CSOM equivalent of SPFile.TakeOffline - Unpublish last Published Major version when there is a Draft version

I'm trying to unpublish the last published version of a file(Page) when there is a draft version of it. It is possible with OOTB UI. SPFile.TakeOffline (Server Object Model) method can be used to do ...
0
votes
1answer
348 views

Sharepoint C# Client app how to open documents edit mode

I am struggling the open documents on check out mode by using given path. I created a client on C# I solved authentication problems to accessing to sharepoint. But I don't know how to open documents ...
3
votes
0answers
77 views

SharePoint Online: Skip Property doesn't work with Order By in paging using CSOM

I am trying to fetch the contents of Document Library using paging. For this, I am skipping the resources using ListItemCollectionPosition and getting maximum resources using <RowLimit> in ...
1
vote
2answers
617 views

SharePoint Online: Get Document Library Children Count Using CSOM

My requirement is to get the children item count of Document Library using CSOM. The count should only be the immediate children count, and should not include the sub-children count. I am trying to ...
2
votes
0answers
294 views

sharepoint online authentication using javascript object model

I have a local html page which contains javascript code that uses client context. I can run the code in sharepoint environment but i want to run it in my local html page, which is restricted due to ...
2
votes
1answer
126 views

SharePoint 2013 online can I set other column values when uploading a file using REST?

The below Javascript works perfectly when i'm trying to upload a file to SharePoint 2013 online. However I have been looking unsuccessfully for a way to populate another column in the document library ...
1
vote
1answer
123 views

ClientContext From Azure hosted .Net Web Application

I have an Azure hosted .Net Web Application. I am trying to create the ClientContext to an On-Premise SharePoint 2013 site from my .Net Web Application using windows authentication. But it's failing. ...
0
votes
1answer
27 views

Client Object Model Question

I am working on a SharePoint site, and I want to parse the owner of the site from the API. I am currently using the following code: var credentials = new SharePointOnlineCredentials(userName, ...
0
votes
1answer
429 views

Hot to get list's title in current language?

Can anyone help me with getting data from sharepoint in foreign language ? Imagine, that I've alredy successfully loaded list by title like this: //listTitle = "Contacten" in Dutch var SpList = ...
3
votes
1answer
420 views

How to get the URL of the current page in CSOM

I have a SharePoint add-in that create a "button" on the page ribbon. When the user clicks on the button, it makes a call to a provider hosted app that resides in Azure. The request goes through, but ...
0
votes
0answers
253 views

Creating a custom List view & set Target audience for that List view web part using Client object model

I am working in a provider hosted app in O365 SP Online and I want to create a SP list view programatically. How do I do that? Edit:1 But the tricky part I have is apart from fields, I want to set ...
4
votes
0answers
681 views

How to specify additional CSOM properties to load in a PowerShell script?

In a PowerShell script, I'd like to retrieve the url of the content type hub tied to a site collection. My scripts muse use the CSOM. I tried : $Context = New-Object Microsoft.SharePoint.Client....
1
vote
0answers
16 views

How to Identify type of Recurrence Event like weakly,yearly or Daily?

Using Client context I want to get all Recurrence Event. I use var recurrenceData = oListItem["RecurrenceData"]; but it return <recurrence><rule><firstDayOfWeek>su</...
4
votes
1answer
559 views

How to get all Events from calendar List using Client Context?

Using Client context how to get all recursive Events... ClientContext clientContext = new ClientContext(siteUrl); clientContext.Credentials = cred; var oList = clientContext....
1
vote
1answer
76 views

SP2010: Count the number of times a page is opened

I've a page which uses query string. I want to find how many times the page is being opened. So, I thought of running a javascript function to update a list column (Page Views) every time the page ...
3
votes
2answers
87 views

Create a folder and add properties (field values) to it on form submission

I have created a simple form on SP site, on the submission of which a folder with entered name in the form would get created in the desired doc library.Library has some custom columns such as ...
1
vote
0answers
164 views

Update content link property of content editor webpart using CSOM

I am trying to set the content link property of content editor webpart using CSOM using the code below try { Microsoft.SharePoint.Client.File file = ctx.Web.GetFileByServerRelativeUrl("...
1
vote
0answers
92 views

Adding hyperlink to document to redirect on parent document set in the search view

Environment: SharePoint Online My scenario is based on a Document Library - Document Set - Document hierarchy. In this case my view is showing the documents without the parent document set (folder). ...
0
votes
1answer
42 views

Return elements of array to console sequentially (from getselectedItems method)

I want to return each element of an array object to the console. The code below does return the object, but not sequentially as I would like. When I select Daffy Duck and Bugs Bunny from a view as ...
0
votes
1answer
303 views

Move/copy documents from sub site level 2 site library to sub site level 1 site document library using Rest API in SharePoint online site

I need to move documents from child level sub site document library to parent site. I tried using rest api MoveTo/CopyTo methods. But these methods are working only when the target and source ...
2
votes
1answer
430 views

Attaching Files to SharePoint ListItem using JSOM - Undefined or moveTo fails

See code example below, when I run this code as is, it fails on the 'moveTo' call with error {Object doesn't support property or method 'moveTo'}... function ensureAttachmentFolder(listTitle,...
0
votes
2answers
619 views

Get additional column values from selected item in list view using Javascript\JQuery

I'm currently using JS (items[i].id;) to successfully get the id of selected items in a list view, however, I would like to pull column values from the selected row(s) like "Title" etc. if possible ...
0
votes
1answer
96 views

Please explain javascript function call in the below code snippet [closed]

I am not able to understand how getWebs() function is called (highlighted below). What is the flow of execution for the below snippet. This code snippet works. Please also mention what it is called in ...
0
votes
1answer
1k views

add user on a user lookup field CSOM - SharePoint 2013

I am trying to submit some data from a winform into a SharePoint list. Most of the items can submit fine except for the a field which is a user lookup field. I have done this in the past with a ...
1
vote
2answers
442 views

Retrieve list items with date query using client object model

I wrote this caml query to get the data. the query i wrote- <View> <Query> <Where> <And> <Eq> <FieldRef Name='AccNo' /> <Value Type='...
0
votes
1answer
234 views

Get count of items in a Grouped View using JavaScript

is there a way to get the count of items in a Grouped View via Javascript? The grouped view already has a count, but want to pass along that count to another object (a chart) and can't get past the ...
1
vote
1answer
153 views

I have a Approval workflow.I need to show pending workflows on the home page it should have people who need to approve

I need to create a Dashboard kind of thing on a page to display approval process status of a workflow for a document, who need to approve and what is need to be approved and due date and also link to ...
1
vote
1answer
362 views

Read mail and add values from mail body to SharePoint list

I have a requirement where I have d to read mail (in a prescribed format) from a folder in outlook inbox, separate the values and create a new item in SharePoint list and then move the mail to another ...
0
votes
1answer
323 views

Get all the lists on sub webs using javascript

I would like to know how to get subweb lists using CSOM. I actually know how to get lists on a web and how to get a sub web collection but I can't figure out how to get lists on sub web collection. ...
1
vote
3answers
3k views

Update multiple choice column values while creating new list item using CSOM

I have a requirement where I have to select the values of a choice field while creating a new item using CSOM. I'm able to update other fields, but for choice column, the value gets stored in the ...