当前位置:主页 > Office办公 > SharePoint学习笔记

SharePoint学习笔记

Sharepoint 如何定位网站集所在的w3wp进程
Sharepoint 如何定位网站集所在的w3wp进程

我们在调试WebPart或者EventHandler之类的自定义组件时会遇到如何定位部署的网站集所对应的w3wp.exe进程的问题,方法如下 :方法1.直接开始运行,输入cmd,再输入iisapp可以列出当前所有IIS中的WebApplication所对应的w3wp.exe进程,后面都有一个进程号标识,在VS中调试的时候附加到对应进程号的w3wp就对了,这样就不用在那么多w3wp中一个一个试。方法2.每次挂接的时候选择所有的w3wp进程,此法有点暴力。方法3.针对Windows 2008 系统,由于不再支持iisapp.vbs,所以可以使用 %windir%\system32\inetsrv\appcmd.exe list wp 来代替上述功能。至于 appcmd的具体知识,请参见此文

265 次浏览
Sharepoint 如何解决Reference web service in Sharepoint出错
Sharepoint 如何解决Reference web service in Sharepoint出错

当我们在VS或网页中引用Sharepoint 网站的Web service时,可能会遇到如下报错 The document at the url http://server:port/_vti_bin/UserGroup.asmx was not recognized as a known document type. The error message from each known type may help you fix the problem: - Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=utf-8').'. - Report from 'http://server:port/_vti_bin/UserGroup.asmx' is 'The document format is not recognized (the content type is 'text/html; charset=utf-8').'. - Report from 'DISCO Document' is 'There was an error downloading http://server:port/_vti_bin/UserGroup.asmx?disco'.'.   - The request failed with HTTP status 404: Not Found. - Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=utf-8').'. Metadata contains a reference that cannot be resolved: 'http://server:port/_vti_bin/UserGroup.asmx'. Metadata contains a reference that cannot be resolved: 'http://server:port/_vti_bin/UserGroup.asmx'. If the service is defined in the current solution, try building the solution and adding the service reference again. 那么可以从以下几个方面来试着解决此问题 1.在你的URL后面键入 ?wsdl   如:(http://server:port/_vti_bin/UserGroup.asmx?wsdl) 2.点击service description如下图   3.url地址应指向为Central Admin site而不是你创建的 site collection。如此也可解决 例如我们有如下web Applications 1. Sharepoint Central Administration v4 port:-110  http://server:110/_vti_bin/UserGroup.asmx 2. sharepoint port:-80   http://server:80/_vti_bin/UserGroup.asmx 3. sharepoint port:-220   http://server:220/_vti_bin/UserGroup.asmx 那么就把url指向http://server:110/_vti_bin/UserGroup.asmx,而不是其它两个你自己创建的site collection4.找到正确的url地址。 如果你键入的url有错,你也会遇到此问题, 例如:如果 http://moss2010:810/sites/YourSite/_vti_bin/list.asmx 是你的webservice真正所在的的url地址 而你却引用 http://moss2010:810/YourSite/_vti_bin/lists.asmx (removed the folder sites) ,如此虽然还是可以产生asmx page 但是却无法产生disco或 wsdl文件。 你会得到 404报错或类似错误 Report from 'DISCO Document' is 'There was an error downloading 'http://server:port/_vti_bin/list.asmx?disco'.'.   - The request failed with HTTP status 404: Not Found.

271 次浏览
Sharepoint 如何在系统Path中添加STSADM的快速引用(Add STSADM in path)
Sharepoint 如何在系统Path中添加STSADM的快速引用(Add STSADM in path)

注意,不能忘记;号,因为Path变量中不同的路径值之间要用;号隔

265 次浏览
Sharepoint 如何把网站集从Testing服务器移动到Production服务器(相同的Farm)
Sharepoint 如何把网站集从Testing服务器移动到Production服务器(相同的Farm)

如果你想要把你的Sharepoint网站集从测试服务器移动到生产服务器上,根据网上的资料,有多种方式可以实现,这里我测试了使用STSADM的方式进行移动(此方式微软好像不太推荐,尤其是在跨Farm进行移动时会存在问题,不过此处我们只是在同一Farm的不同服务器上操作,所以问题不大,实际上,我们提到“移动Moving”,应该是在同一Farm的环境下操作,如果是跨不同的Farm操作,准确的用语应该是 Migration/Updating)。下面直接描述操作步骤。 步骤一、使用STSADM Command备份Testing服务器上的Website Collection用此命令前,可以参考我的另一篇笔记(harepoint学习笔记-- 如何在系统Path中添加STSADM的快速引用(Add STSADM in path)))备份时使用的STSADM Command如下: Stsadm –o backup –url http://<server name>:<port> -filename <path\name to be used for the backup file>Example: tsadm –o backup –url http://sharepoint2010:6666 –filename "e:\backup6666.bak"述命名中: http://sharepoint2010:6666 就是你想要备份的Website Collection,如果备份操作顺利完成,就会显示 “Operation Completed Successfully”有直接使 用此命令,而是在Testing 服务器的C:\下创建了一个批处理文件(BackupMySP2010.BAT),代码内容如下: 复制代码

261 次浏览
Sharepoint 如何使用 Stsadm Installing或 Uninstalling features
Sharepoint 如何使用 Stsadm Installing或 Uninstalling features

一.安装部署Feature   在使用Stsadm命令前,可以参考此文章Sharepoint学习笔记-- 如何在系统Path中添加STSADM的快速引用(Add STSADM in path)  以下是操作步骤:    1.把Wsp文件拷贝到你要部署的服务器指定目录下eg: D:\ Sp2010\Wsp\Myfeature.wsp    2.以Administrator方式进入命令提示窗口 command line (Run -> cmd )     3.添加 solution:     stsadm -o addsolution -filename {PATH\WSPFILENAME}    ( eg. stsadm -o addsolution -filename D:\ Sp2010\Wsp\Myfeature.wsp)     4.部署solution:    stsadm -o deploysolution -name {WSPFILENAME} -url {SITEURL} –allowgacdeployment -immediate     ( eg. stsadm -o deploysolution –name Myfeature.wsp -url http://myserver-Sp1:2010  –allowgacdeployment –immediate )

272 次浏览
如何让Sharepoint2010网站返回详细错误信息
如何让Sharepoint2010网站返回详细错误信息

通常默认的情况下,Sharepoint网站如果发生错误,它会先将错误信息写入日志,然后给用户返回Generic error(普通错误信息),而此类概要信息这对我们程序人员和维护人员就不够用了,如何让网站返回真实的明细错误信息呢,我们就需要对网站的Webconfig文件做如下修改: 1. SharePoint节-->SafeMode--->@CallStack attribute to true. 2. System.Web节-->CustomErrors-->@Mode attribute to Off. 3. System.Web节Compilation-->Debug mode to true. 作了上述三处修改后,你就即可以使用attach to W3WP.exe并让你的code 跑在debug mode,也能够看到真实的明细错误信息了,需要注意的是你不能在你的生产环境中做这种修改。

255 次浏览
Sharepoint 关于Element.xml中Ghostable与GhostableInLibrary属性设置
Sharepoint 关于Element.xml中Ghostable与GhostableInLibrary属性设置

你可能在处理Sharepoint的element manifest file时会遇到File节中的Type属性的设置,此属性有两个可选项:Ghostable与GhostableInLibrary。 如果你不设置它,则默认的会为"Unghostable"。此属性的设置到底是什么意思呢?  一、Ghostable与GhostableInLibrary:     当你设置了它们时,此File就会在WFE(Web Front End服务器(WFE))的Cache中驻留,虽然都是驻留,但在处理方式上有差异     1、如果你设置的值为GhostableInLibrary,则此File会被作为特定的List的Item来对待,所谓特定的List是指此List的Base Type是Document Library,所谓的对待方式就是你可以Check-in, Check-out,Version history等等Document Library List的Item应该具有的操作方式。     2、而如果你设置的值为Ghostable,则此File只会被作为普通的List Item来对待。          而Cache的工作方式是,例如:你修改了Sharepoin某个页面的内容,Sharepoint要做的事情就是把修改前后发生变化的那部分及时保存到database中,下次再显示此页面时,就会把cache在WFE Memory中的原页面内容与从database中取出的变化部分进行整合,从而创建出修改后的页面内容然后呈现到客户端。      你可以做一个测试,在Sharepiont网站中创建一个Custom List,此List不继承自Document Library,然后创建一个Item级的Feature,在其Element.xml中采用GhostableInLibrary设置,把此Feature 部署到你创建的Custom List中,你会发现在此Custom List中Items中你找不到你刚才部署的Feature,原因很简单,因为此Custom List不是Document Library类型的List,而其Item Feature的部署又采取的是针对 Documenty Library List类型的部署方式,所以就此产生了所谓的"Ghost" Item。如果把刚才创建的Feature修改为Ghostable方式,重新部署,你就会在你的Custom List中找到你部署的Feature了。  二、而如果你不设置Type值,则其工作方式就是"Unghostable"    即:此File不再Cache在WFE的Memory中,而是全部保存到database中,下次要呈现时,就全部从database中去取出来。

262 次浏览
如何找到SharePoint List的Template ID
如何找到SharePoint List的Template ID

我们可以利用Visual Studio2010结合owssvr.dll来找到我们指定的Sharepoint List所使用的Template的ID值。   OWSSVR.DLL实际上是一个在IIS中注册了的ISAPI extension, 它的方法可以直接通过对/_vti_bin/owssvr.dll的Http访问来调用. 许多Office应用程序(Word, Excel, InfoPath, SharePoint Designer等)就是通过对OWSSRV进行直接的http调用才完成于SharePoint服务器之间的远程整合,而此处我们则要用到它来实现寻找Template ID的目的。   具体步骤如下(我们以确定某个WebPart Gallery的List的Template ID为例):   一、使用Visual Studio2010确定List 的ID 在Visual Studio的Server explorer,新添加一个SharePoint connection,令此连接指向你的Sharepoint网站,eg   http://sp2010/.此Server explorer会给你显示出这个Sharepoint Farm的全部结构。虽然其内容是只读的,但对我们而言已足够了。在此结构内,找到我们需要的Sharepoint List(此处是一个Webpart Gallery),显示出它的Properties,在右侧的属性栏,找到ID的值(eg:9f7d064f-d9s8-62f1-8a4f-b02c9f4c259k),Copy下来备用。   二、使用OWSSVR.DLL确定Template 的ID   根据前面取得的List ID,使用OWSSVR来取得其Template的ID,方法是:打开IE,在URL中输入下如下地址(还记得上面Copy的ID吧,把它放在地址的最后面):owssvr.dll http://sp2010/_vti_bin/owssvr.dll?Cmd=ExportList&List=9f7d064f-d9s8-62f1-8a4f-b02c9f4c259k 这样,你会取到一个 XML文档,在此文档中你就可以找到你想要的东西了。(如下面XML内容的红色部分) List Name="{9f7d064f-d9s8-62f1-8a4f-b02c9f4c259k}" Title="Web Part Gallery" Description="Use this Web Part Gallery to store and retrieve Web Parts. The Web Parts in this gallery are available to this site and all sites under it. To preview a Web Part, click its title." Direction="0" BaseType="1" ServerTemplate="113" Url="_catalogs/wp" HiddenList="TRUE" DisableAttachments="TRUE" FolderCreation="FALSE" AlwaysIncludeContent="TRUE" RootWebOnly="TRUE" Catalog="TRUE" AllowDeletion="FALSE" BrowserFileHandling="permissive" NoCrawl="TRUE" Version="1"> - <MetaData> - <Views> + <View Name="{283335B7-DE62-4316-B3EF-14A46B17BF0F}" DefaultView="TRUE" Type="HTML" DisplayName="All Web Parts" Url="_catalogs/wp/Forms/AllItems.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ToolbarTemplate="WebPartGalleryViewToolBar" ImageUrl="/_layouts/images/wlicon.png">

276 次浏览
Sharepoint  Debug&TroubleShooting 如何在Windows 2008中部署dll到GAC
Sharepoint Debug&TroubleShooting 如何在Windows 2008中部署dll到GAC

 开发 SharePoint 2010 时候发现部署GAC不成功,经查资料,发现Windows Server 2008中的GAC路径有所变化,如果采用直接拖拽的方式,则会出现"Access is Denied"提示。 有以下两种方式解决在Windows Server2008下部署DLL到GAC问题1.使用 gacutil.exe,操作步骤如下  1.1 首先需要下载Windows SDK 6.1 (Free from Microsoft – Download).       注意:在安装Windows SDK时,你只需要选择 .Net Development Tools一项           1.2 以Administrator方式打开Command Prompt命令窗口    1.3 输入如下命令    64 bit        32 bit 2. Disable User Account Control(关闭UAC)  因为会影响到系统的安全配置,降低系统的安全级别,所以一般不推荐使用此方式。如果使用此方法,就是修改完UAC后,必须重启服务器,然后才能重新部署程序集(部署时仍然可以采用拖拽的方式来部署dll文件到GAC中),具体操作可以采用以下方式:   2.1 关闭UAC,重启系统。   2.2 创建一个快捷方式,目标为:%SystemRoot%explorer.exe C:Windowsssembly,接着以管理员的身份运行这个快捷方式,此时便可对GAC进行操作。如果需要部署程序集到GAC中,则使用相同的方式,创建一个快捷方式,目标为:%SystemRoot%explorer.exe 目标dll文件的路径(如:D:in),此时便可以以直接将程序集拖拽到GAC的方式部署程序集

290 次浏览