我正在尝试使用 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)
# ...
我需要添加哪些额外代码才能使其正常工作?