PC Review


Reply
Thread Tools Rate Thread

Create task in Outlook folder

 
 
JayDe
Guest
Posts: n/a
 
      25th Feb 2010
I am using Access 2007 to create tasks in Outlook 2007. That works fine
except for one thing. I cannot find the right keyword for folder or
subdirectory.

I have organized my tasks in different folder and want to put the tasks I am
creating in Access in the right folder.

Here is the testcode I am working with so far:

Sub MakeOutlookTask()

Dim OutlookApp As Outlook.Application
Dim OutlookTask As Outlook.TaskItem
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookTask = OutlookApp.CreateItem(olTaskItem)

With OutlookTask
.Subject = "Fjerde Oppgave"
.Body = "Dette er detaljene i oppgaven"
.ReminderSet = True
.ReminderTime = DateAdd("n", 2, Date)
.DueDate = DateAdd("n", 5, Date)
.Categories = "MerVerdi"
.ContactNames = "Geir Alexander Olderbakk."

Here I would like to put the folder

.Save

End With

Set OutlookApp = Nothing
Set OutlookTask = Nothing

End Sub

 
Reply With Quote
 
 
 
 
Alex Dybenko
Guest
Posts: n/a
 
      25th Feb 2010
Hi,
something like this.
Set myNamespace = objOutLook.GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(13) 'olFolderTasks
Set otherFolder = myFolder.Folders("OtherTasks")

..Save 'I think you have to save item before moving it

OutlookTask.Move otherFolder

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com

"JayDe" <(E-Mail Removed)> wrote in message
newsAC021D6-9200-4557-B843-(E-Mail Removed)...
> I am using Access 2007 to create tasks in Outlook 2007. That works fine
> except for one thing. I cannot find the right keyword for folder or
> subdirectory.
>
> I have organized my tasks in different folder and want to put the tasks I
> am
> creating in Access in the right folder.
>
> Here is the testcode I am working with so far:
>
> Sub MakeOutlookTask()
>
> Dim OutlookApp As Outlook.Application
> Dim OutlookTask As Outlook.TaskItem
> Set OutlookApp = CreateObject("Outlook.Application")
> Set OutlookTask = OutlookApp.CreateItem(olTaskItem)
>
> With OutlookTask
> .Subject = "Fjerde Oppgave"
> .Body = "Dette er detaljene i oppgaven"
> .ReminderSet = True
> .ReminderTime = DateAdd("n", 2, Date)
> .DueDate = DateAdd("n", 5, Date)
> .Categories = "MerVerdi"
> .ContactNames = "Geir Alexander Olderbakk."
>
> Here I would like to put the folder
>
> .Save
>
> End With
>
> Set OutlookApp = Nothing
> Set OutlookTask = Nothing
>
> End Sub
>

 
Reply With Quote
 
JayDe
Guest
Posts: n/a
 
      25th Feb 2010
Thank you for the answer, but i am still having problems.

I think there must some problems in the declaration and creation of the
objects. Could you guid me thrue this also. This is what I tried.


Sub LagOutlookOppgave()

Dim OutlookApp As Outlook.Application
Dim OutlookTask As Outlook.TaskItem
Dim objOutLook, otherFolder, myFolder, myNamespace As Object

Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookTask = OutlookApp.CreateItem(olTaskItem)
Set myNamespace = objOutLook.GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(13) 'olFolderTasks
Set otherFolder = myFolder.Folders("Sjekkliste")



With OutlookTask
.Subject = "Fjerde Oppgave laget av Jørn"
.Body = "Dette er detaljene i oppgaven"
.ReminderSet = True
.ReminderTime = DateAdd("n", 2, Date)
.DueDate = DateAdd("n", 5, Date)
.Categories = "MerVerdi"
.ContactNames = "Geir Alexander Olderbakk."
.Save
End With

OutlookTask.Move otherFolder

Set OutlookApp = Nothing
Set OutlookTask = Nothing

End Sub



"Alex Dybenko" wrote:

> Hi,
> something like this.
> Set myNamespace = objOutLook.GetNamespace("MAPI")
> Set myFolder = myNamespace.GetDefaultFolder(13) 'olFolderTasks
> Set otherFolder = myFolder.Folders("OtherTasks")
>
> ..Save 'I think you have to save item before moving it
>
> OutlookTask.Move otherFolder
>
> --
> Best regards,
> ___________
> Alex Dybenko (MVP)
> http://accessblog.net
> http://www.PointLtd.com
>
> "JayDe" <(E-Mail Removed)> wrote in message
> newsAC021D6-9200-4557-B843-(E-Mail Removed)...
> > I am using Access 2007 to create tasks in Outlook 2007. That works fine
> > except for one thing. I cannot find the right keyword for folder or
> > subdirectory.
> >
> > I have organized my tasks in different folder and want to put the tasks I
> > am
> > creating in Access in the right folder.
> >
> > Here is the testcode I am working with so far:
> >
> > Sub MakeOutlookTask()
> >
> > Dim OutlookApp As Outlook.Application
> > Dim OutlookTask As Outlook.TaskItem
> > Set OutlookApp = CreateObject("Outlook.Application")
> > Set OutlookTask = OutlookApp.CreateItem(olTaskItem)
> >
> > With OutlookTask
> > .Subject = "Fjerde Oppgave"
> > .Body = "Dette er detaljene i oppgaven"
> > .ReminderSet = True
> > .ReminderTime = DateAdd("n", 2, Date)
> > .DueDate = DateAdd("n", 5, Date)
> > .Categories = "MerVerdi"
> > .ContactNames = "Geir Alexander Olderbakk."
> >
> > Here I would like to put the folder
> >
> > .Save
> >
> > End With
> >
> > Set OutlookApp = Nothing
> > Set OutlookTask = Nothing
> >
> > End Sub
> >

> .
>

 
Reply With Quote
 
Alex Dybenko
Guest
Posts: n/a
 
      26th Feb 2010
Hi,
looks ok, you only need to explicitly declare each var:

Dim objOutLook As Object, otherFolder As Object, myFolder As Object,
myNamespace As Object

are you getting any error?

Alex




"JayDe" <(E-Mail Removed)> wrote in message
news:7F00B53D-B4D0-4444-8F07-(E-Mail Removed)...
> Thank you for the answer, but i am still having problems.
>
> I think there must some problems in the declaration and creation of the
> objects. Could you guid me thrue this also. This is what I tried.
>
>
> Sub LagOutlookOppgave()
>
> Dim OutlookApp As Outlook.Application
> Dim OutlookTask As Outlook.TaskItem
> Dim objOutLook, otherFolder, myFolder, myNamespace As Object
>
> Set OutlookApp = CreateObject("Outlook.Application")
> Set OutlookTask = OutlookApp.CreateItem(olTaskItem)
> Set myNamespace = objOutLook.GetNamespace("MAPI")
> Set myFolder = myNamespace.GetDefaultFolder(13) 'olFolderTasks
> Set otherFolder = myFolder.Folders("Sjekkliste")
>
>
>
> With OutlookTask
> .Subject = "Fjerde Oppgave laget av Jørn"
> .Body = "Dette er detaljene i oppgaven"
> .ReminderSet = True
> .ReminderTime = DateAdd("n", 2, Date)
> .DueDate = DateAdd("n", 5, Date)
> .Categories = "MerVerdi"
> .ContactNames = "Geir Alexander Olderbakk."
> .Save
> End With
>
> OutlookTask.Move otherFolder
>
> Set OutlookApp = Nothing
> Set OutlookTask = Nothing
>
> End Sub
>
>
>
> "Alex Dybenko" wrote:
>
>> Hi,
>> something like this.
>> Set myNamespace = objOutLook.GetNamespace("MAPI")
>> Set myFolder = myNamespace.GetDefaultFolder(13) 'olFolderTasks
>> Set otherFolder = myFolder.Folders("OtherTasks")
>>
>> ..Save 'I think you have to save item before moving it
>>
>> OutlookTask.Move otherFolder
>>
>> --
>> Best regards,
>> ___________
>> Alex Dybenko (MVP)
>> http://accessblog.net
>> http://www.PointLtd.com
>>
>> "JayDe" <(E-Mail Removed)> wrote in message
>> newsAC021D6-9200-4557-B843-(E-Mail Removed)...
>> > I am using Access 2007 to create tasks in Outlook 2007. That works fine
>> > except for one thing. I cannot find the right keyword for folder or
>> > subdirectory.
>> >
>> > I have organized my tasks in different folder and want to put the tasks
>> > I
>> > am
>> > creating in Access in the right folder.
>> >
>> > Here is the testcode I am working with so far:
>> >
>> > Sub MakeOutlookTask()
>> >
>> > Dim OutlookApp As Outlook.Application
>> > Dim OutlookTask As Outlook.TaskItem
>> > Set OutlookApp = CreateObject("Outlook.Application")
>> > Set OutlookTask = OutlookApp.CreateItem(olTaskItem)
>> >
>> > With OutlookTask
>> > .Subject = "Fjerde Oppgave"
>> > .Body = "Dette er detaljene i oppgaven"
>> > .ReminderSet = True
>> > .ReminderTime = DateAdd("n", 2, Date)
>> > .DueDate = DateAdd("n", 5, Date)
>> > .Categories = "MerVerdi"
>> > .ContactNames = "Geir Alexander Olderbakk."
>> >
>> > Here I would like to put the folder
>> >
>> > .Save
>> >
>> > End With
>> >
>> > Set OutlookApp = Nothing
>> > Set OutlookTask = Nothing
>> >
>> > End Sub
>> >

>> .
>>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Outlook task in pst folder mjsef Microsoft Outlook VBA Programming 0 22nd Jun 2008 03:00 AM
Re: One simple task - Create and rename a folder - HOW! Oldgoat Windows Vista File Management 0 28th Jul 2007 07:52 PM
Re: One simple task - Create and rename a folder - HOW! Oldgoat Windows Vista File Management 0 28th Jul 2007 06:18 PM
Scripting How to create a task in public folder bbnimda Microsoft Outlook VBA Programming 4 10th Sep 2006 02:15 AM
Create a task in sub-folder of the main Tasks folder David Microsoft Outlook VBA Programming 1 11th Aug 2003 03:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:31 PM.