Iterating folder of each mailbox in exchange store using CDO library

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anup wadekar
    New Member
    • Jul 2009
    • 4

    Iterating folder of each mailbox in exchange store using CDO library

    I am able to access the exchange mail boxes of the mounted edb file using Active Directory Services such that i am retrieving the

    names of the user's and than setting the mail box to the user.
    Code:
     CDO.Message objMsg;
     CDO.DropDirectory objDropDir = new CDO.DropDirectory();
     CDO.IMessages objIMesgs;
    
    
     DirectoryEntry de = srUser.GetDirectoryEntry();            // Where srUser = "anup"
                  
    
     if (de.Properties["sAMAccountName"].Value.ToString() == "anup")
     {
    
                                        objMailBox = (CDOEXM.Mailbox)de.NativeObject;                              
    
                               objPerson.DataSource.Open(de.Path,
                                     null,
                                  ADODB.ConnectModeEnum.adModeRead,
                                 ADODB.RecordCreateOptionsEnum.adFailIfNotExists,
                                  ADODB.RecordOpenOptionsEnum.adOpenSource,
                                 String.Empty,
                                String.Empty
                                                    );
    
                                        objCImailBox = (CDO.IMailbox)objPerson.GetInterface("IMailbox");
    
                                        MessageBox.Show(objCImailBox.RootFolder);
    
    }
    The problem is like :

    1) After setting the objCmailBox to objPerson i am unable to get the URL's for Inbox, Sent Items.... and other's except for the

    RootFolder URL.

    I am able to get the url only for the RootFolder ie (file://./backofficestora ge/pcvita.com/MBX/anup/IPM_ROOT)

    2) I need to iterate through each of the folder like inbox and sent items and their mails through IMessages and IMessage.

    such that :
    Code:
                            objIMesgs = objDropDir.GetMessages(objFolderClass.SourceURL);
    
                             foreach(msg in objMesgs)
                              {
                                        msg.SubjectName;
                               }


    Kindly help me out as i am stuck here.....
    Last edited by PRR; Jul 17 '09, 12:47 PM. Reason: added code tags
  • anup wadekar
    New Member
    • Jul 2009
    • 4

    #2
    Using C# and CDO to access the mails from each folder using CDO.dll

    Hi,

    Here is my code :

    objCImailBox = (CDO.IMailbox)o bjPerson.GetInt erface("IMailbo x");

    MessageBox.Show (objCImailBox.R ootFolder);

    The problem is like :

    1) After setting the objCmailBox to objPerson i am unable to get the URL's for Inbox, Sent Items.... and other's except for the RootFolder URL.

    I am able to get the url only for the RootFolder ie (file://./backofficestora ge/pcvita.com/MBX/anup/IPM_ROOT)

    I am looking for help which will allow me to access each of the folder and Items using the file :// URL

    But i am not getting the URL path of each folder of the mail box as the objCImailBox.In box returns empty string instead

    of file://path of the inbox.

    I am able to get the path of the root folder. But i am unable to get the other URL path's for the ofher folder ie

    (Inbox...).

    Kindly provide me some few steps of code which i can fetch the folder URL's and than access each of the folder using

    CDO.IFolder interface and open the items.

    Your help will really help me out from this problem.
    Last edited by Frinavale; Jul 17 '09, 01:16 PM. Reason: Duplicate questions merged

    Comment

    • pratikmehta9
      New Member
      • Nov 2006
      • 3

      #3
      I am facing the same issue.. did you find the solution?

      Comment

      Working...