vs 创建WSS 3.0 web部件

使用Visual Studio 2005 开发字定义 Share point webpart
开发环境 : .netFramework 2.0/3.0/3.5 + Vs2005 + sharepoint server 2007
需要下面两个组件中任意一个组件
Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions

Windows SharePoint Services 3.0 工具:Visual Studio 2005 Extensions 1.1 版
前者组件为英文版,使用HtmlWriter 直接输入Webpart,而后者为中文版且可以封装了Asp.net控件,通过这两组件创建的,此文按照后者为例说明

     WSS 类库项目部署时(F5)完成了以下操作:(组件安装后由Vs部署自动完成)

l 生成Web Part组件

l 将Web Part解决方案打包成Windows SharePoint Services Feature。

l 如果这个Web Part解决方案以前部署过,扩展将取消以前版本的Web Part解决方案的Feature。

l 将Web Part组件安装到GAC中。

l 在Windows SharePoint Services部署并激活Web Part解决方案Feature。

l 将Web Part加入到SafeControls列表中。

l 调用iisreset命令重新启动Microsoft Internet Information Services (IIS)。

l 将调试附加到w3wp进程上。

当然若没有这两个组建也可以开发WSS 3.0 webpart ,这里就不详细说明了,参考
手动部署MOSS 2007 WebPart


开发环境配置好后
        首先创建Share point project 
        
        
        该项目中 *.webpart 可以修改webpart 相关说明信息
              
<?xml version="1.0" encoding="utf-8"?>
<webParts>
  
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
    
<metaData>
      
<!--
      The following Guid 
is used as a reference to the web part class, 
      and it will be automatically replaced with actual type name at deployment time.
      
-->
      
<type name="0d45bc2f-cc02-4e13-acda-384444e9a564" />
      
<importErrorMessage>(c)不能导入ChangePwdWebpart部件。</importErrorMessage>
    
</metaData>
    
<data>
      
<properties>
        
<property name="Title" type="string">Title说明</property>
        
<property name="Description" type="string">描述信息</property>
      
</properties>
    
</data>
  
</webPart>
</webParts>


        若是英文版的组件修改webpart信息 通过项目属性中的 SharePoint Solution 修改
        

        

重写入口

        
        创建好你的webpart 后 ,部署项目


部署和调试Web Part

1.按F5。扩展将自动生成、部署、初始化Web Part解决方案Feature调试。

2.打开在SharePoint站点中想要添加Web Part的Web部件页面。

3.在Web部件页上点击网站操作,选择编辑页面。

4.在向要添加Web Part的Web Part Zone中添加Web Part。

5.在弹出的添加Web部件页面中,在所有Web部件部分中的杂项中找到我们的Web Part,单击确定。

        
     其他资源

应该可以使用类似*ascx(UserControl)方式来实现WSS webpart 但一直没有做好,有兴趣的可以参考一下UserControl to WSS webpart


Microsoft Windows SharePoint Services Developer Center

15Second webpart
posted @ 2008-07-07 11:05  flat_peach  阅读(413)  评论(0)    收藏  举报