Exchange Server TechCenter > Exchange Server Forums > Development > Searching and Opening Mails on Exchange Server from outlook addin
Ask a questionAsk a question
 

QuestionSearching and Opening Mails on Exchange Server from outlook addin

  • Wednesday, October 28, 2009 1:17 PMJignesh Desai Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    We are using following
     
    Exchange Server 2007
    Office Outlook 2007
    VS2008 and .NET 3.5  with Office 2007 Addins.
     
    What we want to achieve
    There are 10 outlook clients configured to Exchange Server.  The users of outlook are Sales Guys, Quote Makers, CEO, CEO's Secretary etc.  Each of them respond to our customer via email.
    Now we are designing some software using outlook addins where we found a unique requirement, which is as below
        " CEO would like to see list of all email communication, send or received, by anyone in the organization to customer X, till date.  We should also be able to open and read email" .  Plus
        " This list can be viewed by Sales Guys or any employee, ofcouse in this case the list needs to filter out CEO's email communications ".
     
    So big question is how do we gather emails from various outlook client machines.?  We found that exchange sever can be configured so that
    A copy of all inbound or outbound emails, can be forward to one email-ID  eg. AllMyCompanyMails@mycompany.com
    This email-ID is NOT configured on any outlook client machine.
     
    Question #1: Half of the problem is solved, now the another half is, how do an outlook client written in .NET 3.5  can search mails from this mailbox ? We also want be able to open and read email ?
    Question #2: Is there a kind of Web Service in Exchange Server, that we can use to pass some query and in return it gives us list of emails.?
    Question #3: We want to retrieve mails in ".msg" format so that outlook client can easily open it.     OR 
                         if we can retrieve some kind of unique mail-id and using that we can redirect user to Outlook Web Access to read mails.
     
    Well any other ideas are welcome. Please Guide.
     
    Regards
    JIGNESH.
     
    P.S:  Just a thought: Is this possible with Up-Coming  Exchange / Outlook 2010
     
     
     
     
    "Please don't print this Email unless you really need to - this will preserve trees on planet earth

All Replies

  • Wednesday, October 28, 2009 10:37 PMOmegaManMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I may be wrong, but can't this be solved (#1) by making "AllmycompanyMails" account inbox a common shared inbox between all the target people? So CEO can view the inbox below his inbox in Outlook, just as all the other people.

    Thereby all can view the inbox at various levels of access, without having to install an addin. Or am I missing something.
    William Wegerson (www.OmegaCoder.Com)
  • Thursday, October 29, 2009 2:44 AMJignesh Desai Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi William,

    True, if we configure "AllmycompanyMails" account as a common shared inbox, then we can't restrict its view.  Therefor we don't want to configure this account at all.  No one will know the password.

    Which is where we want that addin connects to "AllmycompanyMails" account, searches and gets list of emails programmatically somehow. 
    Addin then will do the needful of filtering mails based on user.  but how to do this,  is where we are stuck.

    Also

    We want that email should be retrieved in format such that "Inspector" object of outlook programming can understand, so that we simply pass it to "Inspector" object and it can open it for reading.    OR   retrieve mail in .MSG format and we save that file on Harddisk and point Process.Start() to it, which will automatically open mail in outlook window.

    Regards
    JIGNESH


    PS :   I see OWA (OutLook Web Access) is an ASP.NET application doing similar things like Search, List, Read. Etc. Can't we reuse that Library someway?

  • Monday, November 02, 2009 4:49 AMJignesh Desai Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    Can anyone else or MSFT can provide a clue ?

    Awaiting..

    Regards
  • Monday, November 02, 2009 2:26 PMOmegaManMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Let us break the problem down to bite size pieces...you have asked for a lot in one email. First off you can use EWS to attach to a mailbox. One can then programmatically scan the results and filter/move as needed. I detail how a process can access a mailbox in my blog article:

    Tribal Knowledge: EWS C# Extract Alternate Email Address’ Mailbox

    From there process the emails:

    Exchange Web Services C#: Getting All Emails From Exchange using Exchange Web Services

    Maybe to do this work is done by a service or initiated from a web service you create so access can be limited to your web service in IIS and data or results pushed to a database....

    So from there what do you need to do?


    William Wegerson (www.OmegaCoder.Com)
  • Wednesday, November 04, 2009 4:57 AMJignesh Desai Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi William,

    I quickly went through your articles.  at the moment i understand it only a little, may be i need to write some sample code to experiment it myself.

    Information Required:
    1. What libraries/References i need to add in my VS2008 Project?    Just download this http://www.microsoft.com/downloads/details.aspx?FamilyID=e8f38dd1-f123-4a16-b4c8-584d1f84af48&displaylang=en and install it ?

    2. What should be my development environment ?   In addition what i want to know is Can i continue development from my home PC and connect to Exchange server of company?

    ----------------------------------------------------------

    If above is successful then what I need next is to retrieve mail in .MSG format (the format used by outlook to save a mail item as a file on disk ).   I don't want to access individual mail properties like Item.Subject or Item.To etc.  because that would mean that i need to design my own UI to display mail information and i want to avoid it.

    If I am able to retrieve mail in .MSG format, i would simply save it in a temp folder and call Process.Start("SavedMail.MSG"). This will automatically open mail in outlook environment.

    If you think there is alternative simpler way, i would like to hear then.

    Regards
    JIGNESH
  • Wednesday, November 04, 2009 3:15 PMOmegaManMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Answers:

    #1: Yes install and add the reference to the Web Service DLL which was installed on the hard drive into the project. Then add the using reference to the code which will access the web services.

    #2: No/Maybe. While working remotely your computer will most likely not be able to connect to it. But if you VPN into your company then yes the code can resolve the exchange server.


    ------

    MSG format...I am unclear on what you hope to achieve by mimicing an Outlook PST file by saving off the letters. I suggest you first create some sample code to get to know the Exchange Web Services and its limits first. Then decide if it fits within your needs going forward. HTH
    William Wegerson (www.OmegaCoder.Com )
  • Wednesday, November 04, 2009 5:52 PMJignesh Desai Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Some Clarification on .MSG format.

    Lets say i am designing WinForms or WPF Application. Both can add reference to Web Service DLL and can talk to Exchange Server.
    Now on button click, I retrieve a mail from exchange server. This mail details will be,  in my some object variable. How will i display the mail content to user.
    I will have to design my own UI Screen,  Correct ?   I want to avoid this.

    Instead what i want to do is, Save retrieved mail on a disk into .MSG format and then call Process.Start("SavedMail.MSG").  This should automatically open mail in outlook window,  saving my time, since i don't need to design any UI myself.  Correct ?

    Do you still see my visualization incorrect. ?  

    --------------------------

    I guess what is required to connect to exchange server is domain credentials.. If I have those then i should be able to connect throught internet also?
    I will need to find out.


    Regards
    JIGNESH
  • Wednesday, November 04, 2009 6:56 PMOmegaManMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I see what you mean by launching outlook. Ok...I am unsure about being able to get a .MSG format to save the file to. Post another question in the forum as to that issue.

    As to wpf/winforms you could use an html browser control to show an html email with little difficulty.

    William Wegerson (www.OmegaCoder.Com)