Reputation: 5
I am passing a DataLakeStoreFileSystemManagementClient instance, named _adlsFileSystemClient
, to a powershell script, and from there I wish to do the following.
_adlsFileSystemClient.FileSystem.Open(_adlsAccountName, filePath))
The following is my Powershell Script
param([System.Object]$dlsFSMC)
Add-Type -Path C:\Users\..\source\repos\tester\packages\Microsoft.Azure.Management.DataLake.Store.2.4.0-preview\lib\net452\Microsoft.Azure.Management.DataLake.Store.dll"
$strm = $dlsFSMC.FileSystem.Open(<name>,<path>)
Where name and path I have actual string values in those places. I get an error message as follows.
Method invocation failed because [Microsoft.Azure.Management.DataLake.Store.FileSystemOperations] does not contain a method named 'Open'.
I am confused why I'm getting the above error when _adlsFileSystemClient.FileSystem.Open(_adlsAccountName, filePath))
works perfectly fine in Visual Studio.
Upvotes: 0
Views: 75
Reputation: 127543
Open
is a extension method, to call it you would need to call the static function and pass in the object.
param([System.Object]$dlsFSMC)
Add-Type -Path C:\Users\..\source\repos\tester\packages\Microsoft.Azure.Management.DataLake.Store.2.4.0-preview\lib\net452\Microsoft.Azure.Management.DataLake.Store.dll"
$strm = [Microsoft.Azure.Management.DataLake.Store.FileSystemOperationsExtensions]::Open($dlsFSMC.FileSystem, <name>,<path>)
Upvotes: 3