2016-03-15 70 views
0

的SharePoint 2013爲什麼'Update`方法啓動後`Title`屬性沒有更新?

我的代碼一堆:

SPWebService webService = SPFarm.Local.Services[webServiceGuid] 
    as SPWebService; 
SPWebApplication webApp = webService.WebApplications[webApplicationGuid]; 

// path is "http://sharepoint2013/sites/sandbox2" string 
SPSite siteCollection = webApp.Sites.Add(path, "root", 
    "[email protected]"); 

siteCollection.RootWeb.Title = "My some sites collection"; 
siteCollection.RootWeb.Update(); 

我的網站集創建成功,但是當我打開http://sharepoint2013/sites/sandbox2頁面,然後我看不出Title的更新值。爲什麼會發生?

回答

0

如果您的SP安裝的語言很少,可能會出現問題。嘗試類似:

SPWebService webService = SPFarm.Local.Services[webServiceGuid] 
    as SPWebService; 
SPWebApplication webApp = webService.WebApplications[webApplicationGuid]; 

SPSite siteCollection = webApp.Sites.Add(ObjectPath, "root", "[email protected]"); 

SPUserResource userResource = siteCollection.RootWeb.TitleResource; 

foreach(CultureInfo culture in siteCollection.RootWeb.SupportedUICultures) 
    userResource.SetValueForUICulture(culture, "My some sites collection"); 

siteCollection.RootWeb.Update(); 
相關問題