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
AJDeveloperAsked:
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.

CodeCruiserCommented:
What is it exactly that you are trying to do? You could use Office interop for Office 2007.
0
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
0
AJDeveloperAuthor Commented:
what is the code needed to automate outlook 2007 from visual basic 2005
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

AJDeveloperAuthor Commented:
I run the code :

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

Im getting the error "cant create activex component"
0
CodeCruiserCommented:
Are you doing that in ASP.NET?
0
AJDeveloperAuthor Commented:
No ,im using visual basic 2005 ,windows application
0
CodeCruiserCommented:
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")
rs.resolve
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)
                        ...
                        item.save
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.
0

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'
0
CodeCruiserCommented:
Have you installed the "Microsoft Office 2007 Primary Interop Assemblies"?
0
AJDeveloperAuthor Commented:
I will check and update you
0
AJDeveloperAuthor Commented:
Thanks a lot ,it worked ,but still i cant create folder and getting error
0
CodeCruiserCommented:
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.
0
AJDeveloperAuthor Commented:
and one more thing ,why when outlook is opened ,the code doesnt run ,and it give back the same error as before
0
CodeCruiserCommented:
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.
0
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
0
AJDeveloperAuthor Commented:
Please ignore my last comment
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.