SharePoint 2013用户配置文件属性上次修改时间 [英] SharePoint 2013 User Profile Attributes Last Modified Time

查看:129
本文介绍了SharePoint 2013用户配置文件属性上次修改时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以找出上次更新用户个人资料属性的时间吗?想要获取Picture属性的最后修改时间。

解决方案

 


您可以通过UserProfileChangeQuery获取最近更改的用户配置文件(根据我的知识不能限制为特定属性)。


以下是供您参考的主题。


<跨度> https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ms517376(v%的3Doffice.14)


我的测试代码。

使用(SPSite site = new SPSite(" http:// sp:12001" ))
{
SPServiceContext context = SPServiceContext.GetContext(site);
UserProfileManager profileManager =
new UserProfileManager(context);

DateTime startDate =
DateTime.UtcNow.Subtract(TimeSpan.FromDays(天数));
UserProfileChangeQuery changeQuery = new UserProfileChangeQuery(true,true);
changeQuery.ChangeTokenStart = new UserProfileChangeToken(startDate);

UserProfileChangeCollection changes = profileManager.GetChanges(changeQuery);

foreach(UserProfileChange更改更改)
{
Console.Write(change.AccountName +" - " + change.EventTime);
}
Console.Read();
}





最好的问候,



Can we find out when a user profile attribute was last updated? Looking to fetch the last modified time for Picture attribute.

解决方案

Hi, 

You could get recent changed user profile by UserProfileChangeQuery(can't limit to specific attribute based on my knowledge).

Here is the thread for your reference.

https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ms517376(v%3Doffice.14)

My test code.

using (SPSite site = new SPSite("http://sp:12001"))
            {
                SPServiceContext context = SPServiceContext.GetContext(site);
                UserProfileManager profileManager =
                  new UserProfileManager(context);
                
                DateTime startDate =
                  DateTime.UtcNow.Subtract(TimeSpan.FromDays(number of days));
                UserProfileChangeQuery changeQuery = new UserProfileChangeQuery(true, true);
                changeQuery.ChangeTokenStart = new UserProfileChangeToken(startDate);

                UserProfileChangeCollection changes = profileManager.GetChanges(changeQuery);

                foreach (UserProfileChange change in changes)
                {
                    Console.Write(change.AccountName+"--"+ change.EventTime);
                }
                Console.Read();
            }


Best Regards,

Lee


这篇关于SharePoint 2013用户配置文件属性上次修改时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆