博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Inside SharePoint 2010 (3): Developing a SharePoint Solution (Class Library Project)
阅读量:6956 次
发布时间:2019-06-27

本文共 2482 字,大约阅读时间需要 8 分钟。

#1, Create solution structure

 

 

#2:  feature.xml

<
Feature
Id
="86689158-7048-4421-AD21-E0DEF0D67C81"
Title
="Wingtip Lead Tracker"
Description
="A sample feature deployed using LocalhostDevProject1.wsp"
Version
="1.0.0.0"
Scope
="Web"
Hidden
="FALSE"
 
ReceiverAssembly
="LocalhostDevProject1, [four-part assembly name, use refector to get]"
 
ReceiverClass
="LocalhostDevProject1.FeatureReceiver"
ImageUrl
="LocalhostDevProject1/FeatureIcon.gif"
xmlns
="http://schemas.microsoft.com/sharepoint/"
 
>
  
<
ElementManifests
>
    
<
ElementManifest 
Location
="elements.xml"
/>
  
</
ElementManifests
>
</
Feature
>

 

 

 #3, elements.xml

<
Elements 
xmlns
="http://schemas.microsoft.com/sharepoint/"
>
  
<
ListInstance 
    
FeatureId
="00BFEA71-7E6D-4186-9BA8-C047AC750105"
 
    TemplateType
="105"
 
    Id
="SalesLeads"
 
    Title
="Sales Leads"
 
    Url
="SalsLeads"
 
    OnQuickLaunch
="true"
/>
</
Elements
>

 

 #4, FeatureReceiver.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace LocalhostDevProject1
{
    public class FeatureReceiver : SPFeatureReceiver
    {
        public override void FeatureActivated(SPFeatureReceiverProperties props)
        {
            SPWeb site = props.Feature.Parent as SPWeb;
            if (site != null) {
                site.Title = "Feature Activated";
                site.SiteLogoUrl = @"_layouts/images/LocalhostDevProject1/SiteIcon.gif";
                site.Update();
            }
        }
        public override void FeatureDeactivating(SPFeatureReceiverProperties props)
        {
            SPWeb site = props.Feature.Parent as SPWeb;
            if (site != null)
            {
                site.Title = "Feature Deactivated";
                site.SiteLogoUrl = "";
                site.Update();
                SPList list = site.Lists.TryGetList("Sales Leads");
                if (list != null)
                {
                    list.Delete();
                }
            }
        }
    }
}

 

 #5, manifest.xml

<
Solution 
xmlns
="http://schemas.microsoft.com/sharepoint/"
          SolutionId
="0cee8f44-4892-4a01-b8f4-b07aa21e1ef2"
          Title
="Localhost Dev Project 1"
 
          DeploymentServerType
="WebFrontEnd"
 
          ResetWebServer
="true"
>
  
<
FeatureManifests
>
    
<
FeatureManifest 
Location
="LocalhostDevProject1\feature.xml"
/>
  
</
FeatureManifests
>
  
<
TemplateFiles
>
    
<
TemplateFile 
Location
="IMAGES\LocalhostDevProject1\FeatureIcon.gif"
/>
    
<
TemplateFile 
Location
="IMAGES\LocalhostDevProject1\SiteIcon.gif"
/>
  
</
TemplateFiles
>
  
<
Assemblies
>
    
<
Assembly 
Location
="LocalhostDevProject1.dll"
 DeploymentTarget
="GlobalAssemblyCache"
/>
  
</
Assemblies
>
  
<
ActivationDependencies
>
    
<
ActivationDependency 
SolutionId
=""
 SolutionName
=""
/>
  
</
ActivationDependencies
>
</
Solution
>

 

 

 

 

转载于:https://www.cnblogs.com/thlzhf/archive/2012/11/13/2769009.html

你可能感兴趣的文章
Oracle awr报告生成操作步骤
查看>>
【DB2】DB2使用IMPORT命令导入含有自增长列的表报错处理
查看>>
微服务之springCloud-docker-comsumer(三)
查看>>
dhcpcd守护进程分析【转】
查看>>
Linux - 理不清的权限chmod与chown区别
查看>>
TCP协议疑难杂症全景解析
查看>>
redis 1
查看>>
Python安装pycurl失败,及解决办法
查看>>
cocos2d的常用动作及效果总结之四:Special Actions
查看>>
[ lucene扩展 ] MoreLikeThis 相似检索
查看>>
如果返回结构体类型变量(named return value optimisation,NRVO)
查看>>
C# 多线程详解 Part.02(UI 线程和子线程的互动、ProgressBar 的异步调用)
查看>>
基于shiro授权过程
查看>>
JQuery对象和DOM对象的区别与转换
查看>>
使用 Toad 实现 SQL 优化
查看>>
.NET开发技巧——从Winform穿越到WPF
查看>>
2135亿背后的双11项目协作怎么玩?
查看>>
DRDS SQL 审计与分析——全面洞察 SQL 之利器
查看>>
微信小程序:模板消息推送实现
查看>>
CodePush自定义更新弹框及下载进度条
查看>>