Class UserProfileService


  • public class UserProfileService
    extends AbstractService
    Provides UserProfileService SharePoint web service class.

    User Profile Service SharePoint Example

    The Groovy script example below illustrates using the UserProfileService service to look up a User Profile and get its user profile property data object. In this example the account name is specified by the accountname String object.

     import com.avoka.component.sharepoint.SPClient
     import com.avoka.component.sharepoint.service.UserProfileService
     import com.avoka.component.sharepoint.type.PropertyData
     import com.avoka.component.sharepoint.type.PropertyValue
    
     // Create a SharePoint client using the service parameters map with the configured connection details
     def spClient = new SPClient(serviceParameters)
    
     // Create a UserProfileService web service
     def userProfileServiceService = spClient.getUserProfileService()
    
     // Get a user profile property data object for the given account name
     def userPropertyData = userProfileServiceService.getUserProfileByName(accountname)
    
     // Iterate through Property Data Map Names
     Map> propMap = userPropertyData.getPropertyDataMap()
     Iterator propKeyIter = propMap.keySet().iterator()
     while (propKeyIter.hasNext()) {
         String propName = (String) propKeyIter.next()
         // Get Property Value, Type List and iterate through
         List propValueList = propMap.get(propName)
         Iterator propValueIter = propValueList.iterator()
         while (propValueIter.hasNext()) {
             PropertyValue propValue = (PropertyValue) propValueIter.next()
             def value = propValue.getValue()
             def type = propValue.getType()
             // Use type, value ..
         }
     } 
    Since:
    3.5.0
    • Constructor Detail

      • UserProfileService

        public UserProfileService​(SPConnection sharePointConnection)
        Instantiate the UserProfileService Interface wrapper with Sharepoint Connection context
        Parameters:
        sharePointConnection - Sharepoint connection context
    • Method Detail

      • getUserProfileByName

        public PropertyData getUserProfileByName​(String accountName)
                                          throws SPException
        Gets the user profile property information by account name.

        Groovy Example

        The Groovy script example below illustrates using the UserProfileService service to look up a User Profile and get its user profile property data object. In this example the account name is specified by the accountname String object.

         import com.avoka.component.sharepoint.SPClient
         import com.avoka.component.sharepoint.service.UserProfileService
         import com.avoka.component.sharepoint.type.PropertyData
         import com.avoka.component.sharepoint.type.PropertyValue
        
         // Create a SharePoint client using the service parameters map with the configured connection details
         def spClient = new SPClient(serviceParameters)
        
         // Create a UserProfileService web service
         def userProfileServiceService = spClient.getUserProfileService()
        
         // Get a user profile property data object for the given account name
         def userPropertyData = userProfileServiceService.getUserProfileByName(accountname)
        
         // Iterate through Property Data Map Names
         Map> propMap = userPropertyData.getPropertyDataMap()
         Iterator propKeyIter = propMap.keySet().iterator()
         while (propKeyIter.hasNext()) {
             String propName = (String) propKeyIter.next()
             // Get Property Value, Type List and iterate through
             List propValueList = propMap.get(propName)
             Iterator propValueIter = propValueList.iterator()
             while (propValueIter.hasNext()) {
                 PropertyValue propValue = (PropertyValue) propValueIter.next()
                 def value = propValue.getValue()
                 def type = propValue.getType()
                 // Use type, value ..
             }
         } 

        Web Service Method

        The Microsoft SharePoint Web Service SOAP Method:

        http://microsoft.com/webservices/SharePointPortalServer/UserProfileService/GetUserProfileByName

        The MSDN Method Reference:

        http://msdn.microsoft.com/en-us/library/websvcuserprofileservice.userprofileservice.getuserprofilebyname.aspx

         

        Parameters:
        accountName - The account name of the user profile to be retrieved.
        Returns:
        PropertyData object representing the property information about the specified user profile.
        Throws:
        SPException - in case of Sharepoint error response