UserProfileService.GetCommonColleagues Method
Gets the common colleagues that a particular user shares with the current user.
Namespace: websvcUserProfileService
Assembly: MOSSSOAP (in MOSSSOAP.dll)
Syntax
'Declaration
<SoapDocumentMethodAttribute("https://microsoft.com/webservices/SharePointPortalServer/UserProfileService/GetCommonColleagues", RequestNamespace := "https://microsoft.com/webservices/SharePointPortalServer/UserProfileService", _
ResponseNamespace := "https://microsoft.com/webservices/SharePointPortalServer/UserProfileService", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetCommonColleagues ( _
accountName As String _
) As ContactData()
'Usage
Dim instance As UserProfileService
Dim accountName As String
Dim returnValue As ContactData()
returnValue = instance.GetCommonColleagues(accountName)
[SoapDocumentMethodAttribute("https://microsoft.com/webservices/SharePointPortalServer/UserProfileService/GetCommonColleagues", RequestNamespace = "https://microsoft.com/webservices/SharePointPortalServer/UserProfileService",
ResponseNamespace = "https://microsoft.com/webservices/SharePointPortalServer/UserProfileService",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public ContactData[] GetCommonColleagues(
string accountName
)
Parameters
- accountName
Type: System.String
Account name of the user.
Return Value
Type: []
A ContactData object.
Remarks
The following example shows how to find common colleagues, manager, memberships, and contacts.
Make sure you add a Web reference to a UserProfileService Web service site you have access to. Change the using UserProfileServiceSample.MyServer002; directive to point to the Web service site you are referencing. In addition, replace "domain\\username" with valid values.
Examples
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Services.Protocols;
// TODO
// Change the using UserProfileServiceSample.MyServer002 directive
// to point to the Web service you are referencing.
using UserProfileServiceSample.MyServer002;
namespace UserProfileServiceSample
{
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;
FindCommonColleagues();
FindCommonManager();
FindCommonMemberships();
FindInCommon();
}
static void FindCommonColleagues()
{
// TODO
// Replace "domain\\username" with valid values.
// Notice that ContactData[] contacts =
// userProfileService.GetCommonColleagues.
// "domain\\username"); will always run as
// what User A (you) has in common
// with UserB (the argument specified).
ContactData[] contacts = userProfileService.GetCommonColleagues("domain\\username");
for (int i = 0; i < contacts.Length; i++)
{
Console.WriteLine(contacts[i].Name);
Console.ReadLine();
}
Console.ReadLine();
}
static void FindCommonManager()
{
// TODO
// Replace "domain\\username" with valid values.
ContactData contact =
userProfileService.GetCommonManager("domain\\username");
Console.WriteLine(contact.Name);
Console.ReadLine();
}
static void FindCommonMemberships()
{
// TODO
// Replace "domain\\username" with valid values.
MembershipData[] memberships =
userProfileService.GetCommonMemberships("domain\\username");
for (int i = 0; i < memberships.Length; i++)
{
Console.WriteLine(memberships[i].DisplayName);
}
Console.ReadLine();
}
static void FindInCommon()
{
// TODO
// Replace "domain\\username" with valid values.
InCommonData incommon =
userProfileService.GetInCommon("domain\\username");
for (int i = 0; i < incommon.Colleagues.Length; i++)
{
Console.WriteLine(incommon.Colleagues[i].Name);
}
Console.ReadLine();
}
}
}