How to Create Task Item in Someone Else's Task Folder 
Author Message
 How to Create Task Item in Someone Else's Task Folder

I have a small program that automatically creates a task. However, I
designed this for my assistant. This needs to create a task in a folder
other than her default folder. (She has access to my folder and I want the
task to be created in that folder.)

What do I need to midify to do this?

Thanks.

P.S. Here's the program I am using.

Sub CallLog()

    Set MyTaskItem = Application.CreateItem(olTaskItem)
    With MyTaskItem
        .Subject = " "

        .Body = "Call received on " & Date & " at [time]." & Chr(13) &
Chr(13) & _
        "[Message]"
        .Display
    End With

    AppActivate ("  - Task")

    Set MyTaskItem = Nothing

End Sub



Mon, 28 Mar 2005 02:37:43 GMT  
 How to Create Task Item in Someone Else's Task Folder
Use Namespace.GetSharedDefaultFolder(Recipient, olFolderTask), then
MAPIFolder.Items.Add to create a task

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool



Quote:
> I have a small program that automatically creates a task. However, I
> designed this for my assistant. This needs to create a task in a folder
> other than her default folder. (She has access to my folder and I want the
> task to be created in that folder.)

> What do I need to midify to do this?

> Thanks.

> P.S. Here's the program I am using.

> Sub CallLog()

>     Set MyTaskItem = Application.CreateItem(olTaskItem)
>     With MyTaskItem
>         .Subject = " "

>         .Body = "Call received on " & Date & " at [time]." & Chr(13) &
> Chr(13) & _
>         "[Message]"
>         .Display
>     End With

>     AppActivate ("  - Task")

>     Set MyTaskItem = Nothing

> End Sub



Mon, 28 Mar 2005 04:28:38 GMT  
 How to Create Task Item in Someone Else's Task Folder
Dmitry:

Thanks for the input. I feel I am almost there.

I created the following module. It creates the task; however, it still
insists on creating the task in the default folder rather than the folder of
the named recipient. What am I doing wrong?

Sub CallLog()
    Dim ol As Outlook.Application
    Dim olns As Outlook.NameSpace
    Dim oSharedFolderOwner As Outlook.Recipient
    Dim oFolder As Outlook.MAPIFolder
    Dim MyTaskItem As TaskItem

    Set ol = New Outlook.Application
    Set olns = ol.GetNamespace("MAPI")
    Set oSharedFolderOwner = olns.CreateRecipient("Hyatt, Mike")
    Set oFolder = olns.GetSharedDefaultFolder(oSharedFolderOwner,
olFolderContacts)
    Set MyTaskItem = oFolder.Items.Add(olTaskItem)
    With MyTaskItem
        .Subject = " "

        .Body = "Call received on " & Date & " at [time]." & Chr(13) &
Chr(13) & _
        "[Message]"
        .Display
    End With

    AppActivate ("  - Task")

    Set ol = Nothing
    Set olns = Nothing
    Set oSharedFolderOwner = Nothing
    Set oFolder = Nothing
    Set MyTaskItem = Nothing

End Sub


Quote:
> Use Namespace.GetSharedDefaultFolder(Recipient, olFolderTask), then
> MAPIFolder.Items.Add to create a task

> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy  - Outlook, CDO
> and MAPI Developer Tool



> > I have a small program that automatically creates a task. However, I
> > designed this for my assistant. This needs to create a task in a folder
> > other than her default folder. (She has access to my folder and I want
the
> > task to be created in that folder.)

> > What do I need to midify to do this?

> > Thanks.

> > P.S. Here's the program I am using.

> > Sub CallLog()

> >     Set MyTaskItem = Application.CreateItem(olTaskItem)
> >     With MyTaskItem
> >         .Subject = " "

> >         .Body = "Call received on " & Date & " at [time]." & Chr(13) &
> > Chr(13) & _
> >         "[Message]"
> >         .Display
> >     End With

> >     AppActivate ("  - Task")

> >     Set MyTaskItem = Nothing

> > End Sub



Mon, 28 Mar 2005 04:52:25 GMT  
 How to Create Task Item in Someone Else's Task Folder
I found the problem.

==> Set oFolder = olns.GetSharedDefaultFolder(oSharedFolderOwner,
olFolderContacts)

should have been ...

==> Set oFolder = olns.GetSharedDefaultFolder(oSharedFolderOwner,
olFolderTasks)



Quote:
> Dmitry:

> Thanks for the input. I feel I am almost there.

> I created the following module. It creates the task; however, it still
> insists on creating the task in the default folder rather than the folder
of
> the named recipient. What am I doing wrong?

> Sub CallLog()
>     Dim ol As Outlook.Application
>     Dim olns As Outlook.NameSpace
>     Dim oSharedFolderOwner As Outlook.Recipient
>     Dim oFolder As Outlook.MAPIFolder
>     Dim MyTaskItem As TaskItem

>     Set ol = New Outlook.Application
>     Set olns = ol.GetNamespace("MAPI")
>     Set oSharedFolderOwner = olns.CreateRecipient("Hyatt, Mike")
>     Set oFolder = olns.GetSharedDefaultFolder(oSharedFolderOwner,
> olFolderContacts)
>     Set MyTaskItem = oFolder.Items.Add(olTaskItem)
>     With MyTaskItem
>         .Subject = " "

>         .Body = "Call received on " & Date & " at [time]." & Chr(13) &
> Chr(13) & _
>         "[Message]"
>         .Display
>     End With

>     AppActivate ("  - Task")

>     Set ol = Nothing
>     Set olns = Nothing
>     Set oSharedFolderOwner = Nothing
>     Set oFolder = Nothing
>     Set MyTaskItem = Nothing

> End Sub



> > Use Namespace.GetSharedDefaultFolder(Recipient, olFolderTask), then
> > MAPIFolder.Items.Add to create a task

> > Dmitry Streblechenko (MVP)
> > http://www.dimastr.com/
> > OutlookSpy  - Outlook, CDO
> > and MAPI Developer Tool



> > > I have a small program that automatically creates a task. However, I
> > > designed this for my assistant. This needs to create a task in a
folder
> > > other than her default folder. (She has access to my folder and I want
> the
> > > task to be created in that folder.)

> > > What do I need to midify to do this?

> > > Thanks.

> > > P.S. Here's the program I am using.

> > > Sub CallLog()

> > >     Set MyTaskItem = Application.CreateItem(olTaskItem)
> > >     With MyTaskItem
> > >         .Subject = " "

> > >         .Body = "Call received on " & Date & " at [time]." & Chr(13) &
> > > Chr(13) & _
> > >         "[Message]"
> > >         .Display
> > >     End With

> > >     AppActivate ("  - Task")

> > >     Set MyTaskItem = Nothing

> > > End Sub



Mon, 28 Mar 2005 05:34:19 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. create an e-mail mailing from a folder containing tasks items

2. Creating Folder and Tasks in Folder

3. Numbering tasks in task folder...

4. Add item to delegated task folder?

5. Creating Tasks in Task scheduler

6. How to create TASK SCHEDULER tasks

7. Creating New Task Item - VBScript

8. Create task in public folder

9. Error creating a new custom task item

10. Creating Task items

11. Create custom task items for another user

12. Activate Remeberfunction in created Task-Item

 

 
Powered by phpBB® Forum Software