EDMI: Fix DoctypeId Parameter
This commit is contained in:
@@ -28,47 +28,32 @@ Namespace Modules.Globix
|
||||
Throw New FileNotFoundException("Path does not exist")
|
||||
End If
|
||||
|
||||
Dim oFileInfo As New FileInfo(pFilePath)
|
||||
Dim oExtension As String = oFileInfo.Extension
|
||||
|
||||
Dim oFileName As String = oFileInfo.Name
|
||||
Dim oFileCreatedAt As Date = oFileInfo?.CreationTime
|
||||
Dim oFileModifiedAt As Date = oFileInfo?.LastWriteTime
|
||||
Dim oFileHash As String = FileEx.GetChecksum(oFileInfo.FullName)
|
||||
' Try to load file properties
|
||||
Dim oFileProperties = Helpers.GetFileProperties(pFilePath, pImportOptions.DateImported)
|
||||
If oFileProperties Is Nothing Then
|
||||
Throw New IOException("File could not be read!")
|
||||
End If
|
||||
|
||||
' Importing the file now
|
||||
Using oFileStream As New FileStream(pFilePath, FileMode.Open, FileAccess.Read)
|
||||
Using oMemoryStream As New MemoryStream()
|
||||
oFileStream.CopyTo(oMemoryStream)
|
||||
Dim oContents = oMemoryStream.ToArray()
|
||||
Dim oFileImportResponse = Await Channel.Globix_ImportFileAsync(New Globix_ImportFileRequest With {
|
||||
.IDBDoctypeId = pIDBDoctypeId,
|
||||
.File = oFileProperties,
|
||||
.KindType = pObjectKind,
|
||||
.StoreName = pObjectStoreName,
|
||||
.User = New UserState() With {
|
||||
.UserName = pImportOptions.Username,
|
||||
.Language = pImportOptions.Language
|
||||
},
|
||||
.ProfileId = pProfileId,
|
||||
.AttributeValues = pAttributeValues.ToArray
|
||||
})
|
||||
|
||||
Dim oFileImportResponse = Await Channel.Globix_ImportFileAsync(New Globix_ImportFileRequest With {
|
||||
.IDBDoctypeId = pIDBDoctypeId,
|
||||
.File = New FileProperties With {
|
||||
.FileName = oFileInfo.Name,
|
||||
.FileCreatedAt = oFileCreatedAt,
|
||||
.FileChangedAt = oFileModifiedAt,
|
||||
.FileContents = oContents,
|
||||
.FileImportedAt = pImportOptions.DateImported,
|
||||
.FileChecksum = oFileHash,
|
||||
.FileInfoRaw = oFileInfo
|
||||
},
|
||||
.KindType = pObjectKind,
|
||||
.StoreName = pObjectStoreName,
|
||||
.User = New UserState() With {
|
||||
.UserName = pImportOptions.Username,
|
||||
.Language = pImportOptions.Language
|
||||
},
|
||||
.ProfileId = pProfileId,
|
||||
.AttributeValues = pAttributeValues.ToArray
|
||||
})
|
||||
Return oFileImportResponse
|
||||
|
||||
Return oFileImportResponse
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@@ -27,47 +27,32 @@ Namespace Modules.IDB
|
||||
Throw New FileNotFoundException("Path does not exist")
|
||||
End If
|
||||
|
||||
Dim oFileInfo As New FileInfo(pFilePath)
|
||||
Dim oExtension As String = oFileInfo.Extension
|
||||
|
||||
Dim oFileName As String = oFileInfo.Name
|
||||
Dim oFileCreatedAt As Date = oFileInfo?.CreationTime
|
||||
Dim oFileModifiedAt As Date = oFileInfo?.LastWriteTime
|
||||
Dim oFileHash As String = FileEx.GetChecksum(oFileInfo.FullName)
|
||||
' Try to load file properties
|
||||
Dim oFileProperties = Helpers.GetFileProperties(pFilePath, pImportOptions.DateImported)
|
||||
If oFileProperties Is Nothing Then
|
||||
Throw New IOException("File could not be read!")
|
||||
End If
|
||||
|
||||
' Importing the file now
|
||||
Using oFileStream As New FileStream(pFilePath, FileMode.Open, FileAccess.Read)
|
||||
Using oMemoryStream As New MemoryStream()
|
||||
oFileStream.CopyTo(oMemoryStream)
|
||||
Dim oContents = oMemoryStream.ToArray()
|
||||
Dim oFileImportResponse = Await Channel.ImportFileAsync(New ImportFileRequest With {
|
||||
.IDBDoctypeId = pIDBDoctypeId,
|
||||
.File = oFileProperties,
|
||||
.KindType = pObjectKind,
|
||||
.StoreName = pObjectStoreName,
|
||||
.User = New UserState() With {
|
||||
.UserName = pImportOptions.Username,
|
||||
.Language = pImportOptions.Language
|
||||
},
|
||||
.ProfileId = -1,
|
||||
.AttributeValues = pAttributeValues.ToArray
|
||||
})
|
||||
|
||||
Dim oFileImportResponse = Await Channel.ImportFileAsync(New ImportFileRequest With {
|
||||
.IDBDoctypeId = pIDBDoctypeId,
|
||||
.File = New FileProperties With {
|
||||
.FileName = oFileInfo.Name,
|
||||
.FileCreatedAt = oFileCreatedAt,
|
||||
.FileChangedAt = oFileModifiedAt,
|
||||
.FileContents = oContents,
|
||||
.FileImportedAt = pImportOptions.DateImported,
|
||||
.FileChecksum = oFileHash,
|
||||
.FileInfoRaw = oFileInfo
|
||||
},
|
||||
.KindType = pObjectKind,
|
||||
.StoreName = pObjectStoreName,
|
||||
.User = New UserState() With {
|
||||
.UserName = pImportOptions.Username,
|
||||
.Language = pImportOptions.Language
|
||||
},
|
||||
.ProfileId = -1,
|
||||
.AttributeValues = pAttributeValues.ToArray
|
||||
})
|
||||
Return oFileImportResponse
|
||||
|
||||
Return oFileImportResponse
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user