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部署自动完成)

生成Web Part组件

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

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

Web Part组件安装到GAC中。

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

Web Part加入到SafeControls列表中。

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

将调试附加到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 修改
        

        

重写入口
        protected override void CreateChildControls()
        
{
            
base.CreateChildControls();

                
//这里创建你的webpart内容 与正常*.asp.cs 类似
                   this.Controls.Add(Control);//Control 可以为服务器端控件
                
//若想使用脚本 可以用 Respone.Write 、Page对象注册脚本块
                
//Page.RegisterStartupScript
             }

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


部署和调试Web Part

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

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

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

4.在向要添加Web PartWeb 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

转载于:https://www.cnblogs.com/flat_peach/archive/2008/07/07/1237328.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值