Error when using UserProfileFields In-Process API

Former Member
Former Member

I am getting a run-time error  with this line in my widget extension:

IUserProfileFields iu = Apis.Get<IUserProfileFields>();

A screenshot of the error message is shown below:

Here's the full widget extension method:

        public IList<ProfileFieldTypeChoice> LookupLocations(string s)
        {
            IUserProfileFields iu = Apis.Get<IUserProfileFields>();
            UserProfileField u = iu.Get("Locations");
            List<ProfileFieldTypeChoice> p = u.FieldTypeChoices.Where(o => o.Label.ToLower().StartsWith(s.ToLower())).OrderBy(o => o.Label).ToList();
            return p;
        }