automate outlook 2007 from visual basic 2005

How to automate outlook 2007 from visual basic 2005 without creating addin and how can create folder in outlook or apply rule ,any idea what is the code
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What is it exactly that you are trying to do? You could use Office interop for Office 2007.
AJDeveloperAuthor Commented:
i need code to automate outlook 2007 form visual basic and being able to create folders ,add rules ,stuff like this ,i dont want to add addin
AJDeveloperAuthor Commented:
what is the code needed to automate outlook 2007 from visual basic 2005
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

AJDeveloperAuthor Commented:
I run the code :

 Dim oOutlook As Outlook.Application
        oOutlook = CreateObject("outlook.application", "localhost")

Im getting the error "cant create activex component"
Are you doing that in ASP.NET?
AJDeveloperAuthor Commented:
No ,im using visual basic 2005 ,windows application
Why are you specifying the localhost then?
Try this
            Dim app As New Microsoft.Office.Interop.Outlook.Application
            Dim ns As [NameSpace]
            ns = app.GetNamespace("MAPI")
rs = ns.CreateRecipient("outlookname")
if rs.resolved then
                        fl = ns.GetSharedDefaultFolder(rs, OlDefaultFolders.olFolderTasks)
                        Dim item As TaskItem = fl.Items.Add
                        item.DueDate = DateTime.Parse(txtDueDate.Text & " " & txtDueTime.Text)
end if

This is live code i am currently using in my project and should work for you. This snippet would create a new task item in the current user's outlook.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AJDeveloperAuthor Commented:
I try,but im getting the error 'Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005'
Have you installed the "Microsoft Office 2007 Primary Interop Assemblies"?
AJDeveloperAuthor Commented:
I will check and update you
AJDeveloperAuthor Commented:
Thanks a lot ,it worked ,but still i cant create folder and getting error
Now its down to you to explore ways of doing what you are trying to do. If it does not allow creation of folders then probably its not supported at all because this is the all in one Office API.
AJDeveloperAuthor Commented:
and one more thing ,why when outlook is opened ,the code doesnt run ,and it give back the same error as before
It should not actually. I use this code all the time and right now i am working on the form which uses this code to create tasks in Outlook. My outlook is open and the code is working and if the outlook is closed, executing the code opens the outlook.
AJDeveloperAuthor Commented:
the error "Convertation program could not open the file" is received when trying to open Excel 2007 in excel 2007 ,although compatiblity tool is installed on the machine ,any idea
AJDeveloperAuthor Commented:
Please ignore my last comment
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.