?
Solved

Reference Outlook object

Posted on 2013-01-16
6
Medium Priority
?
314 Views
Last Modified: 2013-02-01
I would like to reference a object in Outlook for example the subject line in the task form.  How would I do that?
0
Comment
Question by:Kylo Ren
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38786139
Are you using interop?
0
 
LVL 5

Author Comment

by:Kylo Ren
ID: 38786157
No I'm not. Is that what You recommend?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38786217
Given that the question is in .NET zones, I assumed you are interfacing with Outlook from a .NET application. Is that correct?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 9

Accepted Solution

by:
shorvath earned 2000 total points
ID: 38787223
Create a Macro in Outlook and paste the following code:

Dim objNameSpace As Outlook.NameSpace
Dim objTASK_Folder As Outlook.MAPIFolder
Dim objTasks As Outlook.Items
Dim objTask As Outlook.TaskItem

Set objNameSpace = Application.GetNamespace("MAPI")
Set objTASK_Folder = objNameSpace.GetDefaultFolder(olFolderTasks)
Set objTasks = objTASK_Folder.Items
Set objTask = Application.CreateItem(olTaskItem)

For Each objTask In objTasks
    MsgBox objTask.Subject
Next

Set objNameSpace = Nothing
Set objTASK_Folder = Nothing
Set objTasks = Nothing
Set objTask = Nothing

Open in new window

0
 
LVL 5

Author Comment

by:Kylo Ren
ID: 38790804
code cruiser, i am working in outlook only but i think outlook supports .net

shorvath, this may be what i am looking for.  i am assuming these lines clears the variables?

Set objNameSpace = Nothing
Set objTASK_Folder = Nothing
Set objTasks = Nothing
Set objTask = Nothing

also, can i import macros into visual studio?
0
 
LVL 9

Expert Comment

by:shorvath
ID: 38793559
it destroys the objects you created... VBA does not have garbage cleanup..

You can do most things using VBA within Outlook including COM and API calls..

You can do everything using Visual Studio and the MS Office Object Library.
    ( sample   ->   http://support.microsoft.com/default.aspx?id=310258)

It really depends on what you are doing..   developing an stand alone app or a simple solution for you Outlook users...
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question