我正在使用PowerShell为Microsoft Translator应用程序获取访问令牌,但在此过程中某些命令因错误而失败:
Unable to find type [System.Web.HttpUtility]
在收到这个错误之前,我将代码从这个 MSDN 页面复制粘贴到 PowerShell ISE 中,并用我的实际凭据替换了占位符值:
# ...
$ClientID = '<Your Value Here From Registered Application>'
$client_Secret = ‘<Your Registered Application client_secret>'
# If ClientId or Client_Secret has special characters, UrlEncode before sending request
$clientIDEncoded = [System.Web.HttpUtility]::UrlEncode($ClientID)
$client_SecretEncoded = [System.Web.HttpUtility]::UrlEncode($client_Secret)
# ...
为使此功能正常运行,我需要添加哪些额外的代码?