Solved

Reference Outlook object

Posted on 2013-01-16
6
304 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
  • 2
  • 2
  • 2
6 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
Are you using interop?
0
 
LVL 4

Author Comment

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

Expert Comment

by:CodeCruiser
Comment Utility
Given that the question is in .NET zones, I assumed you are interfacing with Outlook from a .NET application. Is that correct?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 9

Accepted Solution

by:
shorvath earned 500 total points
Comment Utility
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 4

Author Comment

by:Kylo Ren
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SQL Server 2008 Error 7 54
Setting location of a form 4 21
.net VBA word safemode 1 23
Unable  to create new object 9 16
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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now