I am merely trying to use the GetUserProfileByName service to get some details on a user from the AD. For this I opted to use javascript. After a little bit of research, and a significant amount of tinkering, I managed to connect to the webservice and successfully retrieve the data.
I used a simple if statement to compare the 'name' of the property in order to get the specific value I want.
if(xmlDoc.getElementsByTagName("Name")[i].childNodes[0].nodeValue == "Department")
{
property = xmlDoc.getElementsByTagName("Value")[i].childNodes[0].nodeValue;
}
At this point I started noticing some discrepancies. I seemed to not be getting the property I specify in the comparison. For example if I specify "Department" it returns the email. After a lot of struggling i finally decided to just drop all the "Name" and "Value" fields into two arrays without any comparison and display them next to each other.
for(i = 0; i < 13 ; i++)
{
description[i] = xmlDoc.getElementsByTagName("Name")[i].childNodes[0].nodeValue;
elements[i] = xmlDoc.getElementsByTagName("Value")[i].childNodes[0].nodeValue;
}
The conclusion I got from this was that the two fields clearly did not match up with each other:
UserProfile_GUID: 65f017dc-b892-4afa-8730-5e8f73aa7b86
AccountName: CAPETOWN\ANEL5
FirstName: Abraham
SPS-PhoneticFirstName: Nel
LastName: Abraham Nel
SPS-PhoneticLastName: 021 ### ####
PreferredName: CRS - Info Sys & Tech
SPS-PhoneticDisplayName: Contractor
WorkPhone: Contractor
Department: ANEL5
Title: CN=Abraham Nel,OU=Standard,OU=Users,OU=End-User Services,DC=###,DC=###,DC=###
SPS-JobTitle: ###@###.###
Manager: Cape Town Civic Centre Podium Block
Any idea why this would be happening?
Result from trying to parse the entire XML document to string:
falsefalseUserProfile_GUIDNotSetb21ec99c-2ad9-40a8-9d45-a3273c92ee5afalsefalseAccountNameNotSetCAPETOWN\AHEYNESfalsefalseFirstNameNotSetAshleyfalsefalseSPS-PhoneticFirstNameNotSetfalsefalseLastNameNotSetHeynesfalsefalseSPS-PhoneticLastNameNotSetfalsefalsePreferredNameNotSetAshley HeynesfalsefalseSPS-PhoneticDisplayNameNotSetfalsefalseWorkPhoneNotSet021 400 ####falsefalseDepartmentNotSetCRS - Info Sys & TechfalsefalseTitleNotSetAssistant Professional OfficerfalsefalseSPS-JobTitleNotSetAssistant Professional OfficerfalsefalseManagerNotSetCAPETOWN\DSISSINGfalsefalseAboutMeNotSetfalsefalsePersonalSpaceNotSetfalsefalsePictureURLNotSetfalsefalseUserNameNotSetAHEYNESfalsefalseQuickLinksNotSetfalsefalseWebSiteNotSetfalsefalsePublicSiteRedirectNotSetfalsefalseSPS-Dotted-lineNotSetfalsefalseSPS-PeersNotSetfalsefalseSPS-ResponsibilityNotSetfalsefalseSPS-SipAddressNotSetfalsefalseSPS-MySiteUpgradeNotSetfalsefalseSPS-ProxyAddressesNotSetfalsefalseSPS-HireDateNotSetfalsefalseSPS-DisplayOrderNotSetfalsefalseSPS-ClaimIDNotSetfalsefalseSPS-ClaimProviderIDNotSetfalsefalseSPS-ClaimProviderTypeNotSetfalsefalseSPS-SavedAccountNameNotSetfalsefalseSPS-ResourceAccountNameNotSetfalsefalseSPS-ObjectExistsNotSetfalsefalseSPS-MasterAccountNameNotSetfalsefalseSPS-DistinguishedNameNotSetCN=Ashley Heynes,OU=Developers,OU=Users,OU=End-User Services,DC=##,DC=##,DC=##falsefalseSPS-SourceObjectDNNotSetfalsefalseWorkEmailNotSet##.##@##.##.##falsefalseCellPhoneNotSetfalsefalseFaxNotSetfalsefalseOfficeNotSetCape Town Paul Sauer BuildingfalsefalseSPS-LocationNotSetfalsefalseSPS-TimeZoneNotSetfalsefalseAssistantNotSetfalsefalseSPS-PastProjectsNotSetfalsefalseSPS-SkillsNotSetfalsefalseSPS-SchoolNotSetfalsefalseSPS-BirthdayNotSetfalsefalseSPS-StatusNotesNotSetfalsefalseSPS-InterestsNotSetfalsefalseSPS-EmailOptinNotSet