Kam*_*ran 2 c# sitecore sitecore7.2
在sitecore中:
如果用户使用用户名" Addemo" 登录,如何获取用户名称项目/sitecore/content/Intranet/User Profiles/A/Ad/addemo.
我试过 User.Current.Profile.ProfileItemId;但是我得到的ID不是addemo(/用户个人资料/ A/Ad/addemo)的项目ID .
小智 5
看起来您正在使用Sitecore Intranet.我不是100%熟悉其中的细节(主要是我的同事使用该部分),但这应该是你正在寻找的:
using Sitecore.Intranet.Profiles;
using Sitecore.Intranet.Profiles.Providers;
using Sitecore.Security.Accounts;
// ------------------------------
var userName = User.Current.Name;
var account = Account.FromName(userName, AccountType.User);
var profileProvider = new UserProfileProvider(new Settings());
var profile = profileProvider.GetProfile(account.LocalName.ToLower());
var profileItem = profile.ProfileItem;
Run Code Online (Sandbox Code Playgroud)
我没有测试过这个,因为我手头没有解决方案,所以如果有些事情有点让我知道.
| 归档时间: |
|
| 查看次数: |
5104 次 |
| 最近记录: |