Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Accessing folder from outlook express 2003 with C# 1.1

Accessing folder from outlook express 2003 with C# 1.1

Scheduled Pinned Locked Moved C#
csharpcomhelp
9 Posts 2 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Het2109
    wrote on last edited by
    #1

    I want to access folders which are not in Inbox but outside my inbox, like my personal folders using c#. I am using Outlook Object Library 11.0. Would appreciate someones help.

    Het Waghela :)Be Humble in Victory and Strong in Defeat.:) Het Waghela, Blog|Het Waghela DotNet Questions Link|More Links

    K 1 Reply Last reply
    0
    • H Het2109

      I want to access folders which are not in Inbox but outside my inbox, like my personal folders using c#. I am using Outlook Object Library 11.0. Would appreciate someones help.

      Het Waghela :)Be Humble in Victory and Strong in Defeat.:) Het Waghela, Blog|Het Waghela DotNet Questions Link|More Links

      K Offline
      K Offline
      KaptinKrunch
      wrote on last edited by
      #2

      Read up on this page for accessing folders in outlook using C#. http://support.microsoft.com/kb/310244[^]

      Just because we can; does not mean we should.

      H 1 Reply Last reply
      0
      • K KaptinKrunch

        Read up on this page for accessing folders in outlook using C#. http://support.microsoft.com/kb/310244[^]

        Just because we can; does not mean we should.

        H Offline
        H Offline
        Het2109
        wrote on last edited by
        #3

        Thanks for your help, I had already visited that and tried below Outlook._Application olApp = new Outlook.ApplicationClass(); Outlook._NameSpace olNS = olApp.GetNamespace("MAPI");Outlook._Folders oFolders; oFolders = olNS.Folders; Outlook.MAPIFolder oPublicFolder = oFolders.Item("Public Folders"); oFolders = oPublicFolder.Folders; Outlook.MAPIFolder oAllPFolder = oFolders.Item("All Public Folders"); oFolders = oAllPFolder.Folders; Outlook.MAPIFolder oMyFolder = oFolders.Item("My Public Folder"); Console.Write(oMyFolder.Name); But it is not working giving an error at oFolders.Item("Public Folders"); :(

        Het Waghela :)Be Humble in Victory and Strong in Defeat.:) Het Waghela, Blog|Het Waghela DotNet Questions Link|More Links

        K 1 Reply Last reply
        0
        • H Het2109

          Thanks for your help, I had already visited that and tried below Outlook._Application olApp = new Outlook.ApplicationClass(); Outlook._NameSpace olNS = olApp.GetNamespace("MAPI");Outlook._Folders oFolders; oFolders = olNS.Folders; Outlook.MAPIFolder oPublicFolder = oFolders.Item("Public Folders"); oFolders = oPublicFolder.Folders; Outlook.MAPIFolder oAllPFolder = oFolders.Item("All Public Folders"); oFolders = oAllPFolder.Folders; Outlook.MAPIFolder oMyFolder = oFolders.Item("My Public Folder"); Console.Write(oMyFolder.Name); But it is not working giving an error at oFolders.Item("Public Folders"); :(

          Het Waghela :)Be Humble in Victory and Strong in Defeat.:) Het Waghela, Blog|Het Waghela DotNet Questions Link|More Links

          K Offline
          K Offline
          KaptinKrunch
          wrote on last edited by
          #4

          Cut and paste from the page linked above. " Folders object - You can use the Folders object to refer to any folder that is in the Outlook folder list. The Folders object is typically used to refer to a Microsoft Exchange folder or to any other folder that is not a default Outlook folder. The following sample code illustrates how to refer to a public folder that is named My Public Folder. Notice that you typically start at the top-most folder and then work your way down to the folder that you have to reference. Also notice that the folder names are case-sensitive. You must exactly match the capitalization and the names as they appear in the Outlook folders list. " I'd double check this.

          Just because we can; does not mean we should.

          H 1 Reply Last reply
          0
          • K KaptinKrunch

            Cut and paste from the page linked above. " Folders object - You can use the Folders object to refer to any folder that is in the Outlook folder list. The Folders object is typically used to refer to a Microsoft Exchange folder or to any other folder that is not a default Outlook folder. The following sample code illustrates how to refer to a public folder that is named My Public Folder. Notice that you typically start at the top-most folder and then work your way down to the folder that you have to reference. Also notice that the folder names are case-sensitive. You must exactly match the capitalization and the names as they appear in the Outlook folders list. " I'd double check this.

            Just because we can; does not mean we should.

            H Offline
            H Offline
            Het2109
            wrote on last edited by
            #5

            I read that but I got error before that and am yet to reach there. Outlook._Application olApp = new Outlook.ApplicationClass(); Outlook._NameSpace olNS = olApp.GetNamespace("MAPI");Outlook._Folders oFolders; oFolders = olNS.Folders; Outlook.MAPIFolder oPublicFolder = oFolders.Item(); oFolders.Item is not defined thats what it says me.

            Het Waghela :)Be Humble in Victory and Strong in Defeat.:) Het Waghela, Blog|Het Waghela DotNet Questions Link|More Links

            K 1 Reply Last reply
            0
            • H Het2109

              I read that but I got error before that and am yet to reach there. Outlook._Application olApp = new Outlook.ApplicationClass(); Outlook._NameSpace olNS = olApp.GetNamespace("MAPI");Outlook._Folders oFolders; oFolders = olNS.Folders; Outlook.MAPIFolder oPublicFolder = oFolders.Item(); oFolders.Item is not defined thats what it says me.

              Het Waghela :)Be Humble in Victory and Strong in Defeat.:) Het Waghela, Blog|Het Waghela DotNet Questions Link|More Links

              K Offline
              K Offline
              KaptinKrunch
              wrote on last edited by
              #6

              Lets assume I have a folder named "SPAM". I'd write that line like: Outlook.MAPIFolder oPublicFolder = oFolders.Item("SPAM"); Maybe I'm not understanding you correctly....If thats the case, I'll leave it to someone else.

              Just because we can; does not mean we should.

              H 1 Reply Last reply
              0
              • K KaptinKrunch

                Lets assume I have a folder named "SPAM". I'd write that line like: Outlook.MAPIFolder oPublicFolder = oFolders.Item("SPAM"); Maybe I'm not understanding you correctly....If thats the case, I'll leave it to someone else.

                Just because we can; does not mean we should.

                H Offline
                H Offline
                Het2109
                wrote on last edited by
                #7

                You are almost there! :) What i mean is when we write Outlook.MAPIFolder oPublicFolder = oFolders.Item("SPAM"); when i write oFolders and press ".", i don't see "Item", means oFolders doesn't have a definition of "Item" and it throws me error there itself. Specifing the folder name "SPAM" will be checked in the next step. Hope you are getting me now. Appreciate and Thanks a million to you!

                Het Waghela :)Be Humble in Victory and Strong in Defeat.:) Het Waghela, Blog|Het Waghela DotNet Questions Link|More Links

                K 1 Reply Last reply
                0
                • H Het2109

                  You are almost there! :) What i mean is when we write Outlook.MAPIFolder oPublicFolder = oFolders.Item("SPAM"); when i write oFolders and press ".", i don't see "Item", means oFolders doesn't have a definition of "Item" and it throws me error there itself. Specifing the folder name "SPAM" will be checked in the next step. Hope you are getting me now. Appreciate and Thanks a million to you!

                  Het Waghela :)Be Humble in Victory and Strong in Defeat.:) Het Waghela, Blog|Het Waghela DotNet Questions Link|More Links

                  K Offline
                  K Offline
                  KaptinKrunch
                  wrote on last edited by
                  #8

                  OK, I get you now. Try this out and see what you get for folder names or just refer to the folder by index. Microsoft.Office.Interop.Outlook._Application olApp = new Microsoft.Office.Interop.Outlook.ApplicationClass(); Microsoft.Office.Interop.Outlook._NameSpace olNS = olApp.GetNamespace("MAPI"); Microsoft.Office.Interop.Outlook._Folders oFolders; oFolders = olNS.Folders; for (int i = 0; i < oFolders.Count; i++) { Microsoft.Office.Interop.Outlook.MAPIFolder oPublicFolder = oFolders[i].; Console.Write(oPublicFolder.Name); }

                  Just because we can; does not mean we should.

                  H 1 Reply Last reply
                  0
                  • K KaptinKrunch

                    OK, I get you now. Try this out and see what you get for folder names or just refer to the folder by index. Microsoft.Office.Interop.Outlook._Application olApp = new Microsoft.Office.Interop.Outlook.ApplicationClass(); Microsoft.Office.Interop.Outlook._NameSpace olNS = olApp.GetNamespace("MAPI"); Microsoft.Office.Interop.Outlook._Folders oFolders; oFolders = olNS.Folders; for (int i = 0; i < oFolders.Count; i++) { Microsoft.Office.Interop.Outlook.MAPIFolder oPublicFolder = oFolders[i].; Console.Write(oPublicFolder.Name); }

                    Just because we can; does not mean we should.

                    H Offline
                    H Offline
                    Het2109
                    wrote on last edited by
                    #9

                    Thanks for that, but it gave me out of index error, but i just twisted your code somewhat and this is what i did and got the folder details i need. Outlook.Application OApp = new Outlook.ApplicationClass(); Outlook.NameSpace ns = OApp.GetNamespace("MAPI"); Outlook.MAPIFolder inbxfld = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox); Outlook.MAPIFolder prsnlfldr = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox); Outlook.Folders pfldr = ns.Folders; Console.WriteLine(pfldr.Count); foreach(Outlook.MAPIFolder fld in pfldr) { Console.WriteLine(fld.Name); } Thanks a million for your help and getting me out of this :) Now I am going a step further! Btw, liked your line "Just because we can; does not mean we should."

                    Het Waghela :)Be Humble in Victory and Strong in Defeat.:) Het Waghela, Blog|Het Waghela DotNet Questions Link|More Links

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups