Reputation: 507
To get a file, the Method looks like this:
$ftprequest.Method = [System.Net.WebRequestMethods+Ftp]::DownloadFile
So, I am trying to change the Method to be equivalent to the C# code below:
request.Method = System.Net.WebRequestMethods.Ftp.GetDateTimestamp;
How can I use GetDateTimestamp in powershell?
I have tried the following variations without any luck yet:
$ftprequest.Method = [System.Net.WebRequestMethods+Ftp.GetDateTimestamp]
$ftprequest.Method = [System.Net.WebRequestMethods+Ftp+GetDateTimestamp]
$ftprequest.Method = [System.Net.WebRequestMethods.Ftp.GetDateTimestamp]
$ftprequest.Method = [System.Net.WebRequestMethods.Ftp+GetDateTimestamp]
bonus question: what is the :: mean on the first code example mean?
Thanks!
Upvotes: 2
Views: 1635
Reputation: 26424
This seems to work:
$ftprequest.Method = [System.Net.WebRequestMethods+Ftp]::GetDateTimestamp
::
is to access shared/static members, which GetDateTimeStamp
is.
Upvotes: 1