internal static Dictionary <string, object> GetInternalUserFields(ApiUser user) { var fields = new Dictionary <string, object> { { "Bio", user.Bio() } }; try { foreach (var property in UserProperties.Values) { if (property.Name == "ProfileFields") { continue; } var fieldName = property.Name.Replace(" ", string.Empty); fields.Add(fieldName, property.GetValue(user, null)); } if (user.ProfileFields == null) { throw new Exception(string.Format("The 'ProfileFields' property is null for user {0}. Please verify __CommunityServer__Service__ contains the Administrators role.", user.Id)); } foreach (var field in user.ProfileFields) { var fieldName = field.Label.Replace(" ", string.Empty); if (!fields.ContainsKey(fieldName)) { fields.Add(fieldName, field.Value); } } } catch (Exception ex) { SPLog.UserNotFound(ex, ex.Message); } return(fields); }