using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using System.Diagnostics;
//using ConsoleApplication1.ContactService;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
try
{
ContactServiceClient serv = new ContactServiceClient();
Console.WriteLine("started");
SPSolutionCollection solutions = SPFarm.Local.Solutions;
Console.WriteLine("1");
foreach (SPSolution solution in solutions)
{
Console.WriteLine("2");
SPPersistedFile wspFile = solution.SolutionFile;
wspFile.SaveAs("c:\\Projects\\" + solution.Name);
Console.WriteLine(solution.Name);
}
log("main", "main method---------" + "hello", "Information");
}
catch (Exception ex)
{
log("main", "Exception in PopulateForm() ; Exception message : " + ex.Message, "Error");
}
Console.ReadLine();
}
#region Log info
public static void log(string IPAddress, string Message, string logType)
{
if (logType == "Warning")
{
EventLog.WriteEntry(IPAddress, "Message : " + Message, EventLogEntryType.Warning, 233);
}
else
if (logType == "Error")
{
EventLog.WriteEntry(IPAddress, "ExceptionMSG : " + Message, EventLogEntryType.Error, 233);
}
else
if (logType == "Information")
{
EventLog.WriteEntry(IPAddress, "ExceptionMSG : " + Message, EventLogEntryType.Information, 233);
}
}
#endregion
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using System.Diagnostics;
//using ConsoleApplication1.ContactService;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
try
{
ContactServiceClient serv = new ContactServiceClient();
Console.WriteLine("started");
SPSolutionCollection solutions = SPFarm.Local.Solutions;
Console.WriteLine("1");
foreach (SPSolution solution in solutions)
{
Console.WriteLine("2");
SPPersistedFile wspFile = solution.SolutionFile;
wspFile.SaveAs("c:\\Projects\\" + solution.Name);
Console.WriteLine(solution.Name);
}
log("main", "main method---------" + "hello", "Information");
}
catch (Exception ex)
{
log("main", "Exception in PopulateForm() ; Exception message : " + ex.Message, "Error");
}
Console.ReadLine();
}
#region Log info
public static void log(string IPAddress, string Message, string logType)
{
if (logType == "Warning")
{
EventLog.WriteEntry(IPAddress, "Message : " + Message, EventLogEntryType.Warning, 233);
}
else
if (logType == "Error")
{
EventLog.WriteEntry(IPAddress, "ExceptionMSG : " + Message, EventLogEntryType.Error, 233);
}
else
if (logType == "Information")
{
EventLog.WriteEntry(IPAddress, "ExceptionMSG : " + Message, EventLogEntryType.Information, 233);
}
}
#endregion
}
}
No comments:
Post a Comment