How to: Use the Web Service to Add Links and Colleagues
Applies to: SharePoint Server 2010
The User Profile Service Web service provides methods that allow you to add links and colleagues. The following code example shows you how to use the Web service to add links and colleagues remotely.
Before running this code, replace domainname, username, and other placeholders with actual values. Also add a Web reference to the following in your Microsoft Visual Studio project:
- Userprofileservice - The Web service is located at http://<site URL>/_vti_bin/userprofileservice.asmx.
Example
using System;
using System.Collections.Generic;
using System.Text;
namespace UserProfileWebServiceApp
{
class Program
{
public static localhost.UserProfileService myService =
new localhost.UserProfileService();
myService.AddLink("Training Resources","http://newhiretraining","Training",UserProfileWebService.
localhost.Privacy.Organization);
myService.AddColleague("domainname\username", "Personal", UserProfileWebService.localhost.Privacy.Private);
}
}
See Also
Tasks
How to: Use the Web Service to Find What's Common Between Two User Profiles
How to: Use the Web Service to Modify User Profile Data
How to: Use the Web Service to Retrieve Profile Data of a User