The Person Viewer and Person Picker controls were introduced in Visual Studio 2013 to support the Person data type which makes it easy to manage people-related data in your application. These controls depend on various components such as SharePoint, Lync, ActiveX and browser settings in order for them to display properly. Knowing a few simple settings in these components will help you understand how these controls work. This article presents tips and tricks for these controls in a “symptom-diagnosis-treatment” format to help you troubleshoot problems quickly.

For more information on the person type and controls please read: Using the Person Business Type

Symptom 1

Person Picker and Person Viewer controls are not available in the Screen designers. Figure 1 shows a screenshot of the Screen designer where Person Viewer and Picker controls are not available for the Owner field, which is a property of type Person.

clip_image001

Diagnosis

  • You did not enable SharePoint
  • You are using a Silverlight client

Treatment

Person Viewer and Person Picker controls are available in SharePoint enabled apps and only in a LightSwitch HTML client. The Viewer and Picker controls are available after the app is SharePoint enabled:

clip_image002

Symptom 2

Controls never resolve person(s) and appear disconnected from SharePoint. For instance, the Person Picker control doesn’t show any search results as you type:

clip_image003

Or the person viewer shows only the person’s email ID:

clip_image004

Diagnosis

The Cross-domain library is unable to access your SharePoint data.

Treatment

  • Ensure that the hosting SharePoint domain (e.g. microsoft.sharepoint.com) and the app’s domain (e.g. localhost or myapp.azurewebsites.net) are at the same protection level. For example, they can be both unprotected (in the Internet zone) or both protected (in either the Local Intranet or Trusted Sites zones), but not one unprotected and the other protected.
  • In case of Autohosted apps, add the site where the app is hosted to the Trusted Sites security zone via Internet settings.
  • Ensure that the protocol for the SharePoint site and the app domain is the same. If the SharePoint site is http, then the app can only run as http. Similarly if the SharePoint site is https, then the app should run as https.
  • Finally, if you are accessing the app from a mobile device then make sure to turn off the Mobile Browser View feature in the hosting SharePoint site. The app makes a call to the hosting SharePoint site on behalf of the controls. Currently there is a SharePoint limitation that prevents this communication in Mobile Browser View.

clip_image005

Symptom 3

Controls resolve person(s), but Lync presence status is non-existent (the UI elements are missing).

clip_image006

Diagnosis

You are using a browser or a device that does not support Lync presence. Only IE desktop, Chrome desktop and Firefox desktop are supported browsers.

Treatment

None. The NameCtrl ActiveX control that provides this behavior only functions in these browsers.

Symptom 4

Controls resolve person(s), but Lync status always shows disconnected (white).

clip_image007

Diagnosis

Issue could be in one of the dependent components - Lync, browser, ActiveX, or Internet settings.

Treatment

  • Make sure Lync 2013 Desktop Client is running and you are logged into Lync using the same credentials used to log into the app
  • Add the app domain (e.g. localhost or myapp.azurewebsites.net) or the Autohosted site to Trusted Sites security zone via Internet settings.
  • Make sure NameCtrl ActiveX is enabled for the browser. This can be achieved as follows:
    1. Tap or click the Tools button, and then tap or click Manage add-ons.
    2. Under Show, tap or click All add-ons.
    3. Tap or click NameCtrl Class, tap or click Enable, and then tap or click Close.
    4. Restart the app. If the ActiveX is still not enabled then check if the browser process is running as 32-bit. NameCtrl ActiveX works only in 32-bit browsers. To check if the browser is running as 32-bit process, open Task Manager and locate the browser process under Image Name column. Internet Explorer process is named iexplore.exe. A *32 suffix indicates the process is running as 32-bit. You can launch a 32-bit Internet Explorer from %SystemDrive%\Program Files (x86)\Internet Explorer\iexplore.exe.

clip_image009

Symptom 5

Controls work, but the My Site link is missing and/or Lync presence is not always correct.

Diagnosis

The chosen person is not a direct member of the hosting SharePoint site or an indirect member that has visited the SharePoint site. An indirect member is a user who is a member of a group that was granted access to the SharePoint site.

Treatment

Add the person explicitly as a member of the hosting SharePoint site. In case the person is indirectly a member of the hosting SharePoint site through a group that is a member of the hosting SharePoint site then that person should visit the SharePoint site at least once before using an app hosted on that site.

Symptom 6

Controls work with the My Site link and correct Lync presence, but the picture is missing.

image

Diagnosis

There simply isn’t a picture available.

Treatment

Check your profile at My Site to confirm if a picture exists. Also note that a profile picture from Active Directory does not get imported to an On-Premises SharePoint server. You need to manually upload a picture to your profile.

Symptom 7

Almost everything works great, only the picture is out of sync with the Lync contact card.

Diagnosis

Change or confirm your Lync picture.

Treatment

None. It might take some time before the new picture appears in Lync. When everything is set up correctly the controls will display properly showing the name, picture and title for each person type.

clip_image011

Wrap Up

We hope you find these tips useful. In case you encounter any issues not discussed above then please post a question on the forums. We will be glad to help you troubleshoot there.

Nicole Haugen, Lead Software Engineer, Cloud Business Apps

Ravi Eda, Software Development Engineer in Test, Cloud Business Apps