Upload
sparked
View
1.351
Download
0
Embed Size (px)
DESCRIPTION
This presentation was given by Mart Muller of Wizzix as part of the Sparked Toolkit Session: SharePoint Nightmares. It discusses the problems that Mart has found when it comes to non-SharePoint deployment, and ofcourse, his solution to the challenges he faced.
Citation preview
CASE Application built on WSS 3.0 Besides SharePoint elements deployment
(lists, content types, etc), … … also non-SharePoint elements, like
A custom SQL Database Backup scheduling custom database Specific IIS settings (MIME Type) IIS virtual directory
(SOME) REQUIREMENTS 1-click remote site deployment (fully
automated) Multiple web applications per server Admin users must be able to backup their
own site & (custom) database Remote updates to custom database
DEPLOYMENT LEVELS Level 1: Native SharePoint Elements Level 2: Custom Code in SharePoint Farm (Level 3: Exotic SharePoint Classes) Level 4: Everything outside SharePoint
Farm
LEVEL 1: NATIVE SHAREPOINT ELEMENTS
Deploy native SharePoint elements
Solution for deployment Features Assemblies Resources
SharePoint provides installation and deployment of solutions
LEVEL 2: CUSTOM CODE IN FARM
Execute custom code using features and the SPFeatureReceiver class
scope = within the SharePoint farm!
public class MyFeatureReceiver: SPFeatureReceiver{
public override void FeatureActivated(SPFeatureReceiverProperties properties) {
}
public override void FeatureDeactivating(SPFeatureReceiverProperties properties) {
}
public override void FeatureInstalled(SPFeatureReceiverProperties properties) {
}
public override void FeatureUninstalling(SPFeatureReceiverProperties properties) {
}}
LEVEL 3: USE ‘EXOTIC’ CLASSES IN THE SHAREPOINT PLATFORM
Take a deep dive into the SDK! Example: Custom Database
SPDataBase SharePoint provides full deployment of SQL files,
including updates, connectionstrings, etc.
public override void Provision(){
Dictionary<string, bool> options = new Dictionary<string, bool>(1);options.Add(SPDatabase.SqlDatabaseOption[2], false);SPDatabase.Provision(this.DatabaseConnectionString, @"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SQL\custom.sql", options);this.Update();
}
LEVEL 4: OUTSIDE SHAREPOINT SCOPE
LEVEL 4: OUTSIDE SHAREPOINT SCOPE
Code initiated by timerjob Code Console Application Scripting Etc.
// inherit from SPJobDefinition class// override execute methodpublic override void Execute(Guid targetInstanceId){
// Execute test.batSystem.Diagnostics.ProcessStartInfo psi = new
System.Diagnostics.ProcessStartInfo(@"c:\test.bat");System.Diagnostics.Process.Start(psi);
}
SPJobDefinition
// on FeatureActivated, deploy timer jobSPSite site = properties.Feature.Parent as SPSite;// make sure the job isn't already registeredforeach (SPJobDefinition job in site.WebApplication.JobDefinitions){ if (job.Name == CustomTimerJob.TimerJobName) job.Delete();}// install the jobCustomTimerJob custJob = new CustomTimerJob(site.WebApplication);// create scheduleSPOneTimeSchedule schedule = new SPOneTimeSchedule();schedule.Time = DateTime.Now;custJob.Schedule = schedule;custJob.Update();
SPFeatureReceiver
RESOURCESDevelopment Tools and Techniques for Working with Code in Windows SharePoint Services 3.0 (Part 1 of 2)
http://msdn.microsoft.com/en-us/library/bb530302.aspx
Development Tools and Techniques for Working with Code in Windows SharePoint Services 3.0 (Part 2 of 2)
http://msdn.microsoft.com/en-us/library/bb530301.aspx
Creating Custom Timer Jobs in Windows SharePoint Services 3.0
http://msdn.microsoft.com/en-us/library/cc406686.aspx