Sharepoint 2010 - 我可以重新连接用户照片 URL 吗?

发布于 2024-09-30 14:06:12 字数 495 浏览 0 评论 0原文

SharePoint 2010 更多地利用员工的照片。在我的公司,员工照片由秘书管理,并被视为人力资源数据的一部分。我们有一个方便的 Web 服务,可以根据登录情况调整员工照片的大小并返回:

http://services.domain.com/photo.ashx?login=kobi&width=64&height=64

将所有 SharePoint 照片“重新连接”到此服务的好方法是什么?我想避免将所有照片上传到 /my 网站,或更新 Active Directory - 我正在寻找全代码解决方案。

我可以重写显示照片的部分吗?如果没有,可以重写所有用户照片的网址吗?

看起来 SharePoint 正在使用 Microsoft.SharePoint.Portal.dll 中的 ProfilePropertyImage - 我真正想做的是让 SharePoint 使用我的控件。是不是太乐观了?

SharePoint 2010 makes greater use of the employee's photo. In my company, employee photos are managed by secretaries and are considered part of HR data. We have a handy web service that resizes and returns employees' photos according to login:

http://services.domain.com/photo.ashx?login=kobi&width=64&height=64

What is a good way to "rewire" all SharePoint photos to this service? I'd like to avoid uploading all photos to the /my site, or updating the Active Directory - I'm looking for an all-code solution.

Can I rewrite the part that displays the photo? If not, can rewrite all users' photos' urls?

Looks like SharePoint is using ProfilePropertyImage from Microsoft.SharePoint.Portal.dll - What I would really like to do is to make SharePoint use my control instead. Is that too optimistic?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心头的小情儿 2024-10-07 14:06:12

有一个小型 STSADM 脚本,使用自定义 URL 和用户 ID 更改用户图像 URL。它是为 Sharepoint 2007 制作的,但也许对于 SP2010 来说这是一个简单的更改?实际上,看起来甚至可以用它制作一个小型控制台应用程序。

也许您对用户图像的自定义 HTTP 处理程序(同样是 Sharepoint 2007)感兴趣?

对于 Sharepoint 2010,您可能想要研究用户个人资料同步服务,也许您可​​以以某种方式将特殊图像 URL 附加到个人资料?

There is a small STSADM script changing the user image URL with a custom URL and the user ID. It was made for Sharepoint 2007, but maybe it is an easy change for SP2010? Actually it even looks like one could make a little console application from it.

Maybe you're interested in a custom HTTP handler for user images (again Sharepoint 2007)?

For Sharepoint 2010 you might want to look into the User Profile Synchronization service, maybe you can attach your special image URL to the profiles somehow?

深者入戏 2024-10-07 14:06:12

如果您将 UserProfiles 与 UserProfileManager 结合使用,则可以在导入配置文件时手动设置此属性。您可以从任何系统设置导入,然后在创建用户配置文件时,只需将 PictureUrl 字段设置为您的自定义 URL。您可以使用简单控制台应用程序中的批处理作业来更好地控制导入,而不是使用内置的配置文件同步。您可以从 .exe 运行此代码,作为各个系统的夜间配置文件更新的一部分。

SPServiceContext serviceContext = SPServiceContext.GetContext(topSite);
UserProfileManager profileMgr = ProfileLoader.GetProfileLoader(serviceContext).GetUserProfileManager();
UserProfile curUser = null;
if (profileMgr.UserExists(userId))
{
    curUser = profileMgr.GetUserProfile(userId);
} 
else
{
    curUser = profileMgr.CreateUserProfile(userId);
}
//Set lots of other properties here
curUser[PropertyConstants.PictureUrl].Value = "http://services.domain.com/photo.ashx?login=" + userId + "&width=64&height=64";
curUser.Commit();

这会将 PicureUrl 属性设置为您的自定义 URL,并且您不必上传所有照片。

If you are using the UserProfiles with UserProfileManager then you can set this property manually when you import the profiles. You can set up your import from whatever system and then when you are creating the User Profile, simply set the PictureUrl field to be your custom URL. Rather than use the built-in profile syncronization you can use a batch job from a simple console application to have more control over the import. You can run this code from a .exe as part of a nightly profile update from various systems.

SPServiceContext serviceContext = SPServiceContext.GetContext(topSite);
UserProfileManager profileMgr = ProfileLoader.GetProfileLoader(serviceContext).GetUserProfileManager();
UserProfile curUser = null;
if (profileMgr.UserExists(userId))
{
    curUser = profileMgr.GetUserProfile(userId);
} 
else
{
    curUser = profileMgr.CreateUserProfile(userId);
}
//Set lots of other properties here
curUser[PropertyConstants.PictureUrl].Value = "http://services.domain.com/photo.ashx?login=" + userId + "&width=64&height=64";
curUser.Commit();

This will set the PicureUrl property to your custom URL and you don't have to upload all of the photos.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文