6 votes

REST API with HTTP in Sharepoint Online

I created a small example for you to use. This example forwards your request to the requested endpoint http://api.promasters.net.br/cotacao/v1/valores/ If you pass which resource you want to reach ...
user avatar
4 votes
Accepted

How to change view SharePoint (2010,2013) list REST API

The views can be created for a list with manual steps by going through the list settings. The same can be implemented programmatically using several methods. In this article, you will learn how it can ...
user avatar
  • 1,735
4 votes
Accepted

update sharepoint list using jQuery and ajax

How to update List Item via SharePoint REST interface function updateJson(endpointUri,payload, success, error) { $.ajax({ url: endpointUri, type: "POST", data: ...
user avatar
3 votes
Accepted

How to use SharePoint REST Api in an application that is hosted outside of SharePoint

Finally got it working. Below is the AJAX call to sharepoint. I am using the SharePoint 2013 server with AD authentication function readSPRestApi() { $.support.cors = true; ...
user avatar
3 votes
Accepted

REST: Update person field with email as input

For getting the ID based on the user's email address, you can try to query like below - https://<site>/_api/Web/lists/getbytitle('User Information List')/Items?$filter=EMail eq 'email id goes ...
user avatar
  • 1,008
3 votes
Accepted

Retrieve data.d.results after REST query

To extract data.d.results you can use for loop as the following: for (var i = 0; i < data.d.results.length; i++) { var item = data.d.results[i]; console.log(item.Title); ...
user avatar
3 votes
Accepted

How to call custom web part's method in Ajax call?

Instead of defining your WebMethod in WebPart, create an application page and define the WebMethod in that application page. Use the application page URL like /_layouts/YourSolution/ApplicationPage....
user avatar
3 votes
Accepted

SharePoint Framework jQuery REST POST returns 400 Bad Request error

Update Thanks to @wjervis for pointing out. To update list item using REST API, the endpoint would be as below: https://[site URL]/_api/web/lists/GetByTitle('List Title')/items(ID) where ID = ...
user avatar
  • 30.3k
3 votes
Accepted

CAML Query vs Odata Query string operators

A few benefits of REST ODATA queries: Much easier to write. Generally more readable and obvious to another developer. Might be a tiny bit faster, but probably not enough to notice. (The ODATA query ...
user avatar
3 votes
Accepted

403 on /_api/web/webs if I don't have access to 1 subsite out of many

/_api/web/webs only works for users who have manage web or above permissions on the site collection i.e you need to be either a site collection owner or Site collection admin for this endpoint to work....
user avatar
  • 30.3k
3 votes

Get value from Column and cut the duplicates using SharePoint Rest API

While Joe McShea is correct in that there is no direct "distinct" type of operation through the REST API, as I learned in the answer I accepted to a question I had over on S.O., you can get distinct ...
user avatar
  • 12.3k
2 votes
Accepted

jQuery Ajax calls failing with validation invalid or corrupted

The __REQUESTDIGEST hidden field is not available in the SharePoint Framework which is why your request is failing. Instead of trying to retrieve it from the page, you should retrieve it from ...
user avatar
2 votes

How to update Values in Sharepoint list using ajax

function CreateListItemWithDetails(listName, webUrl, newItemTitle, success, failure) { var itemType = GetItemTypeForListName(listName); var item = { "__metadata": { "type": itemType }, ...
user avatar
2 votes
Accepted

Error : "The 'Access-Control-Allow-Origin' header contains multiple values" while enabling CORS in SharePoint 2013

Finally got the answer to this For this we have to disable the "Request Management" service on the SharePoint server. Following are the steps to do it. Go to Central Admin-->Application Management--...
user avatar
2 votes
Accepted

Excel web part vs rest api

The images will be static, but that sounds like what you want. For SharePoint Online, you will have to use the Graph API instead. https://docs.microsoft.com/en-us/sharepoint/dev/general-development/...
user avatar
2 votes
Accepted

Execute ajax foreach element in array

I've only done this in SP 2013 on-prem. So there may be slight differences. First thing I notice is that in your array of recipients you've got both double and single quotes. So that probably isn't ...
user avatar
  • 2,929
2 votes
Accepted

Populate Specific items of the SharePoint Online List using Java webservice when a Drop-down column is selected while creating a new item

Option 1 :You can attach a JSLink to your fields and in that javascript you can write js code to call your Java webservice and auto populate other field value. below are few code samples available ...
user avatar
2 votes
Accepted

Context.ExecuteQueryAsync not trigerring

Ensure the item(file) is checked out before updating. You can print the error details using error handler as demonstrated below: $.ajax({ url: siteurl + "/_api/web/lists/getbytitle('" + ...
user avatar
  • 6,531
2 votes
Accepted

Attachment File using REST was failed to upload with the problem of SP.RequestExecutor.js

You have used SP.RequestExecutor which is used for making cross domain calls and if so your _spPageContextInfo.webServerRelativeUrl won't work. Either you need to use query string to get the url or ...
user avatar
  • 1,728
2 votes
Accepted

Is it posible to upload file in Lists Attachments in SharePoint in custom way

If you want to upload file to list attachment it has to be associated with list item. Change your url as below : var queryUrl = serverUrl+ "/_api/lists/GetByTitle('" + serverRelativeUrlToFolder + "')...
user avatar
2 votes
Accepted

SharePoint date field value using jQuery

The input value can be got with Jquery: var test=$("input[title='Date']").val(); And you could trace the value change for this date field control in the new form like this: <script src="https://...
user avatar
  • 2,503
2 votes
Accepted

How to change null value to empty using REST

You can use it as value.Department ? value.Department : "" which is a JS ternary operator. Basically it acts like an if condition as below: if(value.Department){ value.Department = value....
user avatar
  • 30.3k
2 votes
Accepted

Look Up value through REST without select or expand

You can use the RenderListDataAsStream endpoint to fetch lookup values without using select or expand. This works for User fields as well as Managed metadata columns as well. Try with the below ...
user avatar
  • 30.3k
2 votes

Get value from Column and cut the duplicates using SharePoint Rest API

No, SharePoint REST/OData has no equivalent select distinct. You can only achieve this by post-processing. Ref: How to get distinct values using Rest Api and bind to html dropdown
user avatar
  • 1,505
2 votes

Asking credential popup on sharepoint 2013 public facing site

Did you enable anonymous access for the list? To access the page anonymously, you need to make sure the list also could be accessed for anonymous users.
user avatar
  • 2,934
2 votes
Accepted

How to insert selected Checkboxes via Sharepoint 2016 API

While harshal's answer is on the right track, there is a problem in the code posted there (at least at the time of my writing this). But maybe it would help to understand a bit more what is going on. ...
user avatar
  • 12.3k
2 votes

running multiple ajax calls synchrnously in SharePoint rest api

Since you are using jQuery, you can use the jQuery Deferred object, which is similar to a regular javascript Promise, in order to control the execution flow of your multiple requests. What you need ...
user avatar
  • 12.3k
2 votes
Accepted

REST API: Send Auth only for the one request

You need a middle-tier or farm solution (WSP) to do this properly. You don't want to embed credentials into the script editor webpart, of course. What you can do is call an endpoint (middle tier) ...
user avatar
  • 28.9k
2 votes
Accepted

Rest api returns undefined

The REST API endpoint /items(<itemId>) returns the list item data in data.d and not in data.d.results. So, try changing your success function like this: success: function (data) { console....
user avatar
  • 29.5k
1 vote

Execute ajax foreach element in array

It should work by adding a ; between each emails: 'To': { 'results': arrEmailID.join("; ") }, For example : abc@abc.com; test@abc.com; ta@abc.com; tessss@abc.com If it doesn't work, then you can ...
user avatar
  • 1,149

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