473,396 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Creating new Journal item in Outlook

Everytime I use this code:

Dim objOutlook As New Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim objJournalEntry As Outlook.JournalItem =
DirectCast(objOutlook.CreateItem(Outlook.OlItemTyp e.olJournalItem),
Outlook.JournalItem)
objJournalEntry.Subject = "TEST!"
objNameSpace = objOutlook.GetNamespace("MAPI")
objFolder =
objNameSpace.GetDefaultFolder(Outlook.OlDefaultFol ders.olFolderJournal)
objFolder.Items.Add(objJournalEntry)

To create a new Journal item I get the following exception:

An unhandled exception of type 'System.ArgumentException' occurred in
WindowsApplication4.exe
Additional information: Could not complete the operation. One or more
parameter values are not valid.

I'm using the Outlook 10.0 object model.

Anyone know what I'mm doing wrong. Are there some properties of a
JournalItem that MUST be completed before adding?

--

Cheers,

elziko
Nov 20 '05 #1
1 3729
Elziko,
Which line are you getting that error on?

Normally what I do is get a working example in Outlook VBA, then I cut &
paste that into VB.NET making any changes as needed. (or use "Tools -
Upgrade VB6 code" available in VS.NET 2003).

This way I know its not some strange interop issue.
objFolder.Items.Add(objJournalEntry) The Items.Add method takes the OlItemType enum which is the type of item to
CREATE or it takes a string which is the message class. It does not accept
an Outlook JournalItem.

Instead of: Dim objJournalEntry As Outlook.JournalItem =
DirectCast(objOutlook.CreateItem(Outlook.OlItemTyp e.olJournalItem),
Outlook.JournalItem) ... objFolder.Items.Add(objJournalEntry)
Try:
Dim objJournalEntry As Outlook.JournalItem _
= DirectCast( _
objFolder.Items.Add(Outlook.OlItemType.olJournalIt em), _
Outlook.JournalItem)

Hope this helps
Jay

"elziko" <el****@NOTSPAMMINGyahoo.co.uk> wrote in message
news:3f***********************@news.easynet.co.uk. .. Everytime I use this code:

Dim objOutlook As New Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim objJournalEntry As Outlook.JournalItem =
DirectCast(objOutlook.CreateItem(Outlook.OlItemTyp e.olJournalItem),
Outlook.JournalItem)
objJournalEntry.Subject = "TEST!"
objNameSpace = objOutlook.GetNamespace("MAPI")
objFolder =
objNameSpace.GetDefaultFolder(Outlook.OlDefaultFol ders.olFolderJournal)
objFolder.Items.Add(objJournalEntry)

To create a new Journal item I get the following exception:

An unhandled exception of type 'System.ArgumentException' occurred in
WindowsApplication4.exe
Additional information: Could not complete the operation. One or more
parameter values are not valid.

I'm using the Outlook 10.0 object model.

Anyone know what I'mm doing wrong. Are there some properties of a
JournalItem that MUST be completed before adding?

--

Cheers,

elziko

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dianne Combs | last post by:
Dear Online Reader or Editor ... If you could ... please take a look at our new online treeless edition newspapers, The Northeast Progressive Advocate-Journal and our sister newspaper the San...
3
by: W Akthar | last post by:
Hi I am trying to create a windows service which queries SQL Server on timed intervals and depending on the results send appointments to Outlook. The problem lies when I try to create an...
0
by: saurabhaggarwal | last post by:
Hi I am trying to create a .ics file. Problems I have with this are................. 1. For few fields it gives me following message A program is trying to access e-mail addressess you have...
5
by: | last post by:
Trying to learn about manipulating collections of objects, and populating these objects dynamically from datasources. Could someone post a code sample that shows the following: Instantiating a...
0
by: Jason James | last post by:
Hi all, does anyone have any suggestions as to the steps involved in creating a DL using VB.Net. I have some Outlook automation experience but I'm not sure what the objects are that I should...
4
by: John A. Bailo | last post by:
After upgrading from Outlook 2000 to the 2003 object model, some of my Outlook automation code no longer functions. For example, in 2000, I used to be able to loop through a list of .Items in a...
9
by: JBuckner | last post by:
My macro uses the Send Object (VBA Item.Send) function to email a spreadsheet to an Outlook contact list. I want the function to be completely automatic but Outlook displays a security warning...
0
by: aaron.kempf | last post by:
Hey do you guys know how to enable Visual Studio to sync with the 'outlook journal'? I've been keeping track of my time for the past decade by using Outlook to keep track of my Access...
1
by: chrisli | last post by:
Hey, i have written this code to read all Outlook Appointments from another user and fill them into my DGV. Public Sub ReadOtherUserAppointment(ByVal UserName As String) Dim objolApp...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.