Search Wiki:
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));

}
Last edited Mar 4 2009 at 12:31 AM  by jennyxu, version 7
Comments
KryptiqDevDude wrote  Mar 5 2009 at 7:39 PM  
Awesome feature. I'm getting the following exception:
[Microsoft.Health.HealthServiceAccessDeniedException] : "The application does not have permission to call the specified method."

Is there a specific application permission required for this feature?

VaibhavB_MSFT wrote  Mar 5 2009 at 11:49 PM  
hi there -

Please refere to http://social.msdn.microsoft.com/Forums/en-US/healthvault/thread/5faa91af-d51b-40bb-8501-fce2e2b5a1fc

Appending it here:

The method "GetAuthorizedPeople" is part of our method group x-BaseMethods. I think that you had an application configured with individiual methods (this is was the case with applications registered Pre-October 08). If you go to the application configuration center's method tab (http://conig.healthvault-ppe.com) and update your application method (just by hitting submit and without changing any check marks), your application will have the x-BaseMethods group (it corresponds to the first item greyed item "Basic Set"). Please note: changes to application configuration take up to 30 minutes.

We also updated our Hello World application to have these methods. Here is the sample which would work with HelloWorld (please note - dont use HelloWorld for this, as it has a tonne of use and the GetAuthorizedPeople method attempts to get them..and hence takes a long time).

KryptiqDevDude wrote  Mar 5 2009 at 11:56 PM  
Yes, now it works. Thanks VaibhavB!

Updating...
Page view tracker