ServerContext クラス (Microsoft.Office.Server)
Microsoft Office SharePoint Server 2007 の共有サービスにランタイム メソッドを提供します。
名前空間: Microsoft.Office.Server
アセンブリ: Microsoft.Office.Server (microsoft.office.server.dll 内)
構文
'宣言
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
Public NotInheritable Class ServerContext
'使用
Dim instance As ServerContext
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)]
public sealed class ServerContext
例
//Updates a user profile
//Creates a user profile. Obtains the property values from the default
//domain controller or the master connection that is configured on the
//server
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint.Administration;
using Microsoft.Office.Server.UserProfiles;
using Microsoft.SharePoint;
using Microsoft.Office.Server;
using System.Web;
namespace UserProfilesApp
{
class Program
{
static void Main(string[] args)
{
try
{
using (SPSite site = new SPSite("https://servername"))
{
ServerContext context = ServerContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context);
string sAccount = "domainname\\username";
UserProfile u = profileManager.GetUserProfile(sAccount);
u[PropertyConstants.HomePhone].Value = "nnnnnnnnnn";
u[PropertyConstants.CellPhone].Value = "nnnnnnnnnn";
u.Commit();
}
}
catch (UserNotFoundException exception)
{
Console.WriteLine(exception.ToString());
}
}
}
}
継承階層
System.Object
Microsoft.Office.Server.ServerContext
スレッドの安全性
この型のパブリックで静的な (Visual Basic では Shared) すべてのメンバは、スレッド セーフです。インスタンス メンバは、スレッド セーフであるとは保証されません。