如何:使用 Web 服务添加链接和同事

上次修改时间: 2006年4月24日

适用范围: SharePoint Server 2010

User Profile Service Web 服务提供用于添加链接和同事的方法。以下代码示例介绍如何使用该 Web 服务远程添加链接和同事。

运行此代码之前,请将 domainname、username 和其他占位符替换为实际值。此外,请在您的 Microsoft Visual Studio 项目中添加对以下内容的 Web 引用:

  • Userprofileservice - 该 Web 服务位于 http://<网站 URL>/_vti_bin/userprofileservice.asmx。

示例

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);

    }
}

请参阅

任务

如何:使用 Web 服务找出两个用户配置文件之间的相同内容

如何:使用 Web 服务修改用户配置文件数据

如何:使用 Web 服务检索用户的配置文件数据