A1VBCode Forums

how do i put a custom label on a link when creating an outlook task?


http://www.a1vbcode.com/vbforums/Topic27959.aspx

By tikboydev - 7/29/2009

hi... i'm relatively new to outlook task creation from visual basic. hope someone can help me... when i create an outlook task, i want to insert a link with a custom string... e.g. please see screenshot:







instead of the left screen, i would like to come up with the right screen. any help, tips or sample code would be highly appreciated... thank you very much in advance.



by the way, i'm using visual studio 2005, microsoft outlook 2003 and outlook interop from outlook 2003.



-------------------

Imports xOutlook = Microsoft.Office.Interop.Outlook



Public Class Form1



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim xOutlookApp As New xOutlook.Application

Dim xNameSpace As xOutlook.NameSpace = xOutlookApp.GetNamespace("MAPI")

CreateTaskItem(xOutlookApp)

End Sub



Private Sub CreateTaskItem(ByRef xOutlookApp As xOutlook.Application)

Dim xNewTask As xOutlook.TaskItem = CType(xOutlookApp.CreateItem(xOutlook.OlItemType.olTaskItem), Microsoft.Office.Interop.Outlook.TaskItem)



xNewTask.Subject = "My Task " & Now.ToString

xNewTask.PercentComplete = 50

xNewTask.StartDate = Date.Now

xNewTask.DueDate = Date.Now.AddDays(5)

xNewTask.Status = Microsoft.Office.Interop.Outlook.OlTaskStatus.olTaskInProgress

xNewTask.Complete = False



'''' setting the task body

xNewTask.Body = "Click here to view google." _

& Environment.NewLine & Environment.NewLine _

& "Test... http://www.google.com"



xNewTask.Save()

End Sub



End Class

---------------