A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Create a new field in Outlook?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 6th 09, 03:36 AM posted to microsoft.public.outlook.program_forms
Robby
external usenet poster
 
Posts: 5
Default Create a new field in Outlook?

Hello,

Is there any way to create/add a new field in MS Outlook. Basically I just
want to import a field that exists in one of my Access tables to Outlook.

All help appreciated!

--
Best regards
Roberto
Ads
  #2  
Old January 6th 09, 02:52 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Create a new field in Outlook?

You can create what's called a UserProperty on items, but the export/import
function won't import custom properties. You would have to write your own
code to do that.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Robby" wrote in message
...
Hello,

Is there any way to create/add a new field in MS Outlook. Basically I just
want to import a field that exists in one of my Access tables to Outlook.

All help appreciated!

--
Best regards
Roberto


  #3  
Old January 6th 09, 05:24 PM posted to microsoft.public.outlook.program_forms
Robby
external usenet poster
 
Posts: 5
Default Create a new field in Outlook?

I am familiar with C/C++/Win32 programming. Is it very difficult to write my
own code to import a new field in Outlook from access ?


--
Best regards
Roberto


"Ken Slovak - [MVP - Outlook]" wrote:

You can create what's called a UserProperty on items, but the export/import
function won't import custom properties. You would have to write your own
code to do that.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Robby" wrote in message
...
Hello,

Is there any way to create/add a new field in MS Outlook. Basically I just
want to import a field that exists in one of my Access tables to Outlook.

All help appreciated!

--
Best regards
Roberto



  #4  
Old January 6th 09, 10:21 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Create a new field in Outlook?

Outlook code is completely different than usual Win32 programming, you have
to know the Outlook object model and in this case the Access object model. I
don't do C++ so I couldn't help with that.

You can look at the information and tons of samples at www.outlookcode.com
for Access importing samples, but I'd guess they are all or almost all in
VBA/VB/C#/VB.NET code.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Robby" wrote in message
...
I am familiar with C/C++/Win32 programming. Is it very difficult to write
my
own code to import a new field in Outlook from access ?


--
Best regards
Roberto


  #5  
Old January 6th 09, 11:10 PM posted to microsoft.public.outlook.program_forms
Robby
external usenet poster
 
Posts: 5
Default Create a new field in Outlook?

hello Ken,

I used to do alot of VBA.... 4 years ago. Unfortunately, its sort of
forgotten!

I simply need to map and import a new field from my Access tables. I was
hoping for a one or two line snippet sample of code in VBA coded in a macro.
From the little that I remember about VBA, I am sure it isn't that
complicated.

In one post a felow said to use:

MailItem.UserProperties

But how, what procedures.... do I create a macro in outlook and so forth ?

The only reason I wanted to do this is so I can bring in a feild from Access
to Outlook and then allow synchronization with a Blackberry.

If anyone can gracefully post a simple sample that allows Outlook to import
a new field, I would really appreciate it.


--
Best regards
Roberto


"Ken Slovak - [MVP - Outlook]" wrote:

Outlook code is completely different than usual Win32 programming, you have
to know the Outlook object model and in this case the Access object model. I
don't do C++ so I couldn't help with that.

You can look at the information and tons of samples at www.outlookcode.com
for Access importing samples, but I'd guess they are all or almost all in
VBA/VB/C#/VB.NET code.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Robby" wrote in message
...
I am familiar with C/C++/Win32 programming. Is it very difficult to write
my
own code to import a new field in Outlook from access ?


--
Best regards
Roberto



  #6  
Old January 7th 09, 03:38 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Create a new field in Outlook?

Well, it's hard to even supply a code snippet without know more about what
you want. For example is this for contact items or task or appointment items
or what? Is this for every item in a folder or selected items? Be more
detailed in describing your requirements.

At a very basic level assuming you have a macro (VBA Outlook Sub) that has a
ContactItem called oContact and you have an ADO recordset with the field you
want, one named "Foobar" that's a text field and you want to add that
property from the recordset to the oContact item, that would look like this:

' oRST is an ADOB.Recordset already instantiated and filled

Dim oProp As Outlook.UserProperty
Set oProp = oContact.UserProperties("Foobar")
If (oProp Is Nothing) Then
Set oProp = oContact.UserProperties.Add("Foobar", olText, True)
End If
oProp.Value = oRST.Fields("Foobar")
oContact.Save

Of course a DAO recordset would be slightly different, and that snippet
doesn't cover selecting the items to update, getting the recordset and so
on.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Robby" wrote in message
...
hello Ken,

I used to do alot of VBA.... 4 years ago. Unfortunately, its sort of
forgotten!

I simply need to map and import a new field from my Access tables. I was
hoping for a one or two line snippet sample of code in VBA coded in a
macro.
From the little that I remember about VBA, I am sure it isn't that
complicated.

In one post a felow said to use:

MailItem.UserProperties

But how, what procedures.... do I create a macro in outlook and so forth
?

The only reason I wanted to do this is so I can bring in a feild from
Access
to Outlook and then allow synchronization with a Blackberry.

If anyone can gracefully post a simple sample that allows Outlook to
import
a new field, I would really appreciate it.


--
Best regards
Roberto


  #7  
Old January 9th 09, 02:59 AM posted to microsoft.public.outlook.program_forms
Robby
external usenet poster
 
Posts: 5
Default Create a new field in Outlook?

Hello Ken,

Thanks for replying!

Okay, I have a table called xxx which is created in an Access database
called LS. This table contains a field that does not exist in the contact
items of MS Outlook. The field is called "TBK_Comment". I would like to
import all the fields from this table including the TBK_Comment field. I
really don't need more that this, except that in the future I my require to
bring over several fields instead of one field.

So basically now, if I import the table from Access into MS Outook, I am
able to import all the fields except the one that does not exist in Outlook.

So my question to you is, If I use the snippet of code you suppiled:

==========================================
Dim oProp As Outlook.UserProperty
Set oProp = oContact.UserProperties("TBK_Comment")
If (oProp Is Nothing) Then
Set oProp = oContact.UserProperties.Add("TBK_Comment", olText, True)
End If
oProp.Value = oRST.Fields("TBK_Comment")
oContact.Save
============================================

will this import the TBK_Comment field only? Suppose I would like to import
all the fields including the TBK_Comment field?

Also, does this snippet of code have to be inserted in a VBA macro?
at ToolsMacroMacros ?

Thanks for your help!

--
Best regards
Roberto


"Ken Slovak - [MVP - Outlook]" wrote:

Well, it's hard to even supply a code snippet without know more about what
you want. For example is this for contact items or task or appointment items
or what? Is this for every item in a folder or selected items? Be more
detailed in describing your requirements.

At a very basic level assuming you have a macro (VBA Outlook Sub) that has a
ContactItem called oContact and you have an ADO recordset with the field you
want, one named "Foobar" that's a text field and you want to add that
property from the recordset to the oContact item, that would look like this:

' oRST is an ADOB.Recordset already instantiated and filled

Dim oProp As Outlook.UserProperty
Set oProp = oContact.UserProperties("Foobar")
If (oProp Is Nothing) Then
Set oProp = oContact.UserProperties.Add("Foobar", olText, True)
End If
oProp.Value = oRST.Fields("Foobar")
oContact.Save

Of course a DAO recordset would be slightly different, and that snippet
doesn't cover selecting the items to update, getting the recordset and so
on.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Robby" wrote in message
...
hello Ken,

I used to do alot of VBA.... 4 years ago. Unfortunately, its sort of
forgotten!

I simply need to map and import a new field from my Access tables. I was
hoping for a one or two line snippet sample of code in VBA coded in a
macro.
From the little that I remember about VBA, I am sure it isn't that
complicated.

In one post a felow said to use:

MailItem.UserProperties

But how, what procedures.... do I create a macro in outlook and so forth
?

The only reason I wanted to do this is so I can bring in a feild from
Access
to Outlook and then allow synchronization with a Blackberry.

If anyone can gracefully post a simple sample that allows Outlook to
import
a new field, I would really appreciate it.


--
Best regards
Roberto



  #8  
Old January 9th 09, 03:02 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Create a new field in Outlook?

Again, the import dialog won't import custom fields. So if you get your
table from Access as a recordset you first have to get each matching
existing contact for each table row before you can get to the custom field.

If the contacts to be imported don't exist you can use the Access table to
create the contacts one by one.

The code I showed gets one field from a recordset and sets that field in a
previously selected contact. The code would be in a VBA macro.

Let's say the contacts exist already and they are in the default Contacts
folder, and that you already have your Access recordset with fields for your
custom property and also for name or other identifying characteristics. This
would get your entire collection of Contacts:

Dim oFolder As Outlook.MAPIFolder
Dim colItems As Outlook.Items
Dim oNS As Outlook.NameSpace

Set oNS = Application.GetNameSpace("MAPI")
Set oFolder = oNS.GetDefaultFolder(olFolderContacts)
Set colItems = oFolder.Items

Then you'd need code to look at each contact in the Items and try to match
it with a row in your recordset. For iterating the Outlook Items:

Dim oContact As Outlook.ContactItem
For Each oContact In colItems

You'd then search the recordset for a matching contact row and once you have
that you'd be able to use the code I originally showed.

If you have any distribution lists in your folder that would fire an error
when the DL was hit and you attempted to assign it to a ContactItem object
(oContact). So you'd also need code to allow for that. A simple On Error
Resume Next and a test for oContact Is Nothing would work as a prerequisite
to getting into the loop code.

You might want to look at the database code samples at www.outlookcode.com
for various samples of doing this sort of thing with Outlook code.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Robby" wrote in message
...
Hello Ken,

Thanks for replying!

Okay, I have a table called xxx which is created in an Access database
called LS. This table contains a field that does not exist in the contact
items of MS Outlook. The field is called "TBK_Comment". I would like to
import all the fields from this table including the TBK_Comment field. I
really don't need more that this, except that in the future I my require
to
bring over several fields instead of one field.

So basically now, if I import the table from Access into MS Outook, I am
able to import all the fields except the one that does not exist in
Outlook.

So my question to you is, If I use the snippet of code you suppiled:

==========================================
Dim oProp As Outlook.UserProperty
Set oProp = oContact.UserProperties("TBK_Comment")
If (oProp Is Nothing) Then
Set oProp = oContact.UserProperties.Add("TBK_Comment", olText, True)
End If
oProp.Value = oRST.Fields("TBK_Comment")
oContact.Save
============================================

will this import the TBK_Comment field only? Suppose I would like to
import
all the fields including the TBK_Comment field?

Also, does this snippet of code have to be inserted in a VBA macro?
at ToolsMacroMacros ?

Thanks for your help!

--
Best regards
Roberto


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a field mask HelenJ Outlook - Using Forms 2 April 5th 07 03:38 PM
Using C# to create a user-defined field? Mikael Add-ins for Outlook 3 March 23rd 07 08:17 PM
Outlook: how to create an import custom field map pauls Outlook - Using Contacts 0 August 12th 06 04:20 AM
How to create a custom e-mail field [email protected] Outlook - Using Contacts 0 June 28th 06 03:50 AM
how i create combination field in outlook form? regards, A.s Outlook - Using Forms 1 April 18th 06 02:02 PM


All times are GMT +1. The time now is 08:48 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.