Operation not supported during connection to client.

here is my code

Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Await Task.Run(Sub()

Try
' Initialize M-Files client
Dim mfApp As New MFilesClientApplication()
Dim vaultConnection As VaultConnection = mfApp.GetVaultConnection("Doc Vault")
Dim vault As Vault = Nothing

' Check if already logged in
If vaultConnection.IsLoggedIn Then
' Use existing session
vault = vaultConnection.BindToVault(IntPtr.Zero, False, False)
Else
' Log in as user (only if not already logged in)
vaultConnection.LogInAsUser(4207, "Vc@Re@202@", "domain")
vault = vaultConnection.BindToVault(IntPtr.Zero, False, False)
End If

' Prepare search: get all document objects
Dim searchConditions As New SearchConditions()
Dim sc As New SearchCondition()
sc.ConditionType = MFConditionType.MFConditionTypeEqual
sc.Expression.DataPropertyValuePropertyDef = MFBuiltInPropertyDef.MFBuiltInPropertyDefClass
sc.TypedValue.SetValue(MFDataType.MFDatatypeLookup, 0) ' Document object type
searchConditions.Add(-1, sc)

Dim results As ObjectSearchResults =
vault.ObjectSearchOperations.SearchForObjectsByConditions(
searchConditions,
MFSearchFlags.MFSearchFlagNone,
False
)

' Ensure local folder exists
Dim exportRoot As String = "C:\MFiles_Export"
If Not Directory.Exists(exportRoot) Then
Directory.CreateDirectory(exportRoot)
End If

' Loop through all search results
For Each res In results
' Get full object properties
Dim objFull As ObjectVersionAndProperties = vault.ObjectOperations.GetObjectVersionAndProperties(res.ObjVer)

' Document title (for folder naming)
Dim title As String = "Untitled"
Dim propName = objFull.Properties.SearchForProperty(MFBuiltInPropertyDef.MFBuiltInPropertyDefNameOrTitle)
If propName IsNot Nothing Then
title = propName.TypedValue.DisplayValue
End If

' Clean folder name
title = String.Join("_", title.Split(Path.GetInvalidFileNameChars()))
Dim docFolder As String = Path.Combine(exportRoot, title)
Directory.CreateDirectory(docFolder)

' Get files attached to document
Dim objFiles As ObjectFiles = vault.ObjectFileOperations.GetFiles(objFull.ObjVer)

For i As Integer = 1 To objFiles.Count
Dim file As ObjectFile = objFiles.Item(i)

Dim targetPath As String = Path.Combine(docFolder, file.Title)
Dim fileID As Integer = file.ID
Dim fileVersionNumber As Integer = file.Version

' DOWNLOAD FILE
vault.ObjectFileOperations.DownloadFile(fileID, fileVersionNumber, targetPath)
Next
Next

' Notify UI
Me.Invoke(Sub()
TextBox1.AppendText("Done downloading all files." & Environment.NewLine)
End Sub)

Catch ex As Exception
Me.Invoke(Sub()
MessageBox.Show("Error: " & ex.Message)
End Sub)
End Try
End Sub)
End Sub

the error comes up here "vault.ObjectFileOperations.DownloadFile(fileID, fileVersionNumber, targetPath)"
I am using COM API on Visual studio desktop app, runing from the M-file server, AD was used for authentication and I logged In using one of the users that have access on M-files and can also access the M-File server. that is why I used vault = vaultConnection.BindToVault(IntPtr.Zero, False, False) because it always see the use as logged In at this point vaultConnection.LogInAsUser(120760, "Vc@Re@20255!!", "Crusader").

What I am doing wrong, Please assist