I am iterating over users of the same domain and all of the users are assigned the same profile.


There are around 50 profile fields but for some users, this method returns only few. Like for some users it just returns 8, for some 32. ..

Why does this happen.

When I check the User Manager, all those users have all those fields. They are empty but even filling them did not change the result.

Should something else be done to read all available profile fields.

using sc8.0 u5

  • can you try with user.Profile.RuntimeSettings.Properties[propertyName] ? Jun 21, 2017 at 7:22

2 Answers 2


Because a Security Profile Item in "core" is not a Schema

And you're going about it wrong.

To reach the "schema" for a user

If you want to read all available fields defined for your user, you will have to refer to the definition you have defined for your user, which would be the Sitecore Security Profile. And essentially it would involve reading it and looping through the defined fields. But the Security Profile item in "core" really shouldn't be your guide here; instead YOU define what properties should be shown for any user and go from there.

To read properties for a user

For the user itself, you will only ever get profile fields and values that have been set on that specific user. Changing the Security Profile definition in "core" does nothing to update your existing users - it is simply there to give Sitecore a basic UI for user editing. For convenience.

As a side note; the fact that it is stored in "core" should give this away. "Core" is the Sitecore database from which the Sitecore UI runs - nothing else.


Underneath the Sitecore Profile Provider lies a completely standard ASP.NET Profile Provider. In a very simplified form, GetPropertyValues for a user is done by executing the dbo.aspnet_Profile_GetProperties Stored Procedure, and then splitting the key/value pairs on :.

      connectionHolder = SqlConnectionHelper.GetConnection(this._sqlConnectionString, true);
      SqlCommand sqlCommand = new SqlCommand("dbo.aspnet_Profile_GetProperties", connectionHolder.Connection);
      sqlCommand.CommandTimeout = this.CommandTimeout;
      sqlCommand.CommandType = CommandType.StoredProcedure;
      sqlCommand.Parameters.Add(this.CreateInputParam("@ApplicationName", SqlDbType.NVarChar, (object) this.ApplicationName));
      sqlCommand.Parameters.Add(this.CreateInputParam("@UserName", SqlDbType.NVarChar, (object) userName));
      sqlCommand.Parameters.Add(this.CreateInputParam("@CurrentTimeUtc", SqlDbType.DateTime, (object) DateTime.UtcNow));
      sqlDataReader = sqlCommand.ExecuteReader(CommandBehavior.SingleRow);
      if (sqlDataReader.Read())
        names = sqlDataReader.GetString(0).Split(':');
        values = sqlDataReader.GetString(1);
        int bytes = (int) sqlDataReader.GetBytes(2, 0L, (byte[]) null, 0, 0);
        numArray = new byte[bytes];
        sqlDataReader.GetBytes(2, 0L, numArray, 0, bytes);

Notice how this code makes no references to any User Profile "definition" of sorts. At this level; profile attributes are just treated as key/value pairs.


Can you try with user.Profile.GetCustomProperty("Property")?

And for saving the profile values - you need to add user.Profile.Save();

You can refer these articles: http://blog.nikkipunjabi.com/2015/08/how-to-store-custom-user-profile.html

  • 4
    Please note that you need to disclose that it's your own blog your linking to: How not to be a spammer.
    – Glorfindel
    Jun 21, 2017 at 8:20
  • If it's not your blog, I'd put that in the answer to prevent spam flags
    – CalvT
    Jun 21, 2017 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.