private Dictionary<string, FileAndDate> LoadAllScripts(string siteUrl) { if (siteUrl == null) throw new ArgumentNullException("siteUrl"); var output = new Dictionary<string, FileAndDate>(); using (SPSite tempsite = new SPSite(siteUrl)) { return (Dictionary<string, FileAndDate>) tempsite.RunElevated(delegate(SPSite site) { this._currentSiteUrl = site.Url; SPWeb rootWeb = site.RootWeb; SPList sList = rootWeb.OpenList("SiteScripts", true); sList.ProcessItems(delegate(SPListItem script) { KeyValuePair<string, FileAndDate> scriptItem = LoadScriptFromItem(script); output[scriptItem.Key] = scriptItem.Value; return null; }); return output; }); } }
public void Reload(string siteUrl, string fileNamePath) { string totalUrl = null; try { using (SPSite tempsite = new SPSite(siteUrl)) { tempsite.RunElevated(delegate(SPSite site) { this._currentSiteUrl = siteUrl; SPWeb rootWeb = site.RootWeb; SPList sList = rootWeb.OpenList("SiteScripts", true); // url seznamu spojit s dodanou cestou a jmenem souboru totalUrl = (sList.AbsoluteUrl() + RepoServiceClient.NormalizedFilePath(fileNamePath).Replace('\\', '/').Substring(2)).Replace ("/Forms/", "/"); SPListItem script = rootWeb.GetItemByUrl(totalUrl); KeyValuePair<string, FileAndDate> scriptItem = LoadScriptFromItem(script); _files[site.Url][scriptItem.Key] = scriptItem.Value; return null; }); } } catch (FileNotFoundException f) { throw new FileNotFoundException("RepoService failed to open file " + ( totalUrl ?? "-" ) + "\n" + f); } }