Skip to main content

Posts

How to get all site users of SharePoint using REST API?

Get all users of SharePoint site using REST API: These users and its data are required to update people field of a SharePoint list. By using below snippet code we can able to get details of a user of SharePoint site.     var webURL = _spPageContextInfo.webAbsoluteUrl+"/_api/Web/SiteUsers";         $.ajax({           url: customFieldURL,           method: "GET",           headers: {             "Accept": "application/json; odata=verbose"           },           success: function (data) {            console.log(data);             data.d.results.forEach(function(cm){                     console.log(cm.Title+" - "+cm.Email+" - "+cm.Id);             });      ...

How to get data of more than one SharePoint list using REST API?

 Get data of more than one SharePoint list using REST API: By using below snippet code we can able to get data of two SharePoint list at time.  var getDataModule = (function () {       var baseRequest = {           url: "",           type: ""       };       var getApp = {       };       var getApp = {           receivedRequest: receivedRequest,       };       function receivedRequest(endpoint, _async) {           //var dfd = $.Deferred();           var request = baseRequest;           request.type = "GET";           request.async = false;           request.url = endpoint;           request.headers = {               'AC...

How to trigger a MS Flow Using Jquery/JavaScript?

Trigger a  MS Flow Using jQueryuery/JavaScript: To trigger an MS Flow first we need to create an workflow. Next we need to obtain its URL for triggering it. In below example, we are starting a workflow which is taking email address, email subject and email body as parameter and sending mail to email of related user. //This function triggers the microsoft flow  function beginMSFlow() {          var httpPostUrl = "obtain URL from MS flow";          var postData = {              emailadress:'raju@testdev.com', // Object keys must be similar as you used in the MS flow             emailSubject:'Testing Raju',              emailBody:'Hello User\n Welcome, You just trigger a MS Flow'             };           $.ajax({           url: httpPostUrl,    ...

Write a JavaScript Program to print given number of radio buttons

  JavaScript program to print given number of radio buttons: <html lang="en"> <head>     <meta charset="UTF-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>Write a code to print numbers of radio buttons in JavaScript</title> </head> <body>     <span id="output"></span> <br><br>     <label for="num1"><input type="radio" name="numbers" onclick="radioBtnClick(this)" id="num1" value="5">5</label>     <label for="num2"><input type="radio" name="numbers" onclick="radioBtnClick(this)" id="num2" value="10">10</label>     <label for="num3"><input type="radio" name="numbers" onclick="radioBtnClick(this)" id="num3" value=...

How create and object and add five key values pair to it in JavaScript?

 Create and object and add five key values pair to it in JavaScript: Developer can use below snippet create and add 5 key-value pairs in it. var obj = {};// an empty object has created for(var i = 1; i<=5; i++){ // A loop has added to add key- values in above object     obj['number'+i] = i; //here we are using Squire brackets [] to add keys & after assignment symbol values. here values are numbers } console.log(obj); Output :

How to remove the duplicate values from two arrays using JavaScript?

 Remove the duplicate values from two arrays using JavaScript: var array1 = [{id:1,name:'Raju',status:'0.Initial'},{id:2,name:'Santosh',status:'1.Capital'}] var idsToRemove = []; array1.forEach(function(dt){     idsToRemove.push(dt.id) }); var array2 =  [{id:1,name:'Raju',status:'0.Initial'},{id:2,name:'Santosh',status:'1.Capital'},{id:3,name:'Jhon',status:'2.Foundation'}] var leftData = []; array2.forEach(function(dt){     if(idsToRemove.indexOf(dt.id) == -1){         leftData.push(dt);     } });  console.log(leftData); Output : Hey user, Thank you for studying the blog Please  comment  if any error/ suggestions found for above data.

How to get next value from map based on dynamic key value in JavaScript?

 Get next value from map based on dynamic key value in JavaScript: The below mapData is a map/object contains place as key and an object (longitude & latitude) as value. We need to get the value, object of the map. The below snippet we can use to get the solutions for it. var mapData = {                  "Brandenburg Gate, Berlin": {latitude: 52.516272, longitude: 13.377722},                  "Dortmund U-Tower": {latitude: 51.515, longitude: 7.453619},                  "London Eye": {latitude: 51.503333, longitude: -0.119722},                  "Kremlin, Moscow": {latitude: 55.751667, longitude: 37.617778},                  "Eiffel Tower, Paris": {latitude: 48.8583, longitude: 2.2945},                  "Riksdag bu...