Help!

Updating a TASK

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA RSS
Next:  Modify all calendar items to be Private using VBA  
Author Message
Rick Cassani
External


Since: Aug 19, 2004
Posts: 3



PostPosted: Fri Dec 10, 2004 11:03 am    Post subject: Updating a TASK
Archived from groups: microsoft>public>outlook>program_vba (more info?)

All,
I've created an Outlook Task from Great Plains via VBA. The application now
calls for the ability to modify the Due Date. Is there a way to identify,
find, and modify the due date on the Task I've already created?

Thanks,
Rick
Back to top
Eric Legault [MVP - Outlo
External


Since: Apr 22, 2004
Posts: 778



PostPosted: Fri Dec 10, 2004 11:03 am    Post subject: RE: Updating a TASK [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Here's a macro to retrieve a Task by its subject line in your default Tasks
folder and set the DueDate property:

Sub UpdateTaskDueDate()
On Error Resume Next

Dim objTask As Outlook.TaskItem, objTaskFolder As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace, objItems As Outlook.Items

Set objNS = Application.GetNamespace("MAPI")
Set objTaskFolder = objNS.GetDefaultFolder(olFolderTasks)
Set objItems = objTaskFolder.Items.Restrict("[Subject] = 'Task Subject
Text')

If Not objItems.Count = 0 Then
Set objTask = objItems.Item(1)
objTask.DueDate = #12/31/2004#
objTask.Save
End If

Set objNS = Nothing
Set objTaskFolder = Nothing
Set objTask = Nothing
Set objItems = Nothing
End Sub

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: <a style='text-decoration: underline;' href="http://www.imaginets.com" target="_blank">http://www.imaginets.com</a>
Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/" target="_blank">http://blogs.officezealot.com/legault/</a>

"Rick Cassani" wrote:

 > All,
 > I've created an Outlook Task from Great Plains via VBA. The application now
 > calls for the ability to modify the Due Date. Is there a way to identify,
 > find, and modify the due date on the Task I've already created?
 >
 > Thanks,
 > Rick
 >
 >
 ><!-- ~MESSAGE_AFTER~ -->
Back to top
Ken Slovak - [MVP - Outlo
External


Since: Oct 17, 2003
Posts: 3355



PostPosted: Fri Dec 10, 2004 1:01 pm    Post subject: Re: Updating a TASK [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

TaskItem.DueDate is the property you need to change. You can find the task
by checking each item in the folder for an item with the subject of the task
you created, or you can look at some other distinct property.

To avoid looping through each item you can use Find, see <a style='text-decoration: underline;' href="http://www.outlookcode.com" target="_blank">www.outlookcode.com</a>
for syntax for that. If you have the original item and can access it you can
get its EntryID property and use that with the NameSpace.GetItemFromID
method to get the task directly.

--
Ken Slovak
[MVP - Outlook]
<a style='text-decoration: underline;' href="http://www.slovaktech.com" target="_blank">http://www.slovaktech.com</a>
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
<a style='text-decoration: underline;' href="http://www.slovaktech.com/products.htm" target="_blank">http://www.slovaktech.com/products.htm</a>


"Rick Cassani" <rcassani.RemoveThis@progrp.com> wrote in message
news:uAtHtHt3EHA.4004@tk2msftngp13.phx.gbl...
 > All,
 > I've created an Outlook Task from Great Plains via VBA. The application
now
 > calls for the ability to modify the Due Date. Is there a way to identify,
 > find, and modify the due date on the Task I've already created?
 >
 > Thanks,
 > Rick
 >
 ><!-- ~MESSAGE_AFTER~ -->
Back to top
Rick Cassani
External


Since: Aug 19, 2004
Posts: 3



PostPosted: Fri Dec 10, 2004 2:57 pm    Post subject: Re: Updating a TASK [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Did I mention that the Task does not exist on the same PC as the
application? I assigned the Task to a Recipient. So... can I still retrieve
the specific Task from someone else's default folder?


"Eric Legault [MVP - Outlook]" <elegaultZZZ.DeleteThis@REMOVEZZZmvps.org> wrote in
message news:3CBEF8E5-C47B-44AF-9128-E0FA3EAA9B75@microsoft.com...
 > Here's a macro to retrieve a Task by its subject line in your default
Tasks
 > folder and set the DueDate property:
 >
 > Sub UpdateTaskDueDate()
 > On Error Resume Next
 >
 > Dim objTask As Outlook.TaskItem, objTaskFolder As Outlook.MAPIFolder
 > Dim objNS As Outlook.NameSpace, objItems As Outlook.Items
 >
 > Set objNS = Application.GetNamespace("MAPI")
 > Set objTaskFolder = objNS.GetDefaultFolder(olFolderTasks)
 > Set objItems = objTaskFolder.Items.Restrict("[Subject] = 'Task Subject
 > Text')
 >
 > If Not objItems.Count = 0 Then
 > Set objTask = objItems.Item(1)
 > objTask.DueDate = #12/31/2004#
 > objTask.Save
 > End If
 >
 > Set objNS = Nothing
 > Set objTaskFolder = Nothing
 > Set objTask = Nothing
 > Set objItems = Nothing
 > End Sub
 >
 > --
 > Eric Legault - B.A, MCP, MCSD, Outlook MVP
 > --------------------------------------------------
 > {Private e-mails ignored}
<font color=purple> > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=purple> > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
 >
 > "Rick Cassani" wrote:
 >
  > > All,
  > > I've created an Outlook Task from Great Plains via VBA. The application
now
  > > calls for the ability to modify the Due Date. Is there a way to
identify,
  > > find, and modify the due date on the Task I've already created?
  > >
  > > Thanks,
  > > Rick
  > >
  > >
  > ><!-- ~MESSAGE_AFTER~ -->
Back to top
Eric Legault [MVP - Outlo
External


Since: Apr 22, 2004
Posts: 778



PostPosted: Fri Dec 10, 2004 2:57 pm    Post subject: Re: Updating a TASK [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I assume you are using Exchange? If so, and they have delegated Author
permissions on their Tasks folder, you can use the GetSharedDefaultFolder
method instead of GetDefaultFolder (passing the appropriate Recipient and
FolderType arguments).

See the GetSharedDefaultFolder method section of the Outlook VBA help file
for a good example.

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: <a style='text-decoration: underline;' href="http://www.imaginets.com" target="_blank">http://www.imaginets.com</a>
Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/" target="_blank">http://blogs.officezealot.com/legault/</a>

"Rick Cassani" wrote:

 > Did I mention that the Task does not exist on the same PC as the
 > application? I assigned the Task to a Recipient. So... can I still retrieve
 > the specific Task from someone else's default folder?
 >
 >
 > "Eric Legault [MVP - Outlook]" <elegaultZZZ DeleteThis @REMOVEZZZmvps.org> wrote in
 > message news:3CBEF8E5-C47B-44AF-9128-E0FA3EAA9B75@microsoft.com...
  > > Here's a macro to retrieve a Task by its subject line in your default
 > Tasks
  > > folder and set the DueDate property:
  > >
  > > Sub UpdateTaskDueDate()
  > > On Error Resume Next
  > >
  > > Dim objTask As Outlook.TaskItem, objTaskFolder As Outlook.MAPIFolder
  > > Dim objNS As Outlook.NameSpace, objItems As Outlook.Items
  > >
  > > Set objNS = Application.GetNamespace("MAPI")
  > > Set objTaskFolder = objNS.GetDefaultFolder(olFolderTasks)
  > > Set objItems = objTaskFolder.Items.Restrict("[Subject] = 'Task Subject
  > > Text')
  > >
  > > If Not objItems.Count = 0 Then
  > > Set objTask = objItems.Item(1)
  > > objTask.DueDate = #12/31/2004#
  > > objTask.Save
  > > End If
  > >
  > > Set objNS = Nothing
  > > Set objTaskFolder = Nothing
  > > Set objTask = Nothing
  > > Set objItems = Nothing
  > > End Sub
  > >
  > > --
  > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
  > > --------------------------------------------------
  > > {Private e-mails ignored}
<font color=green>  > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=green>  > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
  > >
  > > "Rick Cassani" wrote:
  > >
   > > > All,
   > > > I've created an Outlook Task from Great Plains via VBA. The application
 > now
   > > > calls for the ability to modify the Due Date. Is there a way to
 > identify,
   > > > find, and modify the due date on the Task I've already created?
   > > >
   > > > Thanks,
   > > > Rick
   > > >
   > > >
   > > >
 >
 >
 ><!-- ~MESSAGE_AFTER~ -->
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum