Scripting How to create a task in public folder

B

bbnimda

Hi,

I created a personalised Form in outlook 2003 for my contact, il added a
button and I want by clicking on this button to create à task in the public
folder

I allready find the script to create this task in my box by using this
Sctipt

Sub CommandButton2_click()
Set myItem = Application.CreateItem(2)
myItem.Subject = "Rapport de traitement"
myItem.Display
end sub


But I didn't found the way to create it in a public folder


Ps: I now how to extract the name of th public folder

Tk's a lot

(e-mail address removed)
 
S

Sue Mosher [MVP-Outlook]

To create a new item in a non-default folder, use the Add method on the target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Post.YourFormName")

The message class argument is optional. You can use the code at http://www.outlookcode.com/d/code/getfolder.htm to walk the folder hierarchy and return the MAPIFolder corresponding to a given path string.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
B

bbnimda

Hi again, Tks for your response but it doesn't work Err Message " Missing
object "

Sub CommandButton3_click()
Set Rep2Base = Application.GetNamespace("MAPI").Folders("dossiers
publics").Folders("tous les dossiers publics").Folders("Comptes rendus")
msgbox rep2base
Set NewItem = rep2base.Items.Add("Ipm.Post.Cpt Rendu")
newitem.display
end Sub

I think this script is missing a step for creating the task ? no ?

tks


"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de news: (e-mail address removed)...
To create a new item in a non-default folder, use the Add method on the
target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Post.YourFormName")

The message class argument is optional. You can use the code at
http://www.outlookcode.com/d/code/getfolder.htm to walk the folder hierarchy
and return the MAPIFolder corresponding to a given path string.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
B

bbnimda

Thks a lot i found my error U were right.




"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de news: (e-mail address removed)...
To create a new item in a non-default folder, use the Add method on the
target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Post.YourFormName")

The message class argument is optional. You can use the code at
http://www.outlookcode.com/d/code/getfolder.htm to walk the folder hierarchy
and return the MAPIFolder corresponding to a given path string.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP-Outlook]

What statemtn raises that error?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


bbnimda said:
Hi again, Tks for your response but it doesn't work Err Message " Missing
object "

Sub CommandButton3_click()
Set Rep2Base = Application.GetNamespace("MAPI").Folders("dossiers
publics").Folders("tous les dossiers publics").Folders("Comptes rendus")
msgbox rep2base
Set NewItem = rep2base.Items.Add("Ipm.Post.Cpt Rendu")
newitem.display
end Sub

I think this script is missing a step for creating the task ? no ?

tks


"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de news: (e-mail address removed)...
To create a new item in a non-default folder, use the Add method on the
target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Post.YourFormName")

The message class argument is optional. You can use the code at
http://www.outlookcode.com/d/code/getfolder.htm to walk the folder hierarchy
and return the MAPIFolder corresponding to a given path string.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


bbnimda said:
Hi,

I created a personalised Form in outlook 2003 for my contact, il added a
button and I want by clicking on this button to create à task in the
public
folder

I allready find the script to create this task in my box by using this
Sctipt

Sub CommandButton2_click()
Set myItem = Application.CreateItem(2)
myItem.Subject = "Rapport de traitement"
myItem.Display
end sub

Ps: I now how to extract the name of th public folder
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top