publishingweb.label是null.
-
10-12-2019 - |
题
我有一个功能,它一旦创建了使用我的自定义Web模板即可立即激活。在该功能中,我检查这个网站是否驻留在源标签变化层次结构中,所以我正在使用...
PublishingWeb pubweb = PublishingWeb.GetPublishingWeb(web);
if(pubweb.Label != null && pubweb.Label.IsSource)
{
...
}
.
但标签为我在“en-US”中创建的网站为空。
我在思考,如果它是标签的实际rootweb,那么标签只有一个值?或者我必须发布该网站并让变体计时器作业在我可以阅读“标签”之前运行--Property?
解决方案
Nevermind, I just found out the problem after some more testing.
I need to let Site propagation job to run before the new site is considered to be a part of the hiearchy and thus having a Label. This means I have to find out a different way to determine if newly created site is a part of the source hierarchy.