Created
August 31, 2010 06:53
-
-
Save NathanW2/558661 to your computer and use it in GitHub Desktop.
Comparing C# with and with the {. Using indention like Python. Just for fun
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Outlook | |
{ | |
private Application outlook; | |
private Outlook(Application outlookInstance) | |
{ | |
this.outlook = outlookInstance; | |
this.DBYDEmailFolderName = "DBYD"; | |
} | |
public static Outlook ConnectToOutlook() | |
{ | |
try | |
{ | |
Application instance = new ApplicationClass(); | |
return new Outlook(instance); | |
} | |
catch (System.Exception) | |
{ | |
throw new ApplicationException("Could not connect to outlook"); | |
} | |
} | |
public string CurrentUser | |
{ | |
get | |
{ | |
return this.outlook.GetNamespace("MAPI").CurrentUser.Name; | |
} | |
} | |
public bool HasDBYDFolder | |
{ | |
get | |
{ | |
return (this.DBYDFolder != null); | |
} | |
} | |
public int CountOfUnreadItems | |
{ | |
get | |
{ | |
var itemlist = this.DBYDFolder.Items.Restrict("[Unread] = true"); | |
return itemlist.Count; | |
} | |
} | |
public void CreateDBYDFolder() | |
{ | |
NameSpace mapinamespace = outlook.GetNamespace("MAPI"); | |
MAPIFolder defultemailfolder = mapinamespace.GetDefaultFolder(OlDefaultFolders.olFolderInbox); | |
defultemailfolder.Folders.Add(this.DBYDEmailFolderName, OlDefaultFolders.olFolderInbox); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace DBYD.Services.Outlook | |
public class Outlook | |
private Application outlook; | |
private Outlook(Application outlookInstance) | |
this.outlook = outlookInstance; | |
this.DBYDEmailFolderName = "DBYD"; | |
public static Outlook ConnectToOutlook() | |
try | |
Application instance = new ApplicationClass(); | |
return new Outlook(instance); | |
catch (System.Exception) | |
throw new ApplicationException("Could not connect to outlook"); | |
public string CurrentUser | |
get | |
return this.outlook.GetNamespace("MAPI").CurrentUser.Name; | |
public bool HasDBYDFolder | |
get | |
return (this.DBYDFolder != null); | |
public int CountOfUnreadItems | |
get | |
var itemlist = this.DBYDFolder.Items.Restrict("[Unread] = true"); | |
return itemlist.Count; | |
public void CreateDBYDFolder() | |
NameSpace mapinamespace = outlook.GetNamespace("MAPI"); | |
MAPIFolder defultemailfolder = mapinamespace.GetDefaultFolder(OlDefaultFolders.olFolderInbox); | |
defultemailfolder.Folders.Add(this.DBYDEmailFolderName, OlDefaultFolders.olFolderInbox); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment