V
Visual Systems AB \(Martin Arvidsson\)
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.Office.Interop.Outlook.TaskItem' to 'ref
Microsoft.Office.Interop.Outlook.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(string taskID, ref Outlook.TaskItem task)
{
task = (Outlook.TaskItem)_mapiFolderTask.Session.GetItemFromID(taskID,
_mapiFolderTask.StoreID);
// True if taskID and the searchedID
return (taskID == task.EntryID.ToString());
}
public string AddTask(string subject,
DateTime intDate, DateTime dueDate,
string status, string priority, string entryID)
{
Outlook.TaskItem Task = (Outlook.TaskItem)
_Outlook.CreateItem(Outlook.OlItemType.olTaskItem);
FindTaskByID(entryID, Task);
**** CODE END *****
Regards
Martin
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.Office.Interop.Outlook.TaskItem' to 'ref
Microsoft.Office.Interop.Outlook.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(string taskID, ref Outlook.TaskItem task)
{
task = (Outlook.TaskItem)_mapiFolderTask.Session.GetItemFromID(taskID,
_mapiFolderTask.StoreID);
// True if taskID and the searchedID
return (taskID == task.EntryID.ToString());
}
public string AddTask(string subject,
DateTime intDate, DateTime dueDate,
string status, string priority, string entryID)
{
Outlook.TaskItem Task = (Outlook.TaskItem)
_Outlook.CreateItem(Outlook.OlItemType.olTaskItem);
FindTaskByID(entryID, Task);
**** CODE END *****
Regards
Martin