代码之家  ›  专栏  ›  技术社区  ›  Nat

如何编程设置SharePoint的网站集搜索中心属性?

  •  3
  • Nat  · 技术社区  · 16 年前

    我有一个网站集,我想将搜索中心值设置为与另一个网站集相同。网站集是用代码创建的,因此我需要能够在创建网站集之后设置属性。

    我怎么能用程序来做这个?

    1 回复  |  直到 12 年前
        1
  •  7
  •   Lars Fastrup    16 年前

    此设置存储在SPWeb对象的属性包中。您可以更新如下:

    using (SPSite site = new SPSite("http://server/site"))
    using (SPWeb web = site.OpenWeb())
    {
      web.AllProperties["SRCH_ENH_FTR_URL"] = "/searchcenter/pages";
      web.Update();
    }