Hello All:
I need to create an outlook task through automation in access. I have been successful in doing so with the code below HOWEVER I want to create the task in a public folder and assign the appropriate owner. I can't figure how to naigate to the following folder:
Public folders \ All public folders \ Helpdesk \ Tasks
Where "task" is the folder where i want the task to be create. If you reemember you can't "directly" mark an owner in a private Outlook task you have to go threw the "assigning" of a task. I wan tot post these tasks to a public folder becuse the help fiel mentions that you can assign an owner if the task is in a public folder.
Here is the code i have so far(outlook email is built into this and it works no issue there):
Function fncAddOutlookTask()
Dim OutlookApp As Outlook.Application
Dim OutlookTask As Outlook.TaskItem
Dim OutlookEmail As Outlook.MailItem
Dim TaskString As String
Dim SubjectString As String
Dim CategoryString As String
Dim NotesString As String
Dim BodyString As String
Dim intAnswer As Integer
Set OutlookApp = CreateObject("Outlook.Application"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Set OutlookTask = OutlookApp.CreateItem(olTaskItem)
Set OutlookEmail = OutlookApp.CreateItem(olMailItem)
NotesString = "STARTED" & " " & CallDate & " - " & AgentType & Chr(10) & Chr(10) & Notes
CategoryString = "." & AgentType & ", " & "Production Support"
BodyString = "If you have any questions please call Agent: " & AgentType & Chr(10) & "Thank You."
If Notes <> 0 Then
If Task = False Then
Task = True
If PriorityType = 1 Then
TaskString = "# " & CallID & "P" & " / " & SeverityType & " / " & SubjectType
SubjectString = "# " & CallID & "P" & " / " & SeverityType & " / " & SubjectType & " - Added to Helpdesk Tasks. Please Check."
With OutlookTask
.Owner = "helpdesk"
.Importance = olImportanceHigh
.Subject = TaskString
.Body = NotesString
.Categories = CategoryString
.Display
End With
intAnswer = MsgBox("Send Email to Production Support?", vbYesNo + vbQuestion, "Email about to be sent"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Select Case intAnswer
Case vbYes
With OutlookEmail
.Recipients.Add ("helpdesk"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
.Subject = SubjectString
.Body = BodyString
.Importance = olImportanceHigh
.Send
End With
End Select
Else
TaskString = "# " & CallID & " / " & SeverityType & " / " & SubjectType
SubjectString = "# " & CallID & " / " & SeverityType & " / " & SubjectType & " - Added to Helpdesk Tasks. Please Check."
With OutlookTask
.Owner = "helpdesk"
.Subject = TaskString
.Body = NotesString
.Categories = CategoryString
.Display
End With
intAnswer = MsgBox("Send Email to Production Support?", vbYesNo + vbQuestion, "Email about to be sent"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Select Case intAnswer
Case vbYes
With OutlookEmail
.Recipients.Add ("helpdesk"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
.Subject = SubjectString
.Body = BodyString
.Send
End With
End Select
End If
Else
MsgBox "Task already created for this Call ID." _
, , "Can't Create Duplicate Task"
End If
Else
MsgBox "Task can't be created w/o Notes." _
, , "Can't Create Task"
End If
End Function
ANY help will be greatly appreciated.
I need to create an outlook task through automation in access. I have been successful in doing so with the code below HOWEVER I want to create the task in a public folder and assign the appropriate owner. I can't figure how to naigate to the following folder:
Public folders \ All public folders \ Helpdesk \ Tasks
Where "task" is the folder where i want the task to be create. If you reemember you can't "directly" mark an owner in a private Outlook task you have to go threw the "assigning" of a task. I wan tot post these tasks to a public folder becuse the help fiel mentions that you can assign an owner if the task is in a public folder.
Here is the code i have so far(outlook email is built into this and it works no issue there):
Function fncAddOutlookTask()
Dim OutlookApp As Outlook.Application
Dim OutlookTask As Outlook.TaskItem
Dim OutlookEmail As Outlook.MailItem
Dim TaskString As String
Dim SubjectString As String
Dim CategoryString As String
Dim NotesString As String
Dim BodyString As String
Dim intAnswer As Integer
Set OutlookApp = CreateObject("Outlook.Application"
Set OutlookTask = OutlookApp.CreateItem(olTaskItem)
Set OutlookEmail = OutlookApp.CreateItem(olMailItem)
NotesString = "STARTED" & " " & CallDate & " - " & AgentType & Chr(10) & Chr(10) & Notes
CategoryString = "." & AgentType & ", " & "Production Support"
BodyString = "If you have any questions please call Agent: " & AgentType & Chr(10) & "Thank You."
If Notes <> 0 Then
If Task = False Then
Task = True
If PriorityType = 1 Then
TaskString = "# " & CallID & "P" & " / " & SeverityType & " / " & SubjectType
SubjectString = "# " & CallID & "P" & " / " & SeverityType & " / " & SubjectType & " - Added to Helpdesk Tasks. Please Check."
With OutlookTask
.Owner = "helpdesk"
.Importance = olImportanceHigh
.Subject = TaskString
.Body = NotesString
.Categories = CategoryString
.Display
End With
intAnswer = MsgBox("Send Email to Production Support?", vbYesNo + vbQuestion, "Email about to be sent"
Select Case intAnswer
Case vbYes
With OutlookEmail
.Recipients.Add ("helpdesk"
.Subject = SubjectString
.Body = BodyString
.Importance = olImportanceHigh
.Send
End With
End Select
Else
TaskString = "# " & CallID & " / " & SeverityType & " / " & SubjectType
SubjectString = "# " & CallID & " / " & SeverityType & " / " & SubjectType & " - Added to Helpdesk Tasks. Please Check."
With OutlookTask
.Owner = "helpdesk"
.Subject = TaskString
.Body = NotesString
.Categories = CategoryString
.Display
End With
intAnswer = MsgBox("Send Email to Production Support?", vbYesNo + vbQuestion, "Email about to be sent"
Select Case intAnswer
Case vbYes
With OutlookEmail
.Recipients.Add ("helpdesk"
.Subject = SubjectString
.Body = BodyString
.Send
End With
End Select
End If
Else
MsgBox "Task already created for this Call ID." _
, , "Can't Create Duplicate Task"
End If
Else
MsgBox "Task can't be created w/o Notes." _
, , "Can't Create Task"
End If
End Function
ANY help will be greatly appreciated.