473,781 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating new Journal item in Outlook

Everytime I use this code:

Dim objOutlook As New Outlook.Applica tion
Dim objNameSpace As Outlook.NameSpa ce
Dim objFolder As Outlook.MAPIFol der
Dim objJournalEntry As Outlook.Journal Item =
DirectCast(objO utlook.CreateIt em(Outlook.OlIt emType.olJourna lItem),
Outlook.Journal Item)
objJournalEntry .Subject = "TEST!"
objNameSpace = objOutlook.GetN amespace("MAPI" )
objFolder =
objNameSpace.Ge tDefaultFolder( Outlook.OlDefau ltFolders.olFol derJournal)
objFolder.Items .Add(objJournal Entry)

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

An unhandled exception of type 'System.Argumen tException' occurred in
WindowsApplicat ion4.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 3760
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(objJournal Entry) 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.Journal Item =
DirectCast(objO utlook.CreateIt em(Outlook.OlIt emType.olJourna lItem),
Outlook.Journal Item) ... objFolder.Items .Add(objJournal Entry)
Try:
Dim objJournalEntry As Outlook.Journal Item _
= DirectCast( _
objFolder.Items .Add(Outlook.Ol ItemType.olJour nalItem), _
Outlook.Journal Item)

Hope this helps
Jay

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

Dim objOutlook As New Outlook.Applica tion
Dim objNameSpace As Outlook.NameSpa ce
Dim objFolder As Outlook.MAPIFol der
Dim objJournalEntry As Outlook.Journal Item =
DirectCast(objO utlook.CreateIt em(Outlook.OlIt emType.olJourna lItem),
Outlook.Journal Item)
objJournalEntry .Subject = "TEST!"
objNameSpace = objOutlook.GetN amespace("MAPI" )
objFolder =
objNameSpace.Ge tDefaultFolder( Outlook.OlDefau ltFolders.olFol derJournal)
objFolder.Items .Add(objJournal Entry)

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

An unhandled exception of type 'System.Argumen tException' occurred in
WindowsApplicat ion4.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
1500
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 Francisco Bay Gazette, which are produced exclusively by our joint staffs to serve the Northeast and West Coast areas - with additional non-mainline media perspective. News stories and columns are researched, thoughtful and blend politics with...
3
2352
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 outlook application object.
0
5089
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 stored in Outlook. Do you want to allow this? 2. This file is created in a specific manner. I mean entries are made
5
2290
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 collection object -- say, a dictionary. Populating that collection object with custom objects, say, Person. What I really want to see is how to populate the properties of those Person objects from a datasource: instantiate one Person, fill...
0
1742
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 be creating. There is a distribution list item object, but no dsitribution list object to contain the items!
4
2457
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 folder and refer to each as .Item(n) Say for example, my folder contained MailItem and PostItem -- I could treat each differently by casting .Item(n) differently.
9
28830
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 message (...another program is attempting to automatically email...) that requires user intervention before the macro will finish execution. Can anyone advise me on how to disable the Outlook warning? I tried the Warnings Off function but realized it...
0
987
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 development.. and now it's like.. now I just can't find this option anywhere. THanks -Aaron
1
4678
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 As New Outlook.Application Dim objNS As Outlook.NameSpace Dim objRecip As Outlook.Recipient Dim objFolder As Outlook.MAPIFolder objNS = objolApp.GetNamespace("MAPI")
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10308
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10076
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9939
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8964
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7486
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4040
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2870
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.