zoukankan      html  css  js  c++  java
  • 深入浅出SharePoint——TimeJob编程

     获取SPWeb实例

    方式一 if deployed on farm,we can get spweb by time job title

    A define site url in feature template.xml as property,and access it in FeatureActivated event

    string url = properties.Feature.Properties[activeSiteUrl].Value;

    ……

    job.Title = displayName + "(" + url.ToLower().Trim() + ")";

    B Access spweb by title which contains the site url

    string webUrl = Title.Substring(Title.IndexOf("(") + 1).Replace(")", "");

    using (SPSite site = new SPSite(webUrl))

    方式二  if deployed on web,we can get spweb by feature parent

    SPSite currentSite = properties.Feature.Parent as SPSite;

    部署:

    如果不是第一次部署,一定要重新启动TimerJob服务,新版本的TimerJob应用才会生效。

  • 相关阅读:
    连通块问题
    线性数据结构
    NOIP2018总结
    原码反码补码详解
    一些常用的算法技巧总结
    骗分导论
    模板
    模板
    AcWing
    AcWing
  • 原文地址:https://www.cnblogs.com/mingle/p/2308206.html
Copyright © 2011-2022 走看看