Custom Form to Mail Folder

R

Ruben

I create a Folder of type: Mail and Post Items.
when i custom the Message form, i need to assign this form, to the property
of the folder: "When postin to this folderm use: "
But when i assign this form to this folder, it say: "You cannot create an
item of this type in this folder".
I understand, that i cannot create message item into IPM.Post.
But when i create the folder i assign this folder to mail folder.

How can i solution that?
Thanks a lot.
 
S

Sue Mosher [MVP-Outlook]

Tell is more about how you're planning to use the form. You can't make a message form the default for a folder, because messages are intended to be saved, not posted to folders.

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

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

Ruben

i know that.
But, when i read an email, i like to write code, that tall me the extension
of an attachment if is it. Just that.
Becouse that i like to write code to an Message form.
 
S

Sue Mosher [MVP-Outlook]

Sorry, but I just can't understand what you're trying to accomplish and how you expect to use this form. Could you give a more detailed description?

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

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

Ruben

First, Sorry for my english.

Second and more simply, i need to custom Message form and publish it to the
(i.e.) Inbox Folder.
I know that is to send. Buy i need tu custom it and use it. Can you explain
me how to do that?

I.e: i need to add to the email subject a text : [MyMessage] before send it.
or some another condition.


THANKS A LOT!
 
S

Sue Mosher [MVP-Outlook]

Please explain how you want to use this form. In other words, tell us in detail what functionality it has for you, as the sender, and for the recipients. That will help us guide you to a solution.

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

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



Ruben said:
First, Sorry for my english.

Second and more simply, i need to custom Message form and publish it to the
(i.e.) Inbox Folder.
I know that is to send. Buy i need tu custom it and use it. Can you explain
me how to do that?

I.e: i need to add to the email subject a text : [MyMessage] before send it.
or some another condition.


THANKS A LOT!

Sue Mosher said:
Sorry, but I just can't understand what you're trying to accomplish and how you expect to use this form. Could you give a more detailed description?
 
R

Ruben

Hi!.
my example is just for me, not to send.
i need, when i read a message i need to see button in the command bar, that
allow me to save the attach (if is, and with extension condition) to the
MyDocument Folder in my desktop.
without open the attach.

thanks.!


Sue Mosher said:
Please explain how you want to use this form. In other words, tell us in detail what functionality it has for you, as the sender, and for the recipients. That will help us guide you to a solution.

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

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



Ruben said:
First, Sorry for my english.

Second and more simply, i need to custom Message form and publish it to the
(i.e.) Inbox Folder.
I know that is to send. Buy i need tu custom it and use it. Can you explain
me how to do that?

I.e: i need to add to the email subject a text : [MyMessage] before send it.
or some another condition.


THANKS A LOT!

Sue Mosher said:
Sorry, but I just can't understand what you're trying to accomplish and how you expect to use this form. Could you give a more detailed description?

i know that.
But, when i read an email, i like to write code, that tall me the extension
of an attachment if is it. Just that.
Becouse that i like to write code to an Message form.

:

Tell is more about how you're planning to use the form. You can't make a message form the default for a folder, because messages are intended to be saved, not posted to folders.

I create a Folder of type: Mail and Post Items.
when i custom the Message form, i need to assign this form, to the property
of the folder: "When postin to this folderm use: "
But when i assign this form to this folder, it say: "You cannot create an
item of this type in this folder".
I understand, that i cannot create message item into IPM.Post.
But when i create the folder i assign this folder to mail folder.

How can i solution that?
Thanks a lot.
 
S

Sue Mosher [MVP-Outlook]

In that case, you don't need (and shouldn't use) a form at all. Create a macro in Outlook VBA with the code you want to use to process the item, and add that macro as a custom toolbar button using the View | Customize | Toolbars command.

You can use the GetCurrentItem() function from http://www.outlookcode.com/codedetail.aspx?id=50 to return the currently open or selected item.

The method for saving attachments is Attachment.SaveAsFile. Example code is in Help.

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

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

Ruben

Thanks A lot. I will try it!.
Thanks!

Sue Mosher said:
In that case, you don't need (and shouldn't use) a form at all. Create a macro in Outlook VBA with the code you want to use to process the item, and add that macro as a custom toolbar button using the View | Customize | Toolbars command.

You can use the GetCurrentItem() function from http://www.outlookcode.com/codedetail.aspx?id=50 to return the currently open or selected item.

The method for saving attachments is Attachment.SaveAsFile. Example code is in Help.

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

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

Ruben

Hi!.
I start the code.
I have, for example, email that contain 2 attachments, one is another text,
(type=5) and the second is an image. (type<>5)

I need to do recursive function to go to the last attach in the tree.
for example:
Email -> Attach 1 -> Attach1.1 -> Image
-> Attach1.2 -> Attach 1.3 -> image
-> Image

And when i go to the last file in the attachment tree i need to save it to a
folder.

First i need to know if the Recursive Method is available to Code MAcros.
And second, i send to you my code:

Public Sub SaveAttach()
On Error Resume Next
Set Attach = GetCurrentItem.Attachments
Call RecursiveAttach(Attach)
End Sub

Public Function RecursiveAttach(Attach)
MsgBox Attach.Count
For i = 1 To Attach.Count
MsgBox i
Set CountAttach = Attach.Item(i)
MsgBox CountAttach.Type
If CountAttach.Type = 5 Then
Set SubAttach = CountAttach.Attachments ' <- THIS DONT WORK
MsgBox SubAttach.Count
Call RecursiveAttach(SubAttach)
End If
If AttachCount.Type <> 5 Then
AttachCount.SaveAsFile "D:\MyFolder\" & AttachCount.DisplayName
End If
Return
Next
End Function

Function GetCurrentItem() As Object
Dim objApp As Outlook.Application

Set objApp = CreateObject("Outlook.Application")
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
Case Else
' anything else will result in an error, which is
' why we have the error handler above
End Select

Set objApp = Nothing
End Function

THANKS A LOT!.
Ruben
 
S

Sue Mosher [MVP-Outlook]

Type=5 is an embedded Outlook item, not a text file. As with all attachments, you cannot work with that attachment directly. You must first save it as an .msg file, then you can use the Application.CreateItemFromTemplate method to create a new item that is a copy of that .msg. It is that new item's Attachments that you can work with:
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

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

Ruben

Thank You!

Can you tell me if the Vba Code allow Recursive Method of functions???

when i start this question, i ask about the custom messeage form. When i
need to assign the form that open with a inbox folder, i cant assign the
custom form message form, to the Inbox folder, because the inbox is Note, and
dont permit Message form. How can i do it???

thank you, very match!...
Ruben
 
S

Sue Mosher [MVP-Outlook]

Yes, it is possible to write recursive functions with VBA. As I explained, the problem with your code below is that the Attachment object returned from an embedded item attachment is not itself an Outlook item object. It is an Attachment object and supports only the methods of that object.

It is not possible to make a custom form the default for a folder. Message forms are meant to be sent, not posted to folders. They need to be published to the Personal Forms or Organizational Forms library. As noted earlier, a custom form would not seem to be an appropriate solution for your scenario.

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

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

Ruben

Thank You Very Match!

I want to buy your book: Microsoft Outlook Programming, Jumpstart for
Administrators, Developers, and Power Users
but i read that is for the outlook 2002. And in my work, we work with
Outlook 2003.
Questions:
1- will be a book publication of the 2003?
2- there are many differences? should i wait for the 2003 version? or i can
start with the 2002 book?

Thanks a lot!
Ruben
 
S

Sue Mosher [MVP-Outlook]

The book is quite applicable to Outlook 2003. Very little changed between the last two versions. You can read about those differences at http://www.outlookcode.com/d/ol2003problems.htm

There will be a new version for OUtlook 12.

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

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

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