UserProfileService.GetUserColleagues Method
Gets the colleagues of a given user.
Web Service: User ProfileWeb Reference: http://<Site>/_vti_bin/UserProfileService.asmx
Syntax
'Declaration
<SoapDocumentMethodAttribute("https://microsoft.com/webservices/SharePointPortalServer/UserProfileService/GetUserColleagues", RequestNamespace:="https://microsoft.com/webservices/SharePointPortalServer/UserProfileService", ResponseNamespace:="https://microsoft.com/webservices/SharePointPortalServer/UserProfileService", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function GetUserColleagues ( _
accountName As String _
) As ContactData()
'Usage
Dim instance As UserProfileService
Dim accountName As String
Dim returnValue As ContactData()
returnValue = instance.GetUserColleagues(accountName)
[SoapDocumentMethodAttribute("https://microsoft.com/webservices/SharePointPortalServer/UserProfileService/GetUserColleagues", RequestNamespace="https://microsoft.com/webservices/SharePointPortalServer/UserProfileService", ResponseNamespace="https://microsoft.com/webservices/SharePointPortalServer/UserProfileService", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)]
public ContactData[] GetUserColleagues (
string accountName
)
Parameters
- accountName
Account name of the user.
Return Value
A ContactData object.
Remarks
The following example shows how to get information about the membership of a user, colleagues of a user, links, and user profile property data.
Make sure you add a Web reference to a UserProfileService Web service site you have access to. Change the using GetProfileDataSample.MyServer002;
directive to point to the Web service site you are referencing. In addition, replace "domain\\username"
with valid values.
Example
using System;
using System.Collections.Generic;
using System.Text;
// TODO
// Change the using GetProfileDataSample.MyServer002 directive
// to point to the Web service you are referencing.
using GetProfileDataSample.MyServer002;
namespace GetProfileDataSample
{
class Program
{
//Instantiate the Web service.
public static UserProfileService userProfileService = new UserProfileService();
static void Main(string[] args)
{
//Set credentials for requests.
//Use the current user log-on credentials.
userProfileService.Credentials =
System.Net.CredentialCache.DefaultCredentials;
GetUserProfilePropertyData();
GetUserMemberships();
GetUserColleagues();
GetUserLinks();
}
static void GetUserProfilePropertyData()
{
// TODO
// Replace "domain\\username" with valid values.
PropertyData[] properties =
userProfileService.GetUserProfileByName("domain\\username");
for (int i = 0; i < properties.Length; i++)
{
Console.WriteLine(properties[i].Name);
Console.WriteLine(properties[i].Values);
}
Console.Read();
}
static void GetUserMemberships()
{
// TODO
// Replace "domain\\username" with valid values.
MembershipData[] memberships =
userProfileService.GetUserMemberships("domain\\username");
for (int i = 0; i < memberships.Length; i++)
{
Console.WriteLine(memberships[i].DisplayName);
}
Console.Read();
}
static void GetUserColleagues()
{
// TODO
// Replace "domain\\username" with valid values.
ContactData[] contacts =
userProfileService.GetUserColleagues("domain\\username");
for (int i = 0; i < contacts.Length; i++)
{
Console.WriteLine(contacts[i].Name);
}
Console.Read();
}
static void GetUserLinks()
{
// TODO
// Replace "domain\\username" with valid values.
QuickLinkData[] links =
userProfileService.GetUserLinks("domain\\username ");
for (int i = 0; i < links.Length; i++)
{
Console.WriteLine(links[i].Url);
}
Console.Read();
}
}
}
See Also
Reference
UserProfileService Class
UserProfileService Members
User Profile Web Service