我想使用 Office365 Graph API,为此我正在使用 Powershell,但是 Connect-Graph cmdlet 会抛出错误
I want to use Office365 Graph APIs, In order to do so I am using Powershell, However Connect-Graph cmdlet throws error
我想使用现代身份验证连接到 Office365 环境,因此我将不得不使用 Graph API 服务。
我已经安装了同样需要的 powershell 模块。在我的 Windows Powershell ISE Connect-Graph 中,可通过智能感知获得,这意味着模块已成功安装。
然而,当我运行使用 Connect-Graph 命令时,它会导致错误:
Connect-Graph : Could not load file or assembly 'System.Net.Http, Version=4.1.1.2,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system
cannot find the file specified.
At line:1 char:1
+ Connect-Graph
+ ~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-Graph], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.Graph.PowerShell.Aut
hentication.Cmdlets.ConnectGraph
它似乎想要 System.Net.Http 版本 4.1.1.2 的文件,但找不到。我只是在猜测错误。
当我 运行 这个命令 Add-Type -AssemblyName System.Net.Http
它成功 运行 这意味着文件存在可能不是正确的版本,但是我找不到当前版本的程序集验证这一点。
如有任何帮助,我们将不胜感激。
因为我也有 ps 5.1 并且没有问题 运行 connect-graph,我只能假设您可能没有安装正确的 .net 框架版本。确保安装了正确的 .net 框架版本,也许尝试安装最新的 4.8 框架。因为我已经安装了。
我想使用现代身份验证连接到 Office365 环境,因此我将不得不使用 Graph API 服务。
我已经安装了同样需要的 powershell 模块。在我的 Windows Powershell ISE Connect-Graph 中,可通过智能感知获得,这意味着模块已成功安装。
然而,当我运行使用 Connect-Graph 命令时,它会导致错误:
Connect-Graph : Could not load file or assembly 'System.Net.Http, Version=4.1.1.2,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system
cannot find the file specified.
At line:1 char:1
+ Connect-Graph
+ ~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-Graph], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.Graph.PowerShell.Aut
hentication.Cmdlets.ConnectGraph
它似乎想要 System.Net.Http 版本 4.1.1.2 的文件,但找不到。我只是在猜测错误。
当我 运行 这个命令 Add-Type -AssemblyName System.Net.Http
它成功 运行 这意味着文件存在可能不是正确的版本,但是我找不到当前版本的程序集验证这一点。
如有任何帮助,我们将不胜感激。
因为我也有 ps 5.1 并且没有问题 运行 connect-graph,我只能假设您可能没有安装正确的 .net 框架版本。确保安装了正确的 .net 框架版本,也许尝试安装最新的 4.8 框架。因为我已经安装了。