问题描述
大家好,
我已经创建了一个自定义用户配置文件属性"TrainingSingleValue",具有以下选项-
我可以在用户个人资料属性部分看到该属性.
现在,当我尝试访问此属性时,现在都在som代码中,但出现以下错误-
{未定义属性:TrainingSingleValue".管理员必须在个人档案管理"工具中创建此属性."}
这是我用来访问此属性的代码-
SPServiceContext serviceContext = SPServiceContext.GetContext(site);
Console.WriteLine(检索用户个人资料:");
UserProfileManager userProfileMgr =新的UserProfileManager(serviceContext);
UserProfile用户= userProfileMgr.GetUserProfile(fieldValue.User.LoginName);
user ["TrainingSingleValue"].Value ="Mohit";
我正在服务帐户下运行代码.任何帮助将不胜感激.
预先感谢
K Mohit
Hi All,
I have created a custom user profile property "TrainingSingleValue" with below options -
I can see the property in the user profile property section.
Now in som code whenever I am trying to access this property I am getting below error-
{"Property Not Defined: TrainingSingleValue. An administrator must create this property in the Profile Administration tool."}
Here is the code that I am using to access this property -
SPServiceContext serviceContext = SPServiceContext.GetContext(site);
Console.WriteLine("Retrieving user profiles:");
UserProfileManager userProfileMgr = new UserProfileManager(serviceContext);
UserProfile user = userProfileMgr.GetUserProfile(fieldValue.User.LoginName);
user["TrainingSingleValue"].Value = "Mohit";
I am running the code under service account. Any help would be appreciates.
Thanks in advance
K Mohit
这篇关于无法访问自定义用户个人资料属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!