UserManager.GetList throws Must declare the scalar variable "@p1"

  • Updated

This article describes the error that can occur with the UserManager.GetList when working with custom properties.

MustDeclareScalar.PNG

This issue has been resolved in 9.2 SP1 CU 18 as seen here

9.2 SP1 Site Update

WARNING: Back up your database before installing any software patch.

Site Update 17 (October 20, 2017)

  • EKTR-288: Querying UserManager.GetList with custom properties would throw an error the second time it was used.


It can be downloaded here.  There are instructions here.

The legacy User API can be a workaround until the official fix is installed.  The sample code is below.

    protected void uxSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            Ektron.Cms.API.User.User userAPI = new Ektron.Cms.API.User.User();
            Ektron.Cms.UserData[] userList = userAPI.GetAllUserByCustomProperty(Ektron.Cms.Common.EkEnumeration.ObjectPropertyValueTypes.Numeric, uxUserProperty.SelectedValue);

            List UserList = userList.ToList();

            uxUserlistView.Visible = true;
            uxUserlistView.DataSource = UserList;
            uxUserlistView.DataBind();
        }
        catch (Exception ex)
        {
           
        }

    }