Add Outlook Tasks
Used to show and add new tasks to Outlook. Simple code to demo getting task list and also adding a new task in Outlook. Please vote.
AI
Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Zdrojový kód
'Simple Outlook Task View/Add Code
'Troy Blake - Logan's Roadhouse, Inc.
Private Sub InitForm()
'Loads current task to dropdown, then adds
'a task for John Smith. John gets the task
'sent to him via Outlook.
Dim oApp as Outlook.Application
Dim oNspc as NameSpace
Dim oItm as TaskItem
Dim myItem as TaskItem
Set oApp = CreateObject("Outlook.Application")
Set oNspc = oApp.GetNamespace("MAPI")
For Each oItm in oNspc.GetDefaultFolder(olFolderTasks).Items
'Loop through all tasks and show subject
'in dropdown.
With Me.cboTasklist
.AddItem (oItm.Subject)
End With
Next oItm
oNspc.GetDefaultFolder(olFolderTasks).Items.Add
Set myItem = oApp.CreateItem(olTaskItem)
'Create a new task
With myItem
.Subject = "Subject"
.Assign = "Assign"
.Body = "Task Body"
.PercentComplete = 10
'Set due date for tomorrow
.DueDate = DateAdd("d",1,Date)
.ReminderSet = True
.ReminderTime = "9:00 AM"
'Outlook name of person to get task
.Recipients.Add "John Smith"
.Close (olSave)
End With
'Send the task (like email)
myItem.Send
Set myItem = Nothing
Set oItm = Nothing
Set oNspc = Nothing
Set oApp = Nothing
End Sub
Private Sub Form_Load()
'Call out sample sub at form load
InitForm
End Sub
Původní komentáře (3)
Obnoveno z Wayback Machine