문제

My user profiles have some custom properties. Now I need to get a list of all values that this custom property has on any user. This code return an error that "Column 'Division' does not exist. It may have been deleted by another user".

Is this the right approach? There is many users and possible many distinct values.

 SPListItemCollection userInformationList = SPContext.Current.Web.SiteUserInfoList.Items;
  var divisions= (from SPListItem userItem in userInformationList.Items where userItem["Division"] != null select userItem["Division"]); 
도움이 되었습니까?

해결책

Check the GetUserProfile from UserProfileManager. You get the whole object, should be the right spot to search for a list of all custom properties..

i'm working on an almost simliar webpart.. im trying to display only a couple of custom properties..

hope to help

http://msdn.microsoft.com/en-us/library/microsoft.office.server.userprofiles.userprofilemanager.aspx

다른 팁

First of all never ever use LINQ in this way in SharePoint! You will retrieve the full user information list from the database when hitting the .Items property! Instead use a CAML query to "search" for the users using the SPQuery object.

I would recommend that you use the U2U CAML Query builder to build your query - using that tool you will get the correct columns and column name.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top