Vb.net का उपयोग करके एक बार सभी के द्वारा हस्ताक्षरित फ़ाइलें कैसे डाउनलोड करें। मैं टेम्पलेट आईडी के साथ लिफाफा भेजने के लिए तैयार हूं। इसलिए मैं लिफाफा आईडी का उपयोग करके उस फ़ाइल को वापस प्राप्त करना चाहता हूं, कृपया vb.net का उपयोग कर फ़ाइलों को पुनर्प्राप्त करने के लिए कुछ नमूना कोड प्रदान करें।
यहां कोड जो मैंने vb.net में उपयोग किया था
Private Function DoWnload(ByVal accessToken As String, ByVal basePath As String, ByVal accountId As String, ByVal envelopeId As String, ByVal documents As List(Of EnvelopeDocItem), ByVal docSelect As String) As String
Dim config = New Configuration(New ApiClient(basePath))
config.AddDefaultHeader("Authorization", "Bearer " & accessToken)
Dim envelopesApi As EnvelopesApi = New EnvelopesApi(config)
Dim results As System.IO.Stream = envelopesApi.GetDocument(accountId, envelopeId, docSelect)
Dim docItem As EnvelopeDocItem = documents.FirstOrDefault(Function(d) docSelect.Equals(d.DocumentId))
Dim docName As String = docItem.Name
Dim hasPDFsuffix As Boolean = docName.ToUpper().EndsWith(".PDF")
Dim pdfFile As Boolean = hasPDFsuffix
Dim docType As String = docItem.Type
If ("content".Equals(docType) OrElse "summary".Equals(docType)) AndAlso Not hasPDFsuffix Then
docName += ".pdf"
pdfFile = True
End If
If "zip".Equals(docType) Then
docName += ".zip"
End If
Dim mimetype As String
If pdfFile Then
mimetype = "application/pdf"
ElseIf "zip".Equals(docType) Then
mimetype = "application/zip"
Else
mimetype = "application/octet-stream"
End If
''Dim f1 As FileStream = New FileStream("sample.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite)
' Return File(results, mimetype, docName)
Dim bytesRead As Integer
Dim buffer(4096) As Byte
Using outFile As New System.IO.FileStream("C:\File.pdf", IO.FileMode.Create, IO.FileAccess.Write)
Do
bytesRead = results.Read(buffer, 0, buffer.Length)
If bytesRead > 0 Then
outFile.Write(buffer, 0, bytesRead)
End If
Loop While bytesRead > 0
End Using
Return ""
End Function
Dim envelopeDocItems As List(Of EnvelopeDocItem) = New List(Of EnvelopeDocItem) From {
New EnvelopeDocItem With {
.Name = "Combined",
.Type = "content",
.DocumentId = "combined"
},
New EnvelopeDocItem With {
.Name = "Zip archive",
.Type = "zip",
.DocumentId = "archive"
}
उस दस्तावेज़ में चुनें कि क्या पास करना है? मैंने डॉक्यूमेटिड पास किया, त्रुटि हो रही है।
सादर, अरविंद
1 उत्तर
Private Function DoWork(ByVal accessToken As String, ByVal basePath As String, ByVal accountId As String, ByVal envelopeId As String, ByVal documents As List(Of EnvelopeDocItem), ByVal docSelect As String) As FileStreamResult
Dim config = New Configuration(New ApiClient(basePath))
config.AddDefaultHeader("Authorization", "Bearer " & accessToken)
Dim envelopesApi As EnvelopesApi = New EnvelopesApi(config)
Dim results As System.IO.Stream = envelopesApi.GetDocument(accountId, envelopeId, docSelect)
Dim docItem As EnvelopeDocItem = documents.FirstOrDefault(Function(d) docSelect.Equals(d.DocumentId))
Dim docName As String = docItem.Name
Dim hasPDFsuffix As Boolean = docName.ToUpper().EndsWith(".PDF")
Dim pdfFile As Boolean = hasPDFsuffix
Dim docType As String = docItem.Type
If ("content".Equals(docType) OrElse "summary".Equals(docType)) AndAlso Not hasPDFsuffix Then
docName += ".pdf"
pdfFile = True
End If
If "zip".Equals(docType) Then
docName += ".zip"
End If
Dim mimetype As String
If pdfFile Then
mimetype = "application/pdf"
ElseIf "zip".Equals(docType) Then
mimetype = "application/zip"
Else
mimetype = "application/octet-stream"
End If
Return File(results, mimetype, docName)
End Function
आपको यहां से नगेट प्राप्त करना होगा - https://www.nuget.org /packages/DocuSign.eSign.dll/ लेकिन संस्करण 5.0.0 उपरोक्त कोड के साथ काम नहीं करेगा, संस्करण 4.3 का उपयोग करें
अद्यतन: इस अतिरिक्त वर्ग को जोड़ना:
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Namespace Models
Public Class EnvelopeDocItem
Public Property Name As String
Public Property Type As String
Public Property DocumentId As String
End Class
End Namespace
संबंधित सवाल
नए सवाल
vb.net
Visual Basic.NET (VB.NET) एक बहु-प्रतिमान, प्रबंधित, प्रकार-सुरक्षित, ऑब्जेक्ट-उन्मुख कंप्यूटर प्रोग्रामिंग भाषा है। C # और F # के साथ, यह .NET फ्रेमवर्क को लक्षित करने वाली मुख्य भाषाओं में से एक है। VB.NET को Microsoft के Visual Basic 6 (VB6) के विकास के रूप में देखा जा सकता है लेकिन Microsoft .NET फ्रेमवर्क पर लागू किया जा सकता है। VB6, VBA या VBScript प्रश्नों के लिए इस टैग का उपयोग न करें।