SPFieldUserValueCollection afterAttendees=new SPFieldUserValueCollection(web, properties.AfterProperties["Attendees"].ToString());
to get a single user use foreach with SPFieldUserValue
SPRoleDefinition roleDefinitionRead = spWeb.RoleDefinitions.GetByType(SPRoleType.Reader); spList.DoesUserHavePermissions(user, roleDefinitionRead.BasePermissions);
UserProfileManager profileManager = new UserProfileManager(serviceContext);
long ProfileCount = profileManager.Count;SPSite siteColl = SPContext.Current.Site;
try{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite ElevatedsiteColl = new SPSite(siteColl.ID))
{
SPServiceContext serviceContext = SPServiceContext.GetContext(ElevatedsiteColl);
UserProfileManager profileManager = new UserProfileManager(serviceContext);
ProfileCount = profileManager.Count;
}
});
}
catch (Exception ex)
{
LogException(ex);
}SPSite siteColl = SPContext.Current.Site;
HttpContext tempCtx = HttpContext.Current;
try
{
SPSecurity.RunWithElevatedPrivileges(delegate() {
using (SPSite ElevatedsiteColl = new SPSite(siteColl.ID))
{
SPServiceContext serviceContext = SPServiceContext.GetContext(ElevatedsiteColl);
HttpContext.Current = null;
UserProfileManager profileManager = new UserProfileManager(serviceContext);
ProfileCount = profileManager.Count;} });
}
catch (Exception ex){ LogException(ex);}
finally{ HttpContext.Current = tempCtx;}