本文介绍了在DbChangePoll计时器运行之前,UserProfile属性可能不会生效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我呼叫了UserProfile . CreatePersonalSite 批量创建个人站点.

I call UserProfile.CreatePersonalSite  to create personalsite in batch.

在创建个人网站集之后,我需要在PowerShell中为其激活自定义功能.

after the personal site collection created, i need to activate custom feature for it in the PowerShell.

我需要传递UserProfile.PersonalSite.Url作为Enable-SPFeature的参数.

I need to pass the UserProfile.PersonalSite.Url as parameter for Enable-SPFeature.

CreatePersonalSite方法是同步的,我的意思是,方法完成后站点就在那里了.但是,我看到"UserProfile属性在DbChangePoll计时器运行之前可能不会生效".在ULS日志条目中.

CreatePersonalSite method is synchronious, i mean, the site is there after the method finish. However, I see "The UserProfile properties may not take effect till the DbChangePoll timer runs" in ULS log entry.

结果证明DbChangePoll不是SharePoint计时器作业,而只是.net计时器.

Turnout that DbChangePoll is not a SharePoint timer job, just a .net Timer. 

this.m_ChangePollTimerJob = new Timer(new TimerCallback(DBCache.DBChangePollTimerJob), this, this.m_ChangePollInterval, this.m_ChangePollInterval);
 this.m_ChangePollInterval = new TimeSpan(checked((long)10000000 * userProfileApplication.DbCachePollFrequncy));

不幸的是,userProfileApplication.DbCachePollFrequency是一个内部属性.我必须通过反射来获得价值,否则,我如何知道在createpersonalsite之后启用功能要等待多长时间?

unfortunately, the userProfileApplication.DbCachePollFrequncy is an internal property. I had to work with reflection to get the value, otherwise, how do i know how long shall i wait before enable-spfeature after createpersonalsite

  https://www.snerdi.com.cn/en/

推荐答案

        private void DBLookForChangesSafe()
        {
            try
            {
                Interlocked.Increment(ref this.m_ChangeThreadsRunning);
                if (this.m_ChangeThreadsRunning <= 1)
                {
                    this.DBLookForChanges();
                }
            }
            finally
            {
                Interlocked.Decrement(ref this.m_ChangeThreadsRunning);
            }
        }


这篇关于在DbChangePoll计时器运行之前,UserProfile属性可能不会生效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:48