protected RelativityFile GetFile(int fileFieldArtifactId, int ourFileContainerInstanceArtifactId) { using (IRSAPIClient proxyToWorkspace = CreateProxy()) { try { var fileRequest = new FileRequest(proxyToWorkspace.APIOptions); fileRequest.Target.FieldId = fileFieldArtifactId; fileRequest.Target.ObjectArtifactId = ourFileContainerInstanceArtifactId; RelativityFile returnValue; var fileData = invokeWithRetryService.InvokeWithRetry(() => proxyToWorkspace.Download(fileRequest)); using (MemoryStream ms = (MemoryStream)fileData.Value) { FileValue fileValue = new FileValue(null, ms.ToArray()); FileMetadata fileMetadata = fileData.Key.Metadata; returnValue = new RelativityFile(fileFieldArtifactId, fileValue, fileMetadata); } return(returnValue); } catch (Exception ex) { throw new ProxyOperationFailedException("Failed in method: " + System.Reflection.MethodInfo.GetCurrentMethod(), ex); } } }