Questions tagged [client-object-model]

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

Filter by
Sorted by
Tagged with
4
votes
3answers
4k views

Add multiple people using Javascript Client Object Model to a Field of Type SPFieldUserValue

I want to update a UserField client side. I found the following code at this topic How to Use ECMA CSOM to Set a Field of Type SPFieldUserValue Tried the following code: var users = new Array(); ...
1
vote
1answer
86 views

How to get group by group name in JSOM SP2010?

How to get group object from group name something like this. var groupCollection = clientContext.get_web().get_siteGroups(); group = groupCollection.getByName("Group Name"); Above code will work in ...
2
votes
1answer
3k views

SPServices - GetRolesAndPermissionsForCurrentUser

I have a list where one group of users is not allowed to delete items but they have view and edit permissions. All items in the list contain an attachment. However, users are not allowed to delete the ...
0
votes
1answer
348 views

Page Layout and Site Template Settings - Properties using PowerShell

I have a requirement where I need to access the Site Templates and Page Layouts and the Default Page layout. I'm able to access all the properties using $web.AllProperties["__WebTemplates"] $web....
2
votes
0answers
285 views

Authenticate user in embedded iframe using session of current SharePoint user

I have an iframe with my web application embedded to a SharePoint page. I need to somehow authenticate him/her in this web app using Microsoft Azure AD without forcing him/her to enter login and ...
0
votes
1answer
25 views

SP 2010: Create list item in a different site which is in a different web app

Is it possible to create list items in a site which is in a different web application using JSOM?
0
votes
2answers
905 views

Conditionally hide a metadata field based on user's permission

I am working on an office 365 online SharePoint site collection. I have added a custom list inside my site collection. The site collection has the built-in group named "Owner", so is there a way ...
1
vote
0answers
178 views

Error when dowloading/reading the files from share point document libraries [closed]

The remote server returned an error: (400) Bad Request. at System.Net.HttpWebRequest.GetResponse() at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute() at Microsoft.SharePoint....
2
votes
4answers
19k views

update document properties in library using csom

in the code below I am uploading a document to a library. This part is fine but the problem is with setting the properties of that document. I have not been able to find an example that does that. I ...
3
votes
1answer
4k views

How to Retrieve the shared link of a file Programmatically

I am using C# to programmatically access files on our Office 365 SharePoint site using the Microsoft.Sharepoint.Client.dll. In one of our shared folders all the documents are Shared with anyone with a ...
2
votes
1answer
2k views

Read DOCX files using javascript in sharepoint 2013

Can we fetch contents of DOCX files uploaded in a doc library from javascript code ? I could easily read a TXT file ref : http://msdn.microsoft.com/en-us/library/office/jj163201(v=office.15).aspx . ...
4
votes
1answer
2k views

JSOM - ListItem from 'GetFileByRelativeUrl' returns System.ArgumentException

I'm trying to retrieve the corresponding ListItem from a page layout in the master page gallery using JSOM. I'm using the same approach that Vadim provides in this question, JSOM - get listitem by ...
1
vote
1answer
57 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("...
0
votes
1answer
1k views

What is the Best way to use angular with SharePoint

I'm trying to find the Best way to Build a SharePoint site(not an app) with Angular. I've multiple Content Editor webparts where I use the REST/JSOM to load content(Ex: Image Slider, List of Calendar ...
0
votes
1answer
69 views

Null value handle for sharepoint

I need to do null value handling for setting sharepoint list column. So, I am using ternary operator for same. I am using client object model(jQuery/sp.js) myVar == null ? "" : myVar In browser ...
3
votes
1answer
178 views

Where we should host remote event recievers? can they be hosted on any server exposed to the internet over it should be inside Azure?

I am in the process of migrating our SharePoint 2013 on-premises to Office 365. Now inside our SharePoint on-premises 2013 I have 7 event receivers which get fired when items are (created, creating, ...
7
votes
4answers
15k views

Javascript to display sharepoint list items on page load

With Client Object Model API and a bit of javascript, I want to retrieve the items of a sharepoint list and display them into the web page, when the web page loads. I've successfully implemented ...
1
vote
2answers
303 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 ...
3
votes
3answers
890 views

Object Doesn't support property or method '$1X'

I am using JSOM in Nintex Forms 2013. My script includes are /_layouts/15/sp.runtime.debug.js /_layouts/15/sp.debug.js /_layouts/1033/init.js /_layouts/MicrosoftAjax.js /_layouts/sp.core.js /_layouts/...
4
votes
0answers
800 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....
0
votes
0answers
88 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 ...
5
votes
3answers
4k views

Create a new wiki page using the 2013 Client Library

I'm using the SharePoint 2013 Client Library and am trying to generate new wiki articles. I'm able to connect, retrieve the web, find the list, but I can't add items. I feel like I need to be using ...
4
votes
1answer
246 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 ...
10
votes
4answers
3k views

SharePoint O365 upload big file via CSOM

I am tring to upload large files (900 MB) to SP Online (actually the OneDrive Business) but seems to follow SP style. Tried this via CSOM and powershell 70 MB are fine but when I try 900 MB a ...
2
votes
0answers
537 views

Get the Hierarchical Structure of Taxonomy Terms (for all TermSets) using SP.Taxonomy.js

I am trying to get all the terms from the termsets within a term group, maintaining the hierarchy using SP.Taxonomy.js (SP2013). Unfortunately, there seems to be no REST support for taxonomy in SP ...
2
votes
1answer
551 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
46 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 ...
1
vote
2answers
347 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....
8
votes
1answer
5k views

Differing ways to make executeQueryAsync calls - Function.createDelegate (is old IE8 code)

I want some understanding on two programming patterns I've seen and when to employ them. The question is about callbacks and delegate. In the first code there are two distinct functions, success ...
11
votes
6answers
67k views

How to get the login name of the current user using JavaScript?

I tried this code: var context = new SP.ClientContext.get_current(); this.website = context.get_web(); this.currentUser = website.get_currentUser(); alert(currentUser); But I got an ...
7
votes
4answers
25k views

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<String> ...
0
votes
2answers
75 views

how do i create a custom UI for a list column

What is the best way to create a custom feature to customize the UI of a list by filling in the column and/or field green when the value for row item = yes/no?
2
votes
1answer
559 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
2k views

Get current language via Client Object Model

I need to get the current display language of a web via Client Object Model (C#) from a provider-hosted App. The app runs inside a Client Web Part (IFrame). I am aware of this solution but think it is ...
6
votes
6answers
20k views

PowerShell and the client object model: “The collection has not been initialized”

I'm trying to grant a user permission to a SharePoint site using PowerShell and the client object model. The code I'm using is as follows: # Setup context $context=New-Object Microsoft.SharePoint....
1
vote
0answers
154 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 ...
20
votes
4answers
96k views

How to get a file using SharePoint Client Object Model with only an absolute url at hand?

We have a database with absolute (full) links to SharePoint files. If a user wants to download or get checkoutstatus information about the file, our program needs lookup that information in SharePoint....
0
votes
2answers
61 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
3answers
11k views

How to get Item name and extension from itemID and listID in javascript client object model

in my custom page i receive two parameters - a list ID of a list and an Item ID of an item inside said list. So i write this: function getfileName() { var clientContext = SP.ClientContext....
4
votes
1answer
2k views

Move a file across site collections with version history

I have the need to move a document using Client Object Model across site collections in SharePoint Online while retaining its metadata and version history. The sp.movecopyutil methods allows us to ...
6
votes
2answers
12k views

Attach file in CustomList Item using Sharepoint.Client object

Hi is there a way to attach file in specific Custom list item? Currently i tried to add files on the root folder using below code: using (ClientContext context = new ClientContext("http://...
3
votes
1answer
3k views

SharePoint 2013 - How to add an action to a Callout

I want to add a custom action on the default Callout for Document Libraries. The only instructions I could find on this subject show how to override the entire FooterTemplate on an existing Callout ...
1
vote
1answer
72 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 ...
6
votes
2answers
7k views

Proper way to call multiple functions using SP.SOD.executeFunc

I need to make sure sp.js is loaded before I call several functions. I currently call them as follows in SP 2013. It works, but I suspect there is a better/more efficient way. SP.SOD.executeFunc('...
5
votes
2answers
2k views

How can I read Secure Store Credentials using the Client Object Model?

I got an high trusted provider hosted application that use the App Only Policy. If I try to use server object model, sharepoint returns a context error. Is it possible to use the client object model ...
3
votes
2answers
2k views

Get a document thumbnail URL using client object model on SharePoint Online

I am working in a SharePoint online based environment and I need to fetch the thumbnail url for a document in a library programmatically, using the .Net client object model (not EcmaScript). Is that ...
8
votes
3answers
9k views

How to get file or list item icon in SharePoint 2013 using javascript

My requirement is i have to display files from document library with images using javascript object model or spservices. pls let me now is there a way.
1
vote
1answer
135 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
2answers
3k views

Detailed version history for a specific version label

How to perform 'View' operation for fetching all metadata values of the specific version using SharePoint client object model, for instance here version 7.1 I am working for Provider hosted app [...
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 ...