By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Add Tasks to Administrator's Outlook on Initial Use

P: n/a
I would like to have my application add administrative tasks to an
Administrator's Outlook Task Folder. I know how to get the User group of the
CurrentUser and think I can even code how to do the actual additions.

A couple of questions:

1) How do I code it so that it only occurs once - the first time the
administrator opens my app. I think I need code that checks if the tasks are
already there in Outlook and then aborts if they are.
2) Would it be a good idea to have a menu bar item that will add the tasks if
the user selects it and regardless of whether the tasks are already in
Outlook or not.
3) How do I set the Recurrence in code. Esp. something like the 4th
Wednesday of a certain month. Just the properties is all I need (ex.
ReminderTime, ReminderSet, etc.)
Thanks.

--
Message posted via http://www.accessmonster.com
May 24 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Open a module, click Tools, References, and either confirm or add a refernce
to Microsoft Outlook soemversion Library

Run this code

Public Function testaddtask()

Dim ot As Outlook.TaskItem
Dim outapp As Outlook.Application

Set outapp = New Outlook.Application
Set ot = outapp.CreateItem(olTaskItem)
ot.Subject = "Test my new item created at " & now
ot.Save
Set ot = Nothing
Set outapp = Nothing

End Function

You will find a new task in your Outlook tasks.

"rdemyan via AccessMonster.com" <u6836@uwe> wrote in message
news:60bc3d0024024@uwe...
I would like to have my application add administrative tasks to an
Administrator's Outlook Task Folder. I know how to get the User group of
the
CurrentUser and think I can even code how to do the actual additions.

A couple of questions:

1) How do I code it so that it only occurs once - the first time the
administrator opens my app. I think I need code that checks if the tasks
are
already there in Outlook and then aborts if they are.
2) Would it be a good idea to have a menu bar item that will add the tasks
if
the user selects it and regardless of whether the tasks are already in
Outlook or not.
3) How do I set the Recurrence in code. Esp. something like the 4th
Wednesday of a certain month. Just the properties is all I need (ex.
ReminderTime, ReminderSet, etc.)
Thanks.

--
Message posted via http://www.accessmonster.com

May 24 '06 #2

P: n/a
In my previous post, I wasn't sure how to do this, but here is some code
that will add the task and also loop through all the tasks to show you the
existing ones. Presumably, if you use standard text in the Subject you can
test for that and add or not add according to whether or not you find your
task.

I'm not happy about settling for "Dim otasks as object", but it's good
enough to start, and if I find the real object I'll post it. Someone else
probably already knows and will post it here pretty soon. I'd like to know
myself.

Public Function testaddtask()

Dim ot As Outlook.TaskItem
Dim otasks As Object
Dim outapp As Outlook.Application

Set outapp = New Outlook.Application
Set ot = outapp.CreateItem(olTaskItem)
ot.Subject = "Test my new item created at " & Now
ot.Save
Set otasks = ot.Parent
For Each ot In otasks.Items
Debug.Print ot.Subject
Next ot
Set otasks = Nothing

Set ot = Nothing
Set outapp = Nothing

End Function

"rdemyan via AccessMonster.com" <u6836@uwe> wrote in message
news:60bc3d0024024@uwe...
I would like to have my application add administrative tasks to an
Administrator's Outlook Task Folder. I know how to get the User group of
the
CurrentUser and think I can even code how to do the actual additions.

A couple of questions:

1) How do I code it so that it only occurs once - the first time the
administrator opens my app. I think I need code that checks if the tasks
are
already there in Outlook and then aborts if they are.
2) Would it be a good idea to have a menu bar item that will add the tasks
if
the user selects it and regardless of whether the tasks are already in
Outlook or not.
3) How do I set the Recurrence in code. Esp. something like the 4th
Wednesday of a certain month. Just the properties is all I need (ex.
ReminderTime, ReminderSet, etc.)
Thanks.

--
Message posted via http://www.accessmonster.com

May 24 '06 #3

P: n/a
Use this line:

Set otasks = outapp.GetNamespace("MAPI").GetDefaultFolder(olFol derTasks)

Instead of

Set otasks = ot.Parent

That way you don't have to already have a task item created in order to get
to the folder.

"rdemyan via AccessMonster.com" <u6836@uwe> wrote in message
news:60bc3d0024024@uwe...
I would like to have my application add administrative tasks to an
Administrator's Outlook Task Folder. I know how to get the User group of
the
CurrentUser and think I can even code how to do the actual additions.

A couple of questions:

1) How do I code it so that it only occurs once - the first time the
administrator opens my app. I think I need code that checks if the tasks
are
already there in Outlook and then aborts if they are.
2) Would it be a good idea to have a menu bar item that will add the tasks
if
the user selects it and regardless of whether the tasks are already in
Outlook or not.
3) How do I set the Recurrence in code. Esp. something like the 4th
Wednesday of a certain month. Just the properties is all I need (ex.
ReminderTime, ReminderSet, etc.)
Thanks.

--
Message posted via http://www.accessmonster.com

May 24 '06 #4

P: n/a
Last post in this vein. This one sets Subject , Body , Categories ,
ContactNames , DueDate , Importance , ReminderSet , ReminderTime , StartDate
, and Status.

Public Function testaddtask()

Dim ot As Outlook.TaskItem
Dim otasks As Object
Dim outapp As Outlook.Application

Set outapp = New Outlook.Application
Set ot = outapp.CreateItem(olTaskItem)
ot.Subject = "Test my new item created at " & Now
ot.Body = "Do this, please."
ot.Categories = "Category 1; Category 2"
ot.ContactNames = "fred;cwannall;John Smith"
ot.DueDate = DateAdd("d", 3, Date)
ot.Importance = olImportanceHigh
ot.ReminderSet = True
ot.ReminderTime = DateAdd("s", 30, Now)
ot.StartDate = Date
ot.Status = olTaskInProgress
ot.Save
Set otasks = outapp.GetNamespace("MAPI").GetDefaultFolder(olFol derTasks)
For Each ot In otasks.Items
Debug.Print ot.Subject
Next ot
Set otasks = Nothing

Set ot = Nothing
Set outapp = Nothing

End Function

May 24 '06 #5

P: n/a
Thanks, Rick.

I really appreciate it!

Rick Wannall wrote:
Last post in this vein. This one sets Subject , Body , Categories ,
ContactNames , DueDate , Importance , ReminderSet , ReminderTime , StartDate
, and Status.

Public Function testaddtask()

Dim ot As Outlook.TaskItem
Dim otasks As Object
Dim outapp As Outlook.Application

Set outapp = New Outlook.Application
Set ot = outapp.CreateItem(olTaskItem)
ot.Subject = "Test my new item created at " & Now
ot.Body = "Do this, please."
ot.Categories = "Category 1; Category 2"
ot.ContactNames = "fred;cwannall;John Smith"
ot.DueDate = DateAdd("d", 3, Date)
ot.Importance = olImportanceHigh
ot.ReminderSet = True
ot.ReminderTime = DateAdd("s", 30, Now)
ot.StartDate = Date
ot.Status = olTaskInProgress
ot.Save
Set otasks = outapp.GetNamespace("MAPI").GetDefaultFolder(olFol derTasks)
For Each ot In otasks.Items
Debug.Print ot.Subject
Next ot
Set otasks = Nothing

Set ot = Nothing
Set outapp = Nothing

End Function


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200605/1
May 24 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.