您现在的位置是:主页 > news > 建设一个网站的一般过程/企业网站托管

建设一个网站的一般过程/企业网站托管

admin2025/6/9 9:02:56news

简介建设一个网站的一般过程,企业网站托管,纯文字网站设计,光明乳业网站是谁做的在此前写了两篇文章sharepoint 的UserProfile博客 sharepoint 2010 获取用户信息UserProfile方法 sharepoint 2010 怎样用SocialCommentManager获取记事板评论数据 这里顺便记录一下,怎样通过程序,来更新UserProfile的属性所相应的字段值。1.引用几个dll…

建设一个网站的一般过程,企业网站托管,纯文字网站设计,光明乳业网站是谁做的在此前写了两篇文章sharepoint 的UserProfile博客 sharepoint 2010 获取用户信息UserProfile方法 sharepoint 2010 怎样用SocialCommentManager获取记事板评论数据 这里顺便记录一下,怎样通过程序,来更新UserProfile的属性所相应的字段值。1.引用几个dll…

在此前写了两篇文章sharepoint 的UserProfile博客

sharepoint 2010 获取用户信息UserProfile方法

sharepoint 2010 怎样用SocialCommentManager获取记事板评论数据

这里顺便记录一下,怎样通过程序,来更新UserProfile的属性所相应的字段值。

1.引用几个dll.

Microsoft.Office.Server.dll,

Microsoft.Office.Server.UserProfiles.dll

Microsoft.Sharepoint.dll

2.创建一个控制台应用程序。

在Main方法中,运行例如以下方法。

SPSecurity.RunWithElevatedPrivileges(delegate()

            {

                try

                {

                    using (SPSite site = newSPSite(BasePage.siteURL))//serverUrl

                    {

                        SPServiceContext context = SPServiceContext.GetContext(site);

                        UserProfileManager profileManager = newUserProfileManager(context);

                        string sAccount = "dev\\chenxinxian";//域名\username

                        UserProfile u =profileManager.GetUserProfile(sAccount);

                        u[PropertyConstants.FirstName].Value = "新贤";//名字

                        u[PropertyConstants.LastName].Value = "";//姓氏

                       u.DisplayName = "陈新贤";

                        u.Commit();

                    }

                }

                catch (UserNotFoundException exception)

                {

                    Console.WriteLine(exception.ToString());

                }

            });

可是我们发现。在运行的过程中,会出现一个错误。

UserProfileApplicationNotAvailableException_Logging :: UserProfileApplicationProxy.ApplicationProperties ProfilePropertyCache does not have b01f37cc-f782-4f02-85a3-62ec01eb113c

 

这个错误。经过各方面的资料查找,终于发现,是由于权限的问题。解决这个错误的方法,例如以下:

接下来,把新增加的帐号。勾选中全然控制.点击确定。

最后我们发现,我们更新的用户信息,已经更新到UserProfile了。

这是关于sharepoint 的userprofile更新数据的程序。

 

 

 

版权声明:本文博主原创文章。博客,未经同意不得转载。

转载于:https://www.cnblogs.com/bhlsheji/p/4829101.html