Rudolph Scott

I use the following code to assign values to already defined fileds

Dim theStringBuilder As New Text.StringBuilder() ' String of characters

theStringBuilder.Append(mailto:MYWORKPLACE@DOMAIN)

theStringBuilder.Append("&subject=PhoneCall")

theStringBuilder.Append("&body=my body message")

However, when I want to assign a value to one of my Custom Text boxes like 'Caller' which is just a textbox and have it displayed on the form using a line like;

theStringBuilder.Append("&Caller=NAME")

I do not see any values displayed in the textbox on the form! Stringbuilder does not seem to recognise the Custom textboxes. For some reason I can only get this to work by adding code in the VBScript window in the design view of the e-mail form, but I need this to work in Visual Basic, not VBA. Could someone tell me how to do this Thanks.



Re: Visual Studio Tools for Office Assigning values to Custom Text boxes on a new e-mail form in Outlook 2007

Sue Mosher - Outlook MVP

The mailto: protocol knows nothing about Outlook custom properties. You would need to use Outlook automation to create a MailItem object and work with its UserProperties collection.

Please note that this is a forum about Visual Studio Tools for Office. General Outlook programming questions should be posted elsewhere, such as the Microsoft Communities (newsgroups) -- e.g. microsoft.public.outlook.program_vba.





Re: Visual Studio Tools for Office Assigning values to Custom Text boxes on a new e-mail form in Outlook 2007

Rudolph Scott

I amd using VTSO. I don't want to use VBA in Outlook 2007, that's why I posted my question here. I will look into Outlook automation though.





Re: Visual Studio Tools for Office Assigning values to Custom Text boxes on a new e-mail form in Outlook 2007

Sue Mosher - Outlook MVP

No one said anything about using VBA. You're confusing the name of a newsgroup, which dates back 10 years, with its purpose.

You're using VSTO for what type of application





Re: Visual Studio Tools for Office Assigning values to Custom Text boxes on a new e-mail form in Outlook 2007

Rudolph Scott

I am using VTSO for Outlook 2007. ANy suggestions





Re: Visual Studio Tools for Office Assigning values to Custom Text boxes on a new e-mail form in Outlook 2007

Sue Mosher - Outlook MVP

Use the Folder.Items.Add method to create a new item in the Drafts folder, passing the message class for your custom form as an argument. On the returned MailItem, use its UserProperties collection to access the custom properties defined in the form. See http://www.outlookcode.com/article.aspx ID=38