找不到类型[Microsoft.SharePoint.SPSite]:验证是否已加载包含此类型的程序集. [英] Cannot find type [Microsoft.SharePoint.SPSite]: verify that the assembly containing this type is loaded.

查看:204
本文介绍了找不到类型[Microsoft.SharePoint.SPSite]:验证是否已加载包含此类型的程序集.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于moss 2007的远程设备,在其中必须执行Powershell脚本.

I have a remote box for moss 2007 where i have to execute a powershell script.

从主机上,我已经加载了一个带有top语句为

From the host machine, i have loaded a script with a top statement as 

[void] [System.Reflection.Assembly] :: LoadWithPartialName("Microsoft.SharePoint")

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

但是,我在脚本中遇到以下错误:

However, i am getting below error in the script:

新对象:找不到类型[Microsoft.SharePoint.SPSite]:验证是否已加载包含此类型的程序集.

new-object : Cannot find type [Microsoft.SharePoint.SPSite]: verify that the assembly containing this type is loaded.

是因为我必须安装Microsoft.SharePoint dll.

Is it because i have to install Microsoft.SharePoint dll.

如果我加载了dll,是否可以远程访问计算机.

If i load the dll, is it possible to access the machine remotely.

我如何远程访问机器并执行脚本,因为包装盒中未安装Powershell,并且我不想通过安装Powershell并将其重新启动来影响系统.

How do i remotely access the machine and execute the script as the box does not have the powershell installed and i dont want to impact the system by installing powershell and restarting it as its live.

我从哪个位置下载microsoft.sharepoint dll.

From which location do i download the microsoft.sharepoint dll.

推荐答案

hiexplorIT,

Hi exploreIT,

当远程框未加载适当的SharePoint DLL(Microsoft.SharePoint.DLL)以便调用API时,可能会发生错误.

The error might be occurred when remote box has not loaded the appropriate SharePoint DLL (Microsoft.SharePoint.DLL) in order to call the API.

尝试使用以下命令手动加载DLL:

Try to use the command as below to manually load DLL:

[void] [System.reflection.Assembly] :: Load("Microsoft.SharePoint,版本= 12.0.0.0,Culture =中性,PublicKeyToken = 71e9bce111e9429c")

[void][System.reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")

要执行脚本,使用PowerShell是一种最佳且可用的方法,或者您可以使用其他工具来实现您的请求,以下是类似的帖子供您参考:

To execute the script, using PowerShell is a best and available method, or you can use another tool to achieve your request, here is a similar post for your reference:

http://stackoverflow.com/questions/482314/run-powershell-scripts -without-installing-powershell

最诚挚的问候,

Grace Wang


这篇关于找不到类型[Microsoft.SharePoint.SPSite]:验证是否已加载包含此类型的程序集.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆