Sharepoint-UserProfile.PersonalSite对于两个用户为空

Sharepoint-UserProfile.PersonalSite对于两个用户为空,sharepoint,sharepoint-2010,sharepoint-api,Sharepoint,Sharepoint 2010,Sharepoint Api,我正在尝试获取我所有网站的公共URL。我已经为每个loginname运行了这段代码,除了一个用户之外,它工作正常。对于该用户,我在up.PersonalSite中得到null。我已经手动检查了它,并且该用户的mysite存在。知道up.personalsite返回null的原因吗。有什么建议吗 SPServiceContext context = SPServiceContext.GetContext(Site); UP.UserProfileManager upm = new UP.UserP

我正在尝试获取我所有网站的公共URL。我已经为每个loginname运行了这段代码,除了一个用户之外,它工作正常。对于该用户,我在up.PersonalSite中得到null。我已经手动检查了它,并且该用户的mysite存在。知道up.personalsite返回null的原因吗。有什么建议吗

SPServiceContext context = SPServiceContext.GetContext(Site);
UP.UserProfileManager upm = new UP.UserProfileManager(context);
UP.UserProfile up = upm.GetUserProfile(LoginName);
 if (up.PersonalSite == null)
    return "#";
 else
    return up.PublicUrl.OriginalString;

也许,你看到了现有用户的个人资料页面?(http://localhost/my/Person.aspx?accountname=DOMAIN%5CVPupkin)用户应该自己创建站点,或者您可以使用

SPServiceContext context = SPServiceContext.GetContext(Site);
UP.UserProfileManager upm = new UP.UserProfileManager(context);
UP.UserProfile up = upm.GetUserProfile(LoginName);
up.CreatePersonalSite();

我还注意到,在中央管理部门,我为每个用户收集了网站集,但不是为这个用户。这是什么意思。我不太了解mysite的功能。请提供帮助。在自动创建用户配置文件同步个人网站后,如果您手动创建用户配置文件,那么您也应该手动创建个人网站。