Skip to main content
8 votes

Invoke Asset Picker from JSOM

Yes you can. I've written a wrapper utility for working with the SharePoint AssetURLSelector (or Asset Picker) that wraps the whole thing up in a nice Promise based API. Here's the essence of what you ...
Thomas's user avatar
  • 980
7 votes

Check if user is in a specified group

This code worked for me, its simple and does the job var url = _spPageContextInfo.webAbsoluteUrl +'/_api/web/currentuser/groups' $.getJSON(url, function (data) { $.each(data.value, ...
Ahmed Masud's user avatar
7 votes

How to get only the document libraries from a sharePoint site using SharePoint Client Object Model?

This is better as it only pulls back the document libraries rather than all the lists which you then have to check in a loop. var Libraries = clientContext.LoadQuery(clientContext.Web.Lists.Where(l =...
Colin Gardner's user avatar
6 votes
Accepted

what happens with items/lists when the creating user is deleted?

Nothing happens with the list or the item, but when a user clicks on the author name (usr1) she won't see the removed users profile page. Unless items have unique permissions only accessible by usr1, ...
Benny Skogberg's user avatar
  • 25.5k
5 votes

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

It shows [object object] in your alert message because you are trying to display an object instead of its properties. [Object object] is the default serialization of an object in JavaScript. You can ...
Prasad De Silva's user avatar
5 votes

Check if user is in a specified group

Function: function isCurrentUserMemberOfGroup(groupName) { var userIsInGroup = false; $.ajax({ async: false, headers: { "accept": "application/json; odata=verbose" }, ...
Sergey's user avatar
  • 51
5 votes

How to check if the file or folder exist in SharePoint document library using client object model?

I've seen many references to file.Exists not working in CSOM but the problem is typically caused by trying to do context.Load(file). If the file doesn't exist you can't load the file so the test ...
Martin D's user avatar
  • 141
5 votes

Cannot Query Document Library with > 5K folders

In SharePoint Online, your only choice is to use REST. CSOM will not work. You call the REST endpoint and it will return a batch of 100 or 200 items, and if more exist, will return a paged link to ...
Eric Alexander's user avatar
5 votes
Accepted

CSOM C# Copy Library from one Site Collection to another with all folders / subfolders intact

Install the SharePoint 2019 CSOM library using the NuGet below. Install-Package Microsoft.SharePoint2019.CSOM -Version 16.0.10337.12109 Then use the methods of MoveCopyUtil class to copy/move ...
LZ_MSFT's user avatar
  • 6,219
4 votes

CSOM OpenBinaryDirect generates 401 error on office 365

I had the same issue and solved this the following way: You do not need to use "OpenBinaryDirect()" but simply OpenBinary(), which does not require an url and does not return a stream directly, but a ...
Ole Albers's user avatar
4 votes

how to call executeQueryAsync() to behave synchronously?

@NadeemYousuf: As you probably know, both callbacks and promises are only techniques to make a code that relies on asynchronous calls more readable by hiding the asynchronicity via advanced ...
pholpar's user avatar
  • 3,190
4 votes

Load all fields for a specific ListItem using CSOM

None of the existing answers worked for me. This does: CamlQuery camlQuery = new CamlQuery(); camlQuery.ViewXml = string.Format("<View Scope=\"RecursiveAll\"><Query><Where><Eq&...
Nicholas DiPiazza's user avatar
4 votes

How to check if the file or folder exist in SharePoint document library using client object model?

Checking by ServerErrorCode. Msdn link //https://msdn.microsoft.com/en-us/library/dd930252%28v=office.12%29.aspx?f=255&MSPPError=-2147217396 private const int ...
isxaker's user avatar
  • 313
4 votes

How to check if the file or folder exist in SharePoint document library using client object model?

Folder exists: FolderCollection folders = list.RootFolder.Folders; ctx.Load(folders, fl => fl.Include(ct => ct.Name) .Where(ct => ct.Name == "MyFolder")); ctx.ExecuteQuery(); return ...
Rune's user avatar
  • 249
4 votes
Accepted

Get all property of Group using CSOM

I tried your code and got an unknown error. So i tried removing each field in the LINQ query and I found the error is due to grup => grup.Owner. I have changed it to grup => grup.OwnerTitle and ...
Nagarajan Muthukumar's user avatar
4 votes
Accepted

How to Check Out Document Remotely

I guess you are close to the right point. In your first code-snippet you didn't provide a server-relative url for GetFileByServerRelativeUrl() (the "/MySite" part is missing). In your second snippet ...
Christian Berger's user avatar
4 votes

How to Check Out Document Remotely

If I am not wrong then I guess MySite in your url means /sites/yoursitename/. If its not like this then you must use. So your line will be var file = cc.Web.GetFileByServerRelativeUrl("/sites/MySite/...
Aakash Maurya's user avatar
4 votes
Accepted

Get User object from Person or Group field value using JSOM/JavaScript API

You can use a code like this: Below example uses JSOM SP.SOD.executeFunc("sp.js", "SP.ClientContext", function(){ SP.SOD.registerSod("sp.userprofiles.js", SP.Utilities.Utility....
Gautam Sheth's user avatar
  • 30.9k
4 votes
Accepted

Alternative to using (Event Receivers & Server-side object model) when working with Office 365 sharepoint

You have two options for this type of event handling when developing for SharePoint Online: Remote Events Receivers and WebHooks. Remote Event Receivers are similar to Server-Side Event Receivers but ...
Rob Windsor's user avatar
  • 12.7k
4 votes

How to use the FedAuth cookie in 'ClientContext'

For that purpose I would strongly recommend you to use PnP AuthenticationManager class, which already contains methods for obtaining ClientContext with different authentication mechanism. For example ...
Sergei Sergeev's user avatar
4 votes

Retrieve Followed sites of Office365 group team sites

This is currently not possible using OOTB SharePoint REST/JSOM APIs. However, you can make use of the undocumented REST API endpoint /_vti_bin/homeapi.ashx/sites/followed?mostRecentFirst=true&...
Gautam Sheth's user avatar
  • 30.9k
3 votes

CSOM / Webservice multilingual provisioning site columns, lists,

This is an old post. Just leaving this here for anyone to find. Extension method tricks SharePoint to believe you are accessing in the specified language. Tested and working in SP2013 and SPO. ...
tashunko's user avatar
3 votes

How do I know if the page is in Edit Mode from JavaScript?

I just use this handy javascript function... function IsDesignMode() { var inDesign = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode; if (inDesign != null && inDesign....
David Wayne Rasmussen's user avatar
3 votes

Is it possible to create site collection using CSOM?

I know you asked for CSOM, but in case it helps anyone, I was able to do this in PowerShell using the CreateSite method of the Admin web service against on-prem SP2013. You can call DeleteSite ...
Kirk Liemohn's user avatar
  • 1,423
3 votes

Get current user in Client Object Model with javascript?

'SP.ClientContext.get_current' is null or not an object You are trying to access 'SP.ClientContext' while libraries are being loaded. So use this line of code to wait until the library is loaded. ...
Prasad De Silva's user avatar
3 votes

Provisioning fields and content types through JSOM

Came on this old post with no good answer so decided to add my solution: var currSite = "/"; var ctId = "0x01002F31FB62E029B146B5D9CF65E832561B";//you should get this yourself, see below var ...
Chris DS's user avatar
3 votes

Proper way to check if Web.Title is available (CSOM)?

Since C# 6.0, you can use nameof in order to avoid the extra work that comes with Reflection. The nameof(property) reference is converted to a string during compilation. if (!site....
Dinerdo's user avatar
  • 769
3 votes

How to use Microsoft.SharePoint.Client.File.SaveBinary method?

Save document library file to local file system using CSOM. using (var clientContext = new ClientContext(url)) { var list = clientContext.Web.Lists.GetByTitle(listTitle); var listItem = ...
Divya Sharma's user avatar
  • 1,461
3 votes

Add Webpart to a Page using only Javascript?

Here are the steps you should execute Get the XML for webpart Load Limited Webpart Manager object Add web part. You can find details on https://msdn.microsoft.com/en-us/library/office/hh185010(v=...
Amal Hashim's user avatar
  • 28.3k
3 votes
Accepted

"The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column."

Finally i got solution. I replaced [Approval_x0020_Date] with [Approval Date]. i.e with display name. Thanks Submits
Anil Pal's user avatar
  • 1,079

Only top scored, non community-wiki answers of a minimum length are eligible