当前位置: 首页 > news >正文

网站建设报价单初期整理Wordpress500页面

网站建设报价单初期整理,Wordpress500页面,wordpress 10万并发,用dw做的网站怎么上传图片概要 项目需求要求我们每天晚上同步员工的一些信息到sharepoint 的user List #xff0c;我们决定定制开发sharepoint timer Job,Sharepoint timer Job是sharePoint的定时作业Job,需要安装、布曙到服务器上,而这里我只是介绍下Job开发的例子#xff0c;以供大家学习用。 开发…概要    项目需求要求我们每天晚上同步员工的一些信息到sharepoint 的user List 我们决定定制开发sharepoint timer Job,Sharepoint timer Job是sharePoint的定时作业Job,需要安装、布曙到服务器上,而这里我只是介绍下Job开发的例子以供大家学习用。 开发设计 我们需要新建两个类TaskLoggerJob和TaskLoggerFeature,TaskLoggerJob实现这个Job具体做哪些工和TaskLoggerFeature实现安装和卸载这个Job以及定义Job执行时间和方式。 在开发Job时需要引用如下Dll using Microsoft.SharePoint; using Microsoft.SharePoint.Utilities; using Microsoft.SharePoint.Administration; TaskLoggerJob设计代码如下: public class TaskLoggerJob : SPJobDefinition{#region [Fields]#endregion#region [Constructors]/// summary/// Initializes a new instance of the TaskLoggerJob class./// /summarypublic TaskLoggerJob(): base(){}/// summary/// Initializes a new instance of the TaskLoggerJob class./// /summary/// param namejobNameName of the job./param/// param nameserviceThe service./param/// param nameserverThe server./param/// param nametargetTypeType of the target./parampublic TaskLoggerJob(string jobName, SPService service, SPServer server, SPJobLockType targetType): base(jobName, service, server, targetType){}/// summary/// Initializes a new instance of the TaskLoggerJob class./// /summary/// param namejobNameName of the job./param/// param namewebApplicationThe web application./parampublic TaskLoggerJob(string jobName, SPWebApplication webApplication): base(jobName, webApplication, null, SPJobLockType.Job){this.Title Task Logger;}#endregion#region [Public Methods]/// summary/// Executes the specified content db id./// /summary/// param namecontentDbIdThe content db id./parampublic override void Execute(Guid contentDbId){try{// get a reference to the current site collections content databaseSPWebApplication webApplication this.Parent as SPWebApplication;SPContentDatabase contentDb webApplication.ContentDatabases[contentDbId];// get a reference to the Tasks list in the RootWeb of the first site collection in the content databaseSPList taskList contentDb.Sites[0].RootWeb.Lists[Tasks];// create a new task, set the Title to the current day/time, and update the itemSPListItem newTask taskList.Items.Add();newTask[Title] DateTime.Now.ToString();newTask.Update();}catch (Exception ex){LogHepler.LogToShrepointList(ex);}}#endregion#region [Private Methods]#endregion} 在TaskLoggerFeature时我们调用这个构造方法 /// summary/// Initializes a new instance of the TaskLoggerJob class./// /summary/// param namejobNameName of the job./param/// param namewebApplicationThe web application./parampublic TaskLoggerJob(string jobName, SPWebApplication webApplication): base(jobName, webApplication, null, SPJobLockType.Job){this.Title Task Logger;} 来初始化SPJobDefinition方法Job具体要做的事性我们实现这个方法: /// summary/// Executes the specified content db id./// /summary/// param namecontentDbIdThe content db id./parampublic override void Execute(Guid contentDbId){try{// get a reference to the current site collections content databaseSPWebApplication webApplication this.Parent as SPWebApplication;SPContentDatabase contentDb webApplication.ContentDatabases[contentDbId];// get a reference to the Tasks list in the RootWeb of the first site collection in the content databaseSPList taskList contentDb.Sites[0].RootWeb.Lists[Tasks];// create a new task, set the Title to the current day/time, and update the itemSPListItem newTask taskList.Items.Add();newTask[Title] DateTime.Now.ToString();newTask.Update();}catch (Exception ex){LogHepler.LogToShrepointList(ex);}} 在这个方法里我们可以同事实现很多任务而我们这里只是改变了它的title。 下面我们来讲解TaskLoggerFeature的代码设计,首先引用: using Microsoft.SharePoint; using Microsoft.SharePoint.Administration; 而后代码如下 public class TaskLoggerFeature : SPFeatureReceiver{#region [Override Methods]/// summary/// Active the feature/// /summary/// param nameproperties/parampublic override void FeatureActivated(SPFeatureReceiverProperties properties){SPSite site properties.Feature.Parent as SPSite;SPSite currentSite null;try{SPSecurity.RunWithElevatedPrivileges(delegate{currentSite new SPSite(site.Url);});this.InstallTaskLoggerJob(currentSite);}catch (Exception ex){LogHepler.InitConfigListSiteUrl(site.Url);LogHepler.LogToShrepointList(ex);}finally{if (currentSite ! null){currentSite.Dispose();}}}/// summary/// Deactive the feature/// /summary/// param nameproperties/parampublic override void FeatureDeactivating(SPFeatureReceiverProperties properties){SPSite site properties.Feature.Parent as SPSite;SPSite currentSite null;try{SPSecurity.RunWithElevatedPrivileges(delegate{currentSite new SPSite(site.Url);});SPWebApplication webApp currentSite.WebApplication;this.UninstallTaskLoggerJob(webApp);}catch (Exception ex){LogHepler.InitConfigListSiteUrl(site.Url);LogHepler.LogToShrepointList(ex);}finally{if (currentSite ! null){currentSite.Dispose();}}}/// summary/// Method that is executed when the feature end the installation/// /summary/// param nameproperties/parampublic override void FeatureInstalled(SPFeatureReceiverProperties properties){}/// summary/// Method that is executed when the feature is unistalled/// /summary/// param nameproperties/parampublic override void FeatureUninstalling(SPFeatureReceiverProperties properties){}#endregion#region [Private Methods]/// summary/// method to install the job/// /summary/// param nameweb/paramprivate void InstallTaskLoggerJob(SPSite site){TaskLoggerJob jobDef new TaskLoggerJob(TaskLoggerJob, site.WebApplication);jobDef.Title TaskLoggerJob;jobDef.Properties.Add(SiteUrl, site.Url);this.InstallDayJob(jobDef, site, 23);//this.InstallHourJob(jobDef, site, 2);//this.InstallMinuteJob(jobDef, site, 10, 10);}/// summary/// Method to unistall a job/// /summary/// param namewebThe SPWeb where need to remove the job/paramprivate void UninstallTaskLoggerJob(SPWebApplication webApp){try {SPJobDefinitionCollection jobColl webApp.JobDefinitions;if (jobColl ! null){ListGuid idsToRemove new ListGuid();foreach (SPJobDefinition jobDef in jobColl){if (!String.IsNullOrEmpty(jobDef.Title) jobDef.Title.StartsWith(TaskLoggerJob)){idsToRemove.Add(jobDef.Id);}}if (idsToRemove.Count 0){foreach (Guid gd in idsToRemove){jobColl.Remove(gd);}}}}catch (Exception ex){LogHepler.LogToShrepointList(ex);}}/// summary/// Method to install the job that will execute by hour/// /summary/// param namejobDefThe JobDefinition to apply/param/// param namewebThe SPWeb that will execute the job/param/// param nameminuteThe minute to start the job in that hour/paramprivate void InstallDayJob(SPJobDefinition jobDef, SPSite site, int hour){try{SPWebApplication webApp site.WebApplication;SPJobDefinitionCollection jboColl webApp.JobDefinitions;SPDailySchedule daySched new SPDailySchedule();daySched.BeginHour hour;daySched.BeginMinute 0;daySched.BeginSecond 0;daySched.EndHour hour;daySched.EndMinute 0;daySched.EndSecond 0;jobDef.Schedule daySched;SPJobDefinition oldJob this.GetJobDeffinition(jobDef.Title, jboColl);if (oldJob ! null){jboColl.Remove(oldJob.Id);webApp.Update();}jboColl.Add(jobDef);webApp.Update();}catch (Exception ex){LogHepler.LogToShrepointList(ex);}}/// summary/// Method to install the job that will execute by hour/// /summary/// param namejobDefThe JobDefinition to apply/param/// param namewebThe SPWeb that will execute the job/param/// param nameminuteThe minute to start the job in that hour/paramprivate void InstallHourJob(SPJobDefinition jobDef, SPSite site, int minute){try{SPWebApplication webApp site.WebApplication;SPJobDefinitionCollection jboColl webApp.JobDefinitions;SPHourlySchedule hourSched new SPHourlySchedule();hourSched.BeginMinute minute;jobDef.Schedule hourSched;SPJobDefinition oldJob this.GetJobDeffinition(jobDef.Title, jboColl);if (oldJob ! null){jboColl.Remove(oldJob.Id);webApp.Update();}jboColl.Add(jobDef);webApp.Update();}catch (Exception ex){LogHepler.LogToShrepointList(ex);}}/// summary/// Method to install the job that will execute by minute/// /summary/// param namejobDefThe JobDefinition to apply/param/// param namewebThe SPWeb that will execute the job/param/// param namesecoundThe seconds to start the job in that minute/paramprivate void InstallMinuteJob(SPJobDefinition jobDef, SPSite site, int second, int interval){try{SPWebApplication webApp site.WebApplication;SPJobDefinitionCollection jboColl webApp.JobDefinitions;SPMinuteSchedule minSched new SPMinuteSchedule();minSched.Interval interval;minSched.BeginSecond second;jobDef.Schedule minSched;SPJobDefinition oldJob this.GetJobDeffinition(jobDef.Title, jboColl);if (oldJob ! null){jboColl.Remove(oldJob.Id);webApp.Update();}jboColl.Add(jobDef);webApp.Update();}catch (Exception ex){LogHepler.LogToShrepointList(ex);}}/// summary/// Get the JobDefinition to install or remove/// /summary/// param nameTitleTitle of the job/param/// param namejobCollectionThe JobCollection to find the job/param/// returnsJbDefinition that found in this collection/returnsprivate SPJobDefinition GetJobDeffinition(string Title, SPJobDefinitionCollection jobCollection){SPJobDefinition result null;if (jobCollection ! null){foreach (SPJobDefinition job in jobCollection){if (job.Title.Equals(Title)){result job;break;}}}return result;}#endregion} 下面这个方法是激活这个Job的feature,在sharepoint里每一个Job都有一个feature来讲行实现它会生成相应的feature的xml方件: /// summary/// Active the feature/// /summary/// param nameproperties/parampublic override void FeatureActivated(SPFeatureReceiverProperties properties){SPSite site properties.Feature.Parent as SPSite;SPSite currentSite null;try{SPSecurity.RunWithElevatedPrivileges(delegate{currentSite new SPSite(site.Url);});this.InstallTaskLoggerJob(currentSite);}catch (Exception ex){LogHepler.InitConfigListSiteUrl(site.Url);LogHepler.LogToShrepointList(ex);}finally{if (currentSite ! null){currentSite.Dispose();}}}     卸载这个Job的方法如下 /// summary/// Deactive the feature/// /summary/// param nameproperties/parampublic override void FeatureDeactivating(SPFeatureReceiverProperties properties){SPSite site properties.Feature.Parent as SPSite;SPSite currentSite null;try{SPSecurity.RunWithElevatedPrivileges(delegate{currentSite new SPSite(site.Url);});SPWebApplication webApp currentSite.WebApplication;this.UninstallTaskLoggerJob(webApp);}catch (Exception ex){LogHepler.InitConfigListSiteUrl(site.Url);LogHepler.LogToShrepointList(ex);}finally{if (currentSite ! null){currentSite.Dispose();}}}   Job的执行时间可以按分、时、天、月、年来执行可以进行如下定义分、时、天。概据你的需要来执行。 /// summary/// Method to install the job that will execute by hour/// /summary/// param namejobDefThe JobDefinition to apply/param/// param namewebThe SPWeb that will execute the job/param/// param nameminuteThe minute to start the job in that hour/paramprivate void InstallDayJob(SPJobDefinition jobDef, SPSite site, int hour){try{SPWebApplication webApp site.WebApplication;SPJobDefinitionCollection jboColl webApp.JobDefinitions;SPDailySchedule daySched new SPDailySchedule();daySched.BeginHour hour;daySched.BeginMinute 0;daySched.BeginSecond 0;daySched.EndHour hour;daySched.EndMinute 0;daySched.EndSecond 0;jobDef.Schedule daySched;SPJobDefinition oldJob this.GetJobDeffinition(jobDef.Title, jboColl);if (oldJob ! null){jboColl.Remove(oldJob.Id);webApp.Update();}jboColl.Add(jobDef);webApp.Update();}catch (Exception ex){LogHepler.LogToShrepointList(ex);}}/// summary/// Method to install the job that will execute by hour/// /summary/// param namejobDefThe JobDefinition to apply/param/// param namewebThe SPWeb that will execute the job/param/// param nameminuteThe minute to start the job in that hour/paramprivate void InstallHourJob(SPJobDefinition jobDef, SPSite site, int minute){try{SPWebApplication webApp site.WebApplication;SPJobDefinitionCollection jboColl webApp.JobDefinitions;SPHourlySchedule hourSched new SPHourlySchedule();hourSched.BeginMinute minute;jobDef.Schedule hourSched;SPJobDefinition oldJob this.GetJobDeffinition(jobDef.Title, jboColl);if (oldJob ! null){jboColl.Remove(oldJob.Id);webApp.Update();}jboColl.Add(jobDef);webApp.Update();}catch (Exception ex){LogHepler.LogToShrepointList(ex);}}/// summary/// Method to install the job that will execute by minute/// /summary/// param namejobDefThe JobDefinition to apply/param/// param namewebThe SPWeb that will execute the job/param/// param namesecoundThe seconds to start the job in that minute/paramprivate void InstallMinuteJob(SPJobDefinition jobDef, SPSite site, int second, int interval){try{SPWebApplication webApp site.WebApplication;SPJobDefinitionCollection jboColl webApp.JobDefinitions;SPMinuteSchedule minSched new SPMinuteSchedule();minSched.Interval interval;minSched.BeginSecond second;jobDef.Schedule minSched;SPJobDefinition oldJob this.GetJobDeffinition(jobDef.Title, jboColl);if (oldJob ! null){jboColl.Remove(oldJob.Id);webApp.Update();}jboColl.Add(jobDef);webApp.Update();}catch (Exception ex){LogHepler.LogToShrepointList(ex);}}   在完成了上面的代码设计后我们接着就需要把Job布曙到服务器中。 要以上代码生成Windows SharePoint Solution Package (*.WSP) 来布曙。 步骤如下 一、首先进入sharePoint Central administrator v3 管理页面选择Operation下的Solution Management 二、检索TaskLoggerJob.wsp 如果以前安装过这个Job先要卸载再安装。  三、执行命令   stsadm -o addsolution -filename TaskLoggerJob.wsp  添加Job的solution 四、执行命令 stsadm -o deactivatefeature -name TaskLoggerJob -url http://[site]/       而后再执行命令  stsadm -o execadmsvcjobs 五、执行命令 stsadm -o activatefeature -name TaskLoggerJob -url http://[site]/       而后再执行命令  stsadm -o execadmsvcjobs 总结 sharepoint timer job是用来完成系统定里执行的一此任务是由这个进程完成的OWSTIMER.EXE . 作者spring yang 出处http://www.cnblogs.com/springyangwc/ 本文版权归作者和博客园共有欢迎转载但未经作者同意必须保留此段声明且在文章页面明显位置给出原文连接否则保留追究法律责任的权利。转载于:https://www.cnblogs.com/springyangwc/archive/2011/07/25/2115963.html
http://www.zqtcl.cn/news/763814/

相关文章:

  • 怎么做游戏网站google国际版
  • 学校网站建设发展规划线上推广的渠道有哪些
  • 公主岭网站建设seo网站推广技术
  • 网站建设一次crm管理
  • 电商网站设计公司优选亿企邦wordpress管理员头像
  • 医院做网站需要多少钱wordpress 模板 设计
  • 建设网站的规则建设公司网站的原则
  • 专业网站定制 北京龙泉驿网站seo
  • 网站标签是什么网站flash导入页
  • 城市网站建设摘要论文网站建设基本步骤包括哪些
  • 如何做招聘网站分析wordpress状态修改
  • 兰考网站建设微信运营是干嘛的
  • 网站ps照片怎么做的网站开发项目实训报告
  • 做流量网站it建设人才网
  • 杭州拱墅区网站建设推荐定制型网站建设
  • 网站建设需要达到什么样的效果上海营销网站推广多
  • 现代化公司网站建设长沙公司网站建立
  • 网站开发需要哪些人才辽宁奔之流建设工程有限公司网站
  • 做旅游产品的网站有哪些个人做搜索网站违法吗
  • 营销型网站的功能网站制作价钱多少
  • angularjs 网站模板工作感悟及心得
  • 福州 网站定制设计哈尔滨网站建设咨询
  • 酒吧网站模板创办网页
  • 外贸网站建设软件有哪些现在网站建设用什么语言
  • lnmp wordpress 主题不见高级seo课程
  • 成都哪家公司做网站最好杭州软件开发
  • 做网站多少宽带够wordpress编辑文章中图片
  • 无锡网站制作排名软件工程公司
  • 做网站国内好的服务器美食网站建设项目规划书
  • 三亚市住房和城乡建设厅网站江西电信网站备案