Hot answers tagged

9

Check out this excellent article where the performance of both is tested: Deep Dive – REST and CSOM Comparison I tested a series of pretty common operations in both REST and CSOM: Creating Lists (10) Creating List Items (100 per List, for a total of 1000) Reading List Items by ID Querying for List Items (retrieving 50 per List) Deleting List ...


4

FileRef should give you the document's relative URL. $select should look like $select=FileLeafRef,FileRef,Modified,CheckoutUserId,AuthorId,OData__UIVersionString FileRef vs FileLeafRef FileRef is for document's relative URL FileLeafRef is for document's name Modified Code url: appurl + "/_api/SP.AppContextSite(@target)/web/lists/getByTitle('" + ...


4

Actually haven't had my coffee jet and read your question like you needed help with MDS - if you wan't to enable MDS again (which you should do because it's actually awesome), below are some hints that will help you. Some troubleshooting help for your problem: Check your browsers console for errors Access the service via the URL directly (via browser ...


3

I think I got it. The ACCEPT header parameter "odata = verbose" makes all the difference. Using it returns the "d/results" path. Not using it returns "value" path. I understand that there is no need to add it any more with new specs. Further details here: https://blogs.office.com/2014/08/13/json-light-support-rest-sharepoint-api-released/ Edit: Also I ...


2

Login with the credentials of SharePoint tenancy and make sure your user is authenticated to do the operation. I prefer chrome to this operation and recommend to use "Advanced REST client" or Postman REST extension. Finally, make sure your request headers are used accordingly. 'Accept': 'application/json;odata=verbose', 'Content-Type': 'application/json;...


2

You can use following tools in Chrome. Advanced REST client Postman - REST Client shortcut _api JSON Viewer (Store APP) To view data as JSON set following header. PS: Don't forget to login into you site from Chrome.


2

SharePoint people or group column requires user's or group's Id to save into it. You can get current user's Id from _spPageContextInfo var userId = _spPageContextInfo.userId; Now let's say your people or group column name is Vendor. So in the request body it should look like: var data = { VendorId: userId }; More details is here.


2

It sounds like you need to be able to show your users a listing of all the tasks they have open, from a number of SharePoint lists. Use a Content Search Web Part for this. It enables you to grab all tasks from all lists in your environment and show them in a single web part. It will perform much better than your current approach. It also scales better (i.e,...


2

Make it a boolean. Tested it out on my end and this is what worked. sitecollection/_vti_bin/ListData.svc/TestList?$filter=IsNum eq true


2

To fetch data from sub-site based on country of logged in user, you can use: Content Query Web Part (create your own Content Type and query across sub-sites, requires either Publishing site or use the trick to create a Style Library on Top-Level site where you copy all XSLT) DataView web part with linked data sources (not so flexible or easy to modify for ...


2

Nice question, "Which one is faster CSOM or JSOM for CRUD operation?". But the fact to determine which API to be used for performing a certain operation in SharePoint depends on various factors like type of application, operating system, what kind of operation is to be performed in which system and so on. Based on the MSDN reference, I would say, go with ...


2

var url = _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists/getbytitle('Event')/items?$filter=Active eq 1$top=2"


2

For lookup columns, you have to use $expand. So the query URL should look like _api/web/lists/getbytitle('A')/items?$select=column1,column2&$filter=owner/LoginName eq 'i:0#.f|membership|username'&$expand=owner There are some special character in i:0#.f|membership|username, so you have to encode it before passing in query URL. encodeURI('i:0#.f|...


2

Yes it is possible through SPD 2013 workflow along with REST Webservice call. Follow the steps below, Create a list workflow for the list where Column1 is present Configure the workflow to get triggered on Item Adding and Item Edit Edit the workflow Build a dictionary with below parameters and set output variable as Request Header accept : application/...


2

You can add $limit in conjunction with orderby=ID desc to restrict no of returned users /_api/web/lists/GetByTitle('Event')/items?$filter=Active eq 1$limit=2$orderby=ID desc You can also use $top=2 /_api/web/lists/GetByTitle('Event')/items?$filter=Active eq 1$top=2


2

Look at your URL, it is created under the sites managed path,tenancy.sharepoint.com/sites/statistics So your REST call would be tenancy.sharepoint.com/sites/statistics/_api/search/query?querytext=%27focusing%27. tenancy.sharepoint.com/statistics isn't valid.


2

REST is only going to give the users results to what they have access to (I'm surprised the lookup column actually works as they currently don't have access to the data). If you don't give them permission, they won't see it. Set unique permissions on the list so everyone has read access, except for a group that will be responsible for maintaining the data. ...


2

The problem is with the $select query, $select query option is to specify which fields to return for a given list, list item, or other SharePoint object represented by an entity set. Your ProjectList will not have a field Site/Region/Title, that is the reason your are getting an error The query to field 'Site/Region' is not valid for the first URL. And as ...


1

There are lots of reasons mentioned in below article by which your query will not work & will not fetch the data from SharePoint List columns. One of the example given in below article is Well if you know SharePoint lists, you know you can change field display names, and many other things in List Settings. In the screen shot above, the “...


1

Taxonomy API is not supported via REST service but you could consider to create a term via JSOM API in SharePoint-hosted app as demonstrated below: var sp_files = [ 'SP.Runtime.js', 'SP.js', 'SP.Taxonomy.js' ]; var layoutsPath = _spPageContextInfo.webServerRelativeUrl + "/_layouts/15/"; $.getMultiScripts(sp_files, layoutsPath).done(function() ...


1

Liz, I was having similar issue but I followed this link http://summit7systems.com/who-needs-a-data-view-web-part-sharepoint-rest-and-datatables-net and it worked perfectly. Following is my code (see if it's helpful) <script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script> <link ...


1

You have to explicitly request for a JSON response (if the default response is XML) You need to give the server the RequestDigest (unique token) to prove you are who you are headers: { "accept": "application/json;odata=verbose", "X-RequestDigest": $("#__REQUESTDIGEST").val() }


1

You can get the specific file's version using REST call by below given code. // Get the file versions function getFileVersions() { var getfileurl = document.getElementById("getfileurl").value; var executor; // Initialize the RequestExecutor with the app web URL. executor = new SP.RequestExecutor(appweburl); ...


1

add a $select=myfield1,myfield2,etc onto your REST url. Note that once you add the $select parameter, only the fields you explicitly select will be returned. Without a $select parameter, all built-in fields are returned. See official doc on MSDN


1

Try below rest call This will get data from the current page location var getTitleURL = "/_api/web/lists/getbytitle('Products')/items? and this will var getTitleURL = "/subsitesites/_api/web/lists/getbytitle('Products')/items?


1

If it is SharePoint Online than you can use below code. "Property You want": { "__deferred": { "uri": "https://c986.sharepoint.com/_api/Web/Property You want" } SharePoint 2013 introduces a Representational State Transfer (REST) service that is comparable to the existing SharePoint client object models. This allows the developers to interact ...


1

Use this endpoint url to reset the permission, this will reset the permissions which means it will inherit the parent permission. url : <site URL>/_api/Web/Lists/GetByTitle('<list name>')/items('<item id>')/resetroleinheritance The above URL will reset the permission at the item level, you may implement the same for list or site level.


1

Similar to breakroleinheritance you can use resetroleinheritance endpoint https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.resetroleinheritance.aspx


1

There is no inconsistency. There might be a space somewhere that is breaking your HTTP request. Can you make sure that the ListName bit has no spaces in it? If you are using the Workflow Context: List Name, then this probably has spaces in it. If you have a list called "My List" this is how your calls should look like: MySite/_api/web/lists/GetByTitle('My ...


1

Your REST result is an Object (either JSON or XML) so if you display that using JavaScript it is displayed as [object Object] You have to convert the Object to a String JSON.stringify( yourRESTobject ) or display it in the F12 DEV console console.dir( yourRESTobject );



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