[方法] ユーザー プロファイル プロパティのプライバシー ポリシーを設定する
Microsoft Office SharePoint Server 2007 では、ユーザー プロファイル プロパティ、メンバシップ、仕事仲間などにプライバシー ポリシーを設定して、個人情報を表示および編集できるユーザーを制限することができます。
Default Privacy ポリシーでは、プロパティ、ユーザーの [マイ ドキュメント]、および他の [個人用サイト] のコンテンツの表示が以下のように制限されます。
[プライベート] : [自分のみ]
[マネージャ] : [自分と自分のマネージャ]
[自分の業務グループ] : [組織]
[自分の仕事仲間] : [連絡先]
[公開] : [すべてのユーザー]
Privacy Policy には、プロパティに対する値の指定が必須、無効、任意のいずれであるかを指定します。Privacy Policy は、ユーザー プロファイル プロパティにのみ適用できます。
以下のコード例は、プロパティのプライバシーを設定する方法を示しています。このコード例を実行する前に、servername と Hobbies を実際の値に置き換えます。また、参照を Microsoft Visual Studio プロジェクト中の以下に追加します。
Microsoft.Office.Server
Microsoft.SharePoint
System.Web
例
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Server;
using Microsoft.Office.Server.Administration;
using Microsoft.Office.Server.UserProfiles;
using Microsoft.SharePoint;
using System.Web;
namespace UserProfilesApp
{
class Program
{
static void Main(string[] args)
{
using (SPSite site = new SPSite("https://servername"))
{
ServerContext context =
ServerContext.GetContext(site);
UserProfileManager profileManager = new
UserProfileManager(context);
PropertyCollection pc = profileManager.Properties;
Property property = pc.GetPropertyByName("Hobbies");
property.DefaultPrivacy = Privacy.Manager;
property.PrivacyPolicy = PrivacyPolicy.Mandatory;
property.Commit();
}
}
}
}
See Also
タスク
[方法] ユーザー プロファイル プロパティを作成および編集する