Articles about European Sharepoint Hosting Service
SharePoint 2013 Hosting Spain – HostForLIFE.eu :: How to Retrieve All The Users Following using REST in SharePoint 2013?
In this post, let me show you How to Retrieve All The users following the current user using REST in SharePoint 2013. This article helps to retrieve all the users following the current user using REST in SharePoint 2013. this is often developed using the NAPA development tool.
Step 1: On your Developer website, open the “Napa” office 365 Development Tools and so select Add New Project.
- Select the App for SharePoint template, name the project and so click the create button.
- Replace Default.aspx with the following code.
- Replace APP.js with the following source code.
- Publish Your App.
Step 2: Now, you must Change the permission:
Tenant = Write
User Profiles = Read
Step 3: Update the Default.aspx and App.js files
Default Aspx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
'use strict'; var hostweburl; var appweburl; var myFollowerEndpoint; var followers; $(document).ready(function(){ hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl")); appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl")) myFollowerEndpoint = decodeURIComponent(appweburl) + "/_api/social.following"; getMyFollowers(); }); function getQueryStringParameter(paramToRetrieve) { var params = document.URL.split("?")[1].split("&"); for (var i=0; i<params.length; i= i + 1) { var singleParam = params[i].split("="); if(singleParam[0] == paramToRetrieve) return singleParam[1]; } } function getMyFollowers() { $.ajax( { url: myFollowerEndpoint + "/my/followers", headers: { "accept": "application/json;odata=verbose" }, success: myFollowersSuccessHandler, error: myFollowersErrorHandler }); } function myFollowersSuccessHandler(data) { var stringData = JSON.stringify(data); var jsonObject = JSON.parse(stringData); var folResult = jsonObject.d.Followers.results; followers = "<p>The Person who follows you are:</p>"; for (var i=0; i<folResult.length; i++) { followers+= "<P>"+folResult[i].Name+"</p>"; } document.getElementById("myFollowersResult").innerHTML = followers; } function myFollowersErrorHandler(data,errorcode,errormessage) { alert("Couldn't get the followers " + errormessage); } |
Step 4
Finally, publish the solution and then click the Trust It Button.
SharePoint 2013 Hosting Recommendation
HostForLIFE.eu’s SharePoint 2013 Hosting solution offers a comprehensive feature set that is easy-to-use for new users, yet powerful enough for the most demanding web developer expert. Hosted SharePoint Foundation 2013 is the premiere web-based collaboration and productivity enhancement tool on the market today. With SharePoint 2013 Foundation, you can quickly access and manage documents and information anytime, anywhere though a Web browser in a secure and user friendly way. SharePoint hosting services start at only at €9.99/mo, allowing you to take advantage of the robust feature set for a small business price. HostForLIFE.eu offers a variety of hosted SharePoint Foundation 2013 plans as well as dedicated SharePoint 2013 Foundation options.
Print article | This entry was posted by Peter on May 6, 2015 at 5:27 am, and is filed under Other Related Post. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |