SharePoint: Get User Profile Details Using SPServices JQuery Library
The $().SPServices JavaScript Add-on provide the function $().SPServices.GetUserProfileByName, which will help to get user profile details of the user in the SharePoint site.
The user profile details included:
1. AboutMe:""
2. AccountName:"i:0#.f|membership|amitkumar@amitkumarmca04.blogspot.com"
3. Assistant:""
4. CellPhone:""
5. DelveFlags:""
6. Department:""
7. Fax:""
8. FirstName:"Amit"
9. HomePhone:""
10. LastName:"Kumar"
11. Manager:"i:0#.f|membership|manager@amitkumarmca04.blogspot.com"
12. Office:"Bengaluru "
13. OfficeGraphEnabled:""
14. PersonalSpace:"/personal/amitkumar_amitkumarmca04_blogspot_com /"
15. PictureURL:""
16. PreferredName:"Kumar, Amit AK"
17. PublicSiteRedirect:"https://Office.com/experience.aspx?accountname=amitkumar"
18. PulseMRUPeople:""
19. QuickLinks:""
20. SPS-AdjustHijriDays:""
21. SPS-AltCalendarType:""
22. SPS-Birthday:""
23. SPS-CalendarType:""
24. SPS-ClaimID:"amitkumarmca04.blogspot.com"
25. SPS-ClaimProviderID:"membership"
26. SPS-ClaimProviderType:"Forms"
27. SPS-ContentLanguages:""
28. SPS-Department:""
29. SPS-DisplayOrder:""
30. SPS-DistinguishedName:"CN=xx,OU=xx,OU=xx,OU=MSOnline,DC=xx,DC=msft,DC=net"
31. SPS-DontSuggestList:""
32. SPS-Dotted-line:""
33. SPS-EmailOptin:"0"
34. SPS-FeedIdentifier:""
35. SPS-FirstDayOfWeek:""
36. SPS-FirstWeekOfYear:""
37. SPS-HashTags:""
38. SPS-HideFromAddressLists:""
39. SPS-HireDate:""
40. SPS-Interests:""
41. SPS-JobTitle:"Technical Architect"
42. SPS-LastColleagueAdded:""
43. SPS-LastKeywordAdded:""
44. SPS-Locale:""
45. SPS-Location:""
46. SPS-MUILanguages:""
47. SPS-MasterAccountName:""
48. SPS-MultiGeoFlags:""
49. SPS-MySiteUpgrade:""
50. SPS-O15FirstRunExperience:"1000"
51. SPS-OWAUrl:""
52. SPS-ObjectExists:""
53. SPS-PastProjects:""
54. SPS-Peers:""
55. SPS-PersonalSiteCapabilities:"4"
56. SPS-PersonalSiteFirstCreationError:"Personal Site already exists."
57. SPS-PersonalSiteFirstCreationTime:"xxx-xx-xx:xx:xx"
58. SPS-PersonalSiteInstantiationState:"2"
59. SPS-PersonalSiteLastCreationTime:" xx-xx-xx:01:10"
60. SPS-PersonalSiteNumberOfRetries:"1"
61. SPS-PhoneticDisplayName:""
62. SPS-PhoneticFirstName:""
63. SPS-PhoneticLastName:""
64. SPS-PictureExchangeSyncState:"0"
65. SPS-PicturePlaceholderState:"1"
66. SPS-PictureTimestamp:"46466"
67. SPS-PointPublishingUrl:""
68. SPS-PrivacyActivity:"0"
69. SPS-PrivacyPeople:"false"
70. SPS-ProxyAddresses:""
71. SPS-RecipientTypeDetails:"100"
72. SPS-RegionalSettings-FollowWeb:""
73. SPS-RegionalSettings-Initialized:""
74. SPS-ResourceAccountName:""
75. SPS-Responsibility:""
76. SPS-SavedAccountName:"i:0#.f|membership|amitkumar@amitkumarmca04.blogspot.com"
77. SPS-School:""
78. SPS-SharePointHomeExperienceState:""
79. SPS-ShowWeeks:""
80. SPS-SipAddress:"amitkumar@amitkumarmca04.blogspot.com"
81. SPS-Skills:""
82. SPS-SourceObjectDN:""
83. SPS-StatusNotes:""
84. SPS-TenantInstanceId:""
85. SPS-Time24:""
86. SPS-TimeZone:""
87. SPS-UserPrincipalName:"amitkumar@amitkumarmca04.blogspot.com"
88. SPS-UserType:"0"
89. SPS-WorkDayEndHour:""
90. SPS-WorkDayStartHour:""
91. SPS-WorkDays:""
92. Title:"Technical Architect"
93. UserName:"amitkumar@amitkumarmca04.blogspot.com"
94. UserProfile_GUID:"xxx-xx-1234-4464-XXXXXX"
95. VideoUserPopup:""
96. WebSite:""
97. WorkEmail:"amitkumar@amitkumarmca04.blogspot.com"
98. WorkPhone:""
99. msOnline-ObjectId:"xxx-xx-xx-xx-xxxxx"
Get current logged-in user profile details using $().SPServices.GetUserProfileByName:
var profile = {};
$().SPServices({
operation: "GetUserProfileByName",
async: false,
AccountName: 'i:0#.f|membership|amitkumar@amitkumarmca04.blogspot.com',
completefunc: function (xData, Status) {
$(xData.responseXML).find("PropertyData").each(function (idx, val) {
var $val = $(val);
var name = $val.find("Name").text();
var value = $val.find("Value").text();
profile[name] = value;
});
}
});
console.log(profile);
In the above code block, we are trying to get all profiles details of user $().SPServices.GetUserProfileByName.