473,588 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Q: Using the ref gives me an error...

Hi!

I'm trying to use the "ref" to return a value, see snippet below.
I execute AddTask first, this executes FindTaskByID.

The compiler gives me this error...
(55): Argument '2': cannot convert from
'Microsoft.Offi ce.Interop.Outl ook.TaskItem' to 'ref
Microsoft.Offic e.Interop.Outlo ok.TaskItem'

The general idea is to check for a task in outlook, if the task doesn't
exist, create a new task
otherwise update the existing...
public bool FindTaskByID(st ring taskID, ref Outlook.TaskIte m task)
{
task = (Outlook.TaskIt em)_mapiFolderT ask.Session.Get ItemFromID(task ID,
_mapiFolderTask .StoreID);
// True if taskID and the searchedID
return (taskID == task.EntryID.To String());
}

public string AddTask(string subject,
DateTime intDate, DateTime dueDate,
string status, string priority, string entryID)
{
Outlook.TaskIte m Task = (Outlook.TaskIt em)
_Outlook.Create Item(Outlook.Ol ItemType.olTask Item);
FindTaskByID(en tryID, Task);

**** CODE END *****

Regards
Martin
Nov 17 '05 #1
1 1366
When you call FindTaskByID, you need to specify that you
are passing the value by reference, to do so you would add
the 'ref' keyword to your call making it look something
like:

FindTaskByID(en tryID, ref Task);

Just for note, the same thing needs to be done when using
the 'out' keyword, it must be specified on both the
calling side and on the destination side.
-----Original Message-----
Hi!

I'm trying to use the "ref" to return a value, see snippet below.I execute AddTask first, this executes FindTaskByID.

The compiler gives me this error...
(55): Argument '2': cannot convert from
'Microsoft.Off ice.Interop.Out look.TaskItem' to 'ref
Microsoft.Offi ce.Interop.Outl ook.TaskItem'

The general idea is to check for a task in outlook, if the task doesn'texist, create a new task
otherwise update the existing...
public bool FindTaskByID(st ring taskID, ref Outlook.TaskIte m task){
task = (Outlook.TaskIt em) _mapiFolderTask .Session.GetIte mFromID(taskID,_mapiFolderTas k.StoreID);
// True if taskID and the searchedID
return (taskID == task.EntryID.To String());
}

public string AddTask(string subject,
DateTime intDate, DateTime dueDate,
string status, string priority, string entryID)
{
Outlook.TaskIt em Task = (Outlook.TaskIt em)
_Outlook.Creat eItem(Outlook.O lItemType.olTas kItem);
FindTaskByID(e ntryID, Task);

**** CODE END *****

Regards
Martin
.

Nov 17 '05 #2

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

Similar topics

1
714
by: sunaina | last post by:
I am doing the following query using intersect but gives me an error 'error in sql syntax. I tried using join as well but gives me similar error. In the following code still has intersect just to show exactly what I want to do. My query in mysql console is working without using intersect or join. $query_objects = ""; for ($i=0; $i<$num_questions; $i++) { if ($i != 0)
10
2485
by: George G. | last post by:
Hi there, I am busy writing a new asp.net application and I am reusing some of my existing asp functions and methods in a user control. I need access to session, request and response in some of the functions and I can't find out how to do it. Here is an example of what I do and I get the following Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the...
15
18877
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract the value in timeonly format by using this command Format(now,"HH:mm:ss") But when I insert it into the Sql Server database, it embadded date value with it. the output looks like that "01/01/1900 08:59:00" in that case time is
2
74655
by: SKB | last post by:
Hi, I am absolutely new to this area. I am getting the following difficulty : Access denied for user 'ODBC'@'localhost' (using password: NO) when I try the mysql command from within the C:\Program Files\MySQL\MySQL Server 5.0\bin on the command window. Please note that the MySQL is runnging as I have tried the command NET START MySQL and it gives the following output: The requested service has already been started. More help is...
3
13016
by: amitsoni.1984 | last post by:
Hi, I have to write a code in python to read a matrix from a text file and for that i am using following code. But it gives an error saying "NameError: name 'split' is not defined". Can anyone help me with this. ------------------------------------------------- #!/usr/bin/python import numpy file = open('matrix.txt', 'r')
1
9046
by: OceanBreeze | last post by:
I am using ASP 2.0 and C# I have a TextBox control in .aspx file. <asp:TextBox ID="CityTxt" runat="server"></asp:TextBox> When I click on that text box, I want to trigger onClick event. onClick event is not in ASP 2.0 and gives error.
2
10612
by: danishce | last post by:
I want to load a form dynamically by reading Form Name from a text file using vb.net. In visual basic 6 code works fine but when i use the same code in vb.net it gives the error. The code below works perfect in visual basic 6: Dim form_name As String dim search_name() as string form_name = search_name(0) Dim obj As Form Set obj = Forms.Add(form_name) obj.Show...
14
4234
by: jcage | last post by:
Is there any tutorials online for sending email through forms? I can send an email as well as write to my MySQL database from home with the following code but not at work. I think there might be something I'm missing header-wise that keeps me from making this work on my work system. I'm using Apache 1.3, PHP 4.1 (best the IT guys could do though I'm using 5.x at home), and MySQL as the database. Thanks VERY much for any help or...
2
20706
by: adypoly | last post by:
Hi guys... I am having a typical problem in using one of the native dll in C# I'll explain what am trying to do, I've a dll written in C language which i am trying to include in my C# project, the solutions builds fine but once i try to run the program it gives an exception as "Attempted to read or write protected memory. This is often an indication that other memory is corrupt" I am passing two integer pointer variables as the...
65
3881
by: Arjen | last post by:
Hi, Form a performance perspective, is it wise to use the ref statement as much as possible? Thanks! Arjen
0
7860
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
8354
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7984
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
8223
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
6634
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...
0
5398
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
2371
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
1
1458
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1195
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.