locked
URGENT: OFFLINE ACCESS NOT WORKING RRS feed

  • Question

  • Hi, In my offline web app I have a webservice which is called with the correct personid and recordid for the method below. No exception is generated while the following executes - but the allergies are not getting retrieved. Any ideas what I might be missing here ?

    List<Alergy> IHVService.GetAlergies(string personID, string recordID)
        {
            Guid personId = new Guid(personID.Trim());
            Guid recordGuid = new Guid(recordID.Trim());

            // Do the offline connection
            OfflineWebApplicationConnection offlineConn =
                new OfflineWebApplicationConnection(personId);
            offlineConn.Authenticate();
            HealthRecordAccessor accessor =
                new HealthRecordAccessor(offlineConn, recordGuid);

            // Get offline records
            HealthRecordSearcher searcher = accessor.CreateSearcher();
            HealthRecordFilter filter = new HealthRecordFilter(Allergy.TypeId); 
            searcher.Filters.Add(filter);
            HealthRecordItemCollection items = searcher.GetMatchingItems()[0];
            List<Alergy> AlergyList= new List<Alergy>();
            if (items != null && items.Count > 0)
            {
                foreach (HealthRecordItem item in items)
                {
                    Allergy a = (Allergy)item;
                    Alergy al = new Alergy();
                    al.AllergenType = a.TypeName;
                    al.Name = a.Name.Text;
                    al.Reaction = a.Reaction.Text;
                    al.Observed = new DateTime(a.FirstObserved.ApproximateDate.Year, a.FirstObserved.ApproximateDate.Month.HasValue?a.FirstObserved.ApproximateDate.Month.Value:0, a.FirstObserved.ApproximateDate.Day.HasValue?a.FirstObserved.ApproximateDate.Day.Value:0);
                    al.Note = a.CommonData.Note;
                    AlergyList.Add(al);
                }
            }
            return AlergyList;
        }

    web.config

    <appSettings>
            <add key="ApplicationId" value="37f55bd1-c5dc-4401-8aec-fe0d1b850c42"/>
            <add key="ShellUrl" value="https://account.healthvault-ppe.com/"/>
            <add key="HealthServiceUrl" value="https://platform.healthvault-ppe.com/platform/"/>
            <!-- when we call the SignOut() method on HealthServicePage, it redirects us to the page below -->
            <add key="NonProductionActionUrlRedirectOverride" value="Redirect.aspx"/>
            <!-- The redirect page (specified above) uses these keys below to redirect to different
             pages based on the response from the shell -->
            <add key="WCPage_ActionHome" value="default.aspx"/>
            <add key="WCPage_ActionAppAuthSuccess" value="GoOffline.aspx"/>
            <add key="WCPage_ActionSignOut" value="SignedOut.aspx"/>

    <add key="ApplicationCertificateFileName" value="C:\inetpub\hvcert.pfx" />
    <add key="ApplicationCertificatePassword" value="pass@word1" />
        </appSettings>

    Also, The similar trials from a HealthServicePage with PersonInfo object and using GetValues<T> also gives 0 records.

    TIA.

    M

    Sunday, July 25, 2010 9:51 AM

Answers

  • Hi,

    Please edit your application's configuration (https://config.healthvault-ppe.com/EditOfflineRules.aspx?appid=37f55bd1-c5dc-4401-8aec-fe0d1b850c42) for Offline rule to include Allergy datatype. Currently it has only Height Measurement.

    Thank you,


    Anish Ravindran
    Sunday, July 25, 2010 4:50 PM
  • Hello Malyaban,

    The application ID which you are using is OfflineAccess sample Application ID,  You can not edit this Application configuration. For security reasons the sample application IDs don't have permission to make offline requests. You need to create your own application ID for offline access by using the this url .

    Once you created a new application ID, You need to set up rules to allow access for both online and offline modes.

    Open the Config center

    1, Click on the new application created by you.
    2, Go to the OnLineAccess tab, Add Rule and give all permissions.
    3, Go to the OfflineAccess tab, Add Rule and give all permissions.

    Then run the offlineAccess application in online mode, authorize a record to that application, and then the application saves the record id and person id and associates it with that user. The record and app id are per-application.  By using the PersonId and RecordId you should be able to create an offline connection and access that record.  

    You can use this sample code after getting PersonId and recordId.

    Please let me know if you have any issues.

    Regards,

    Madan Kamuju

     

     


    • Proposed as answer by Madan kamuju Tuesday, July 27, 2010 10:21 AM
    • Marked as answer by Malyaban Das Tuesday, July 27, 2010 10:43 AM
    Tuesday, July 27, 2010 9:52 AM

All replies

  • Hi,

    Please edit your application's configuration (https://config.healthvault-ppe.com/EditOfflineRules.aspx?appid=37f55bd1-c5dc-4401-8aec-fe0d1b850c42) for Offline rule to include Allergy datatype. Currently it has only Height Measurement.

    Thank you,


    Anish Ravindran
    Sunday, July 25, 2010 4:50 PM
  • We couldn't complete your action because

    • The current user is not authorized to view or modify the application configuration.

    I keep getting this even though the app is already granted access and I am the account owner.

    So, Not able to change the configuration right now - any workarounds ? Thanks for the help anyways - since now at least I know what went wrong.

    Tuesday, July 27, 2010 9:10 AM
  • Hello Malyaban,

    The application ID which you are using is OfflineAccess sample Application ID,  You can not edit this Application configuration. For security reasons the sample application IDs don't have permission to make offline requests. You need to create your own application ID for offline access by using the this url .

    Once you created a new application ID, You need to set up rules to allow access for both online and offline modes.

    Open the Config center

    1, Click on the new application created by you.
    2, Go to the OnLineAccess tab, Add Rule and give all permissions.
    3, Go to the OfflineAccess tab, Add Rule and give all permissions.

    Then run the offlineAccess application in online mode, authorize a record to that application, and then the application saves the record id and person id and associates it with that user. The record and app id are per-application.  By using the PersonId and RecordId you should be able to create an offline connection and access that record.  

    You can use this sample code after getting PersonId and recordId.

    Please let me know if you have any issues.

    Regards,

    Madan Kamuju

     

     


    • Proposed as answer by Madan kamuju Tuesday, July 27, 2010 10:21 AM
    • Marked as answer by Malyaban Das Tuesday, July 27, 2010 10:43 AM
    Tuesday, July 27, 2010 9:52 AM
  • Thanks to both of you - everything is perfect now.

    Cheers.

    Malyaban

    Tuesday, July 27, 2010 10:44 AM