locked
Access Exchange Public Folders RRS feed

  • Question

  • Hi all,

    I've been approached to write an app for a friend that will run on schedule accessing emails in a public folder in exchange and extracting the attachments. I won't have have access to his exchange server so I can't use the Exchange Seb Service.

    Can it be achieved using the Microsoft.Office.Outlook.Interop model? If so could anybody give me some advice as to how? or point me at some links? As i'm really struggling.

    Thanks in advance,
    Paul.

    Thursday, September 23, 2010 11:45 AM

Answers

  • Ah, how to recommend an Exchange API?  I always liked CDO 1.21, which was still part of E2003, and has a nice object model.  Lots of information here http://www.cdolive.com/ .  The code will need to run on the server, though, or a computer with Outlook installed.

    Or, you could try WebDAV, which has the advantage of being able to access the server from any location.  Not much fun getting attachments, though.

    Or CDOEX http://msdn.microsoft.com/en-us/library/aa579441(EXCHG.80).aspx .  Again, has to run on the server.


    Outlook Web Access For PDA , OWA For WAP
    www.owa-pda.com
    email a@t leederbyshire d.0.t c.0.m
    • Marked as answer by Wilky27 Friday, October 1, 2010 4:31 PM
    Friday, October 1, 2010 12:54 PM

All replies

  • You don't need access to the server to use EWS.  You should be able to get the attachments from any location, assuming that port 80 is available.
    Outlook Web Access For PDA , OWA For WAP
    www.owa-pda.com
    email a@t leederbyshire d.0.t c.0.m
    • Marked as answer by Wilky27 Friday, September 24, 2010 2:14 PM
    • Unmarked as answer by Wilky27 Tuesday, September 28, 2010 5:47 PM
    Thursday, September 23, 2010 1:05 PM
  • Hi Lee,

    Would I need the http of the exchange server?

    Friday, September 24, 2010 2:16 PM
  • Yes, since it's a web service, you send XML requests to the URL of the web service.  The URL will be http://server.domain.com/ews/exchange.asmx .  Or https, if the server requires SSL.
    Outlook Web Access For PDA , OWA For WAP
    www.owa-pda.com
    email a@t leederbyshire d.0.t c.0.m
    Friday, September 24, 2010 2:45 PM
  • Hi Lee,

    It's Exchange server 2003. I don't think that comes with EWS. does it? 

    Tuesday, September 28, 2010 5:47 PM
  • No, but since you mentioned Exchange Web Service in your original post, I assumed you had something more recent.  If you are hoping to use a web-based protocol, you will need to look at WebDAV.
    Outlook Web Access For PDA , OWA For WAP
    www.owa-pda.com
    email a@t leederbyshire d.0.t c.0.m
    Wednesday, September 29, 2010 1:12 PM
  • Sorry, should have specified. No i'm using a console app.

    I've been looking at WMI. Here's what I have:

    ConnectionOptions objconn = new ConnectionOptions();
          objconn.Impersonation = ImpersonationLevel.Impersonate;
          objconn.EnablePrivileges = true;
          objconn.Authentication = AuthenticationLevel.Default;
          objconn.Username = "[username]";
          objconn.Password = "[password]";
    
          string servername = "servername";
          string publicfoldername = "/publicfolder/";
    
          ManagementScope ms = new ManagementScope(@"\\" + servername + @"\root\MicrosoftExchangeV2", objconn);
          ObjectQuery objquery = new ObjectQuery("Select * From Exchange_PublicFolder Where Path='" + publicfoldername + "'");
    
          ManagementObjectSearcher searcher = new ManagementObjectSearcher(ms, objquery);
          ManagementObjectCollection publicfolders = searcher.Get();
    
          foreach (ManagementObject publicfolder in publicfolders)
          {
            System.Console.WriteLine(publicfolder["path"].ToString());
            System.Console.WriteLine(publicfolder["IsMailEnabled"].ToString());
          }
    

    I can acess the public folder but can't find how to access the emails in there, and their attachments.

    Thanks,
    Paul.

    Wednesday, September 29, 2010 8:06 PM
  • I've never used WMI.  Have you tried accessing the .items collection of the publicfolder ManagementObject that you are getting?  I'm just guessing that there is one.
    Outlook Web Access For PDA , OWA For WAP
    www.owa-pda.com
    email a@t leederbyshire d.0.t c.0.m
    Thursday, September 30, 2010 12:36 PM
  • Nope, nothing of the sort.

    Are there any other technologies I should look into?

    Thanks
    Paul.

    Thursday, September 30, 2010 4:46 PM
  • Ah, how to recommend an Exchange API?  I always liked CDO 1.21, which was still part of E2003, and has a nice object model.  Lots of information here http://www.cdolive.com/ .  The code will need to run on the server, though, or a computer with Outlook installed.

    Or, you could try WebDAV, which has the advantage of being able to access the server from any location.  Not much fun getting attachments, though.

    Or CDOEX http://msdn.microsoft.com/en-us/library/aa579441(EXCHG.80).aspx .  Again, has to run on the server.


    Outlook Web Access For PDA , OWA For WAP
    www.owa-pda.com
    email a@t leederbyshire d.0.t c.0.m
    • Marked as answer by Wilky27 Friday, October 1, 2010 4:31 PM
    Friday, October 1, 2010 12:54 PM
  • Thanks Lee.
    Friday, October 1, 2010 4:31 PM