internal override HealthServiceRequest CreateRequest( string methodName, int methodVersion, bool forAuthentication) { Validator.ThrowIfStringNullOrEmpty(methodName, "methodName"); HealthServiceRequest request = new HealthServiceRequest( this, methodName, methodVersion); return request; }
internal override HealthServiceRequest CreateRequest( string methodName, int methodVersion, bool forAuthentication) { Validator.ThrowIfStringNullOrEmpty(methodName, "methodName"); HealthServiceRequest request = new HealthServiceRequest( this, methodName, methodVersion); if (IsImpersonating) { request.ImpersonatedPersonId = _targetPersonId; } return request; }
protected override void ProcessRecord() { HealthClientApplication clientApp = HvShellUtilities.GetClient(); List<PersonInfo> authorizedPeople = new List<PersonInfo> (clientApp.ApplicationConnection.GetAuthorizedPeople()); // Create an authorized connection for each person on the // list. HealthClientAuthorizedConnection authConnection = clientApp.CreateAuthorizedConnection( authorizedPeople[0].PersonId); // Use the authorized connection to read the user's default // health record. HealthRecordAccessor accessor = new HealthRecordAccessor( authConnection, authConnection.GetPersonInfo().GetSelfRecord().Id); HealthServiceRequest request = new HealthServiceRequest(accessor.Connection, "PutThings", 2, accessor); // Read the input file request.Parameters = System.IO.File.ReadAllText(Path.GetFullPath(FileName)); request.Execute(); }
/// <summary> /// Calls the BeginPutBlob HealthVault method. /// </summary> /// /// <returns> /// The result of the BeginPutConnectPackageBlob method call as a /// BlobPutParameters instance. /// </returns> /// /// <exception cref="HealthServiceException"> /// If the call to HealthVault fails in some way. /// </exception> /// private BlobPutParameters BeginPutConnectPackageBlob() { HealthServiceRequest request = new HealthServiceRequest(_connectPackageParameters.Connection, "BeginPutConnectPackageBlob", 1); request.Execute(); XPathExpression infoPath = SDKHelper.GetInfoXPathExpressionForMethod( request.Response.InfoNavigator, "BeginPutConnectPackageBlob"); XPathNavigator infoNav = request.Response.InfoNavigator.SelectSingleNode(infoPath); Uri blobReferenceUrl = new Uri(infoNav.SelectSingleNode("blob-ref-url").Value); int chunkSize = infoNav.SelectSingleNode("blob-pre-encryption-chunk-size").ValueAsInt; int postEncryptionChunkSize = infoNav.SelectSingleNode("blob-post-encryption-chunk-size").ValueAsInt; long maxBlobSize = infoNav.SelectSingleNode("max-blob-size").ValueAsLong; String blobHashAlgString = infoNav.SelectSingleNode("blob-hash-algorithm").Value; BlobHashAlgorithm blobHashAlg; try { blobHashAlg = (BlobHashAlgorithm)Enum.Parse( typeof(BlobHashAlgorithm), blobHashAlgString); } catch (ArgumentException) { blobHashAlg = BlobHashAlgorithm.Unknown; } int blocksize = 0; XPathNavigator blockNav = infoNav.SelectSingleNode("blob-hash-parameters/block-size"); if (blockNav != null) { blocksize = blockNav.ValueAsInt; } return new BlobPutParameters( blobReferenceUrl, chunkSize, postEncryptionChunkSize, maxBlobSize, blobHashAlg, blocksize); }