Resource Page Description
Sample for GetAuthorizedPeople method
The API method GetAuthorizedPeople introduced in HealthVault platform release PB0903 enables applications to be able to retrieve the list of users who have authorized the application and their HealthVault context (stored in the PersonInfo object). Application can then choose to do bulk operations like SendInsecureMessage using the context of these users.
Here are the steps to use this method:
1. Create an application connection
2. Create a GetAuthorizedPeopleSettings Object
3. Different settings, including BatchSize, StartingPersonId, and AuthorizationsCreatedSince can be set.
4. Use the connection to call GetAuthorizedPeople by passing in the GetAuthorizedPeopleSetting Object
Below is a prototype sample:
public void GetAuthorizedPeopleSetBatchSize()
{
Int32 numResults = 1;
Guid appId = new Guid("9ca84d74-1473-471d-940f-2699cb7198df");
// Create an application connection
WebApplicationCredential cred = new
WebApplicationCredential(appId);
AuthenticatedConnection conn = new AuthenticatedConnection(cred);
// Create a GetAuthorizedPeopleSettings Object
GetAuthorizedPeopleSettings settings = new
GetAuthorizedPeopleSettings();
// Set BatchSize
settings.BatchSize = numResults;
// This will return the list of PersonInfo for the users that
// authorized records with the application
List<PersonInfo> resultPersonInfos =
new List<PersonInfo>(conn.GetAuthorizedPeople(settings));
}