static void Main(string[] args) { //initalise all variables for execution Startup(); Helper.Log(".Starting application"); Helper.Log("..Starting Step1- Querying SharePoint for All Webs/Nested Webs in SiteCollections"); SharePointComponent.StartWork(); Helper.Log("..Starting Step2- Quering IIS Logs for All the Webs"); IISComponent.StartWork(); Helper.Log(".Ending Application"); Console.Read(); }
public static void CreateSQLFileForWebURL(string webRelativeURL, string IISid) { //this will create a .sql file with passed parameter as the "where" condition // Generi Query // SELECT count(cs-uri-stem) AS HITS // FROM {app.config key "IISLogsFolder"} // WHERE cs-uri - stem like '/{replace with passed parameter}/%' // now save the file as {webRelativeURL}.sql at folder specified in app.config key "PSSQLFileLocation" // Helper.Log($"Creating SQL file for -{webRelativeURL}--"); string SELECT = "SELECT count(cs-uri-stem) AS HITS" + Environment.NewLine; string INTO = $"INTO {Program.LogParserOutFolder}\\{webRelativeURL.Replace('/','_')}.csv" + Environment.NewLine; string FROM = $"FROM {IISComponent.GetFolderPath(IISid)}" + Environment.NewLine; string WHERE = $"WHERE cs-uri-stem like '{webRelativeURL}/%'"; string FinalSQLQuery = SELECT + INTO + FROM + WHERE; string SQLFileName = Program.PSSQLFileLocation + "\\" + webRelativeURL.Replace('/', '_') + ".sql"; System.IO.File.WriteAllText(SQLFileName, FinalSQLQuery); Helper.Log($"Finished creating SQL file at {SQLFileName}"); }