Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Exchange Calendar To iCal.v11.suo
Binary file not shown.
23 changes: 18 additions & 5 deletions Exchange Calendar To iCal/App.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<appSettings>
<add key="ExchangeWebServiceUrl" value="https://www.outlook.soton.ac.uk/ews/exchange.asmx"/>
<add key="ExchangeWebServiceUrl" value="https://www.outlook.soton.ac.uk/ews/exchange.asmx" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
</configuration>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>
12 changes: 12 additions & 0 deletions Exchange Calendar To iCal/Exchange Calendar To iCal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
Expand All @@ -60,10 +61,21 @@
<Compile Include="iCalWrapper.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
41 changes: 21 additions & 20 deletions Exchange Calendar To iCal/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,29 @@ class Program
{
static void Main(string[] args)
{
string PublicFolderPath = @"Professional Services\iSolutions\ITIL Processes\Change\Forward Schedule of Change";
if (args.Length != 4)
{
Console.WriteLine("This application must be passed 4 arguments:");
Console.WriteLine(" <username> - The username of the user requesting a calendar. (E.g. abc1d23).");
Console.WriteLine(" <password> - The pass word of the user requesting a calendar.");
Console.WriteLine(" <calendar> - The name of the calendar. (E.g. building 32 room 4049 would be b32r4049).");
Console.WriteLine(" <writefile> - The file to write the iCal for the calendar to. (E.g. C:\\Users\\User\\b32r4049.ics or Windows or /home/user/b32r4049.ics on Linux).\n");
Environment.Exit(1);
}

// Configure filtering options
FilterSetting FilterOptions = new FilterSetting();
// TODO : Read in the following as arugments
//FilterOptions.SubjectFilter = "(iss-)|(Migrations)";
FilterOptions.SubjectFilter = "(Building|Bld|Bldg) [0-9][0-9]";
//string[] CategoryFilter = { "DBA", "EST", "DST" };
//FilterOptions.CategoryFilter = CategoryFilter;
FilterOptions.SearchStartDate = DateTime.Now;
FilterOptions.SearchEndDate = DateTime.Now.AddDays(10);
FilterOptions.SearchStartDate = DateTime.Now.AddDays(-30);
FilterOptions.SearchEndDate = DateTime.Now.AddDays(90);

// Initialise web service instance.
// NOTE: This is an overloaded method - alternate versions take credentials/username+password - switch out if needed
ExchangeService WebService = ExchangeWebServiceWrapper.GetWebServiceInstance();
// Establish web service session
ExchangeService WebService = ExchangeWebServiceWrapper.GetWebServiceInstance(args[0], args[1], "SOTON");

// Retrieve calendar folder
Console.WriteLine("Getting calendar...");
CalendarFolder Calendar = ExchangeWebServiceWrapper.GetCalendarFolder(WebService, PublicFolderPath);

Mailbox mailbox = new Mailbox(args[2]+"@soton.ac.uk");
FolderId id = new FolderId(WellKnownFolderName.Calendar, mailbox);
CalendarFolder Calendar = CalendarFolder.Bind(WebService, id);
if (Calendar == null)
{
throw new Exception("Could not find calendar folder.");
Expand All @@ -38,16 +42,13 @@ static void Main(string[] args)
// Retrieve appointments
Console.WriteLine("Getting appointments...");
FindItemsResults<Appointment> Appointments = Calendar.FindAppointments(new CalendarView(FilterOptions.SearchStartDate, FilterOptions.SearchEndDate));

iCalWrapper iCal = new iCalWrapper();


iCal.AddEventsToCalendar(Appointments, FilterOptions);

Console.WriteLine(iCal.GenerateString());

Console.WriteLine("\n\nDone");
Console.ReadLine();
// Write iCal file to disk
Console.WriteLine("Writing to file "+args[3]+"...");
iCal.GenerateFile(args[3]);
Console.WriteLine("Done");
}
}
}
63 changes: 63 additions & 0 deletions Exchange Calendar To iCal/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

101 changes: 101 additions & 0 deletions Exchange Calendar To iCal/Properties/Resources.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->

<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<appSettings>
<add key="ExchangeWebServiceUrl" value="https://www.outlook.soton.ac.uk/ews/exchange.asmx" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<appSettings>
<add key="ExchangeWebServiceUrl" value="https://www.outlook.soton.ac.uk/ews/exchange.asmx" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Binary file not shown.
Loading