[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

Reference Outlook object

I would like to reference a object in Outlook for example the subject line in the task form.  How would I do that?
0
Kylo Ren
Asked:
Kylo Ren
  • 2
  • 2
  • 2
1 Solution
 
CodeCruiserCommented:
Are you using interop?
0
 
Kylo RenSystem EngineerAuthor Commented:
No I'm not. Is that what You recommend?
0
 
CodeCruiserCommented:
Given that the question is in .NET zones, I assumed you are interfacing with Outlook from a .NET application. Is that correct?
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
shorvathCommented:
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
 
Kylo RenSystem EngineerAuthor Commented:
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
 
shorvathCommented:
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

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now