473,320 Members | 1,839 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,320 software developers and data experts.

outlook2003 add-in

Hi, I'm writing an add-in for outlook 2003 which automatically schedules the
users tasks from the task list in to the calendar with respect to priority. I
can sort the tasks by priority within the task list via;

_Items olTasks = olFolderTask.Items; // MSO items collection in folder
olTasks.Sort("[Priority]", true); // sort items by Priority before reading
int nTasksCount = olTasks.Count;
for (int i = 0; i < nTasksCount; ++i)
{
_TaskItem olItemTask;
try
{
if (i == 0) // Should be called first before
iteration start
olItemTask = (_TaskItem)olTasks.GetFirst(); //
First item
else
olItemTask = (_TaskItem)olTasks.GetNext(); //
second item

if (olItemTask.Complete) // Task allredy completed
continue;

however when I send these tasks to the calendar, the prioritsed order is
lost and the go in oder of task name instead. Any ideas?
Mar 20 '06 #1
3 1563

"Gwen" <Gw**@discussions.microsoft.com> wrote in message
news:99**********************************@microsof t.com...
Hi, I'm writing an add-in for outlook 2003 which automatically schedules
the
users tasks from the task list in to the calendar with respect to
priority. I
can sort the tasks by priority within the task list via;

_Items olTasks = olFolderTask.Items; // MSO items collection in folder
olTasks.Sort("[Priority]", true); // sort items by Priority before reading
int nTasksCount = olTasks.Count;
for (int i = 0; i < nTasksCount; ++i)
{
_TaskItem olItemTask;
try
{
if (i == 0) // Should be called first before
iteration start
olItemTask = (_TaskItem)olTasks.GetFirst(); //
First item
else
olItemTask = (_TaskItem)olTasks.GetNext(); //
second item

if (olItemTask.Complete) // Task allredy completed
continue;

however when I send these tasks to the calendar, the prioritsed order is
lost and the go in oder of task name instead. Any ideas?


I am not sure if this will help or not but is it possible to set the list of
items to the value of the sort so you have the following:

_Items olTasks = olFolderTask.Items; // MSO items collection in folder
olTasks.Sort("[Priority]", true); // sort items by Priority before reading

Could you try this instead.. Use a tmpTasks and set it like this

_Items tmpTasks = olTasks.Sort("[Priority]",true);

Then loop through using tmpTasks instead of olTasks for everything. The
tmpTasks should be in yoru order where olTasks might still really be in
their regular order.

I have seen this type of behavior before where when you call the .Sort
property it more than likely creates a type of view and doesn't really sort
the list so when you loop through it it is not in the correct order but in
the original order. Let me know if my test above does not fix your
problem. I have not tested this but hope it will help you out. Good
luck.

jjardine
Mar 20 '06 #2
Thanx j, I will give it a go and let you know.

G.

"James Jardine" wrote:



I am not sure if this will help or not but is it possible to set the list of
items to the value of the sort so you have the following:

_Items olTasks = olFolderTask.Items; // MSO items collection in folder
olTasks.Sort("[Priority]", true); // sort items by Priority before reading

Could you try this instead.. Use a tmpTasks and set it like this

_Items tmpTasks = olTasks.Sort("[Priority]",true);

Then loop through using tmpTasks instead of olTasks for everything. The
tmpTasks should be in yoru order where olTasks might still really be in
their regular order.

I have seen this type of behavior before where when you call the .Sort
property it more than likely creates a type of view and doesn't really sort
the list so when you loop through it it is not in the correct order but in
the original order. Let me know if my test above does not fix your
problem. I have not tested this but hope it will help you out. Good
luck.

jjardine

Mar 20 '06 #3
with regards to my priority sorting problem I am sorting the COM object
representations of the task items. This would have no affect on the calender
Outlook display. I believe that in the outlook interop API Microsoft
intentional excluded view control, and therefore believe that I won't be able
to adjust the view programatically in C#.

so in otherwords me thinks its impossible, right?
Mar 29 '06 #4

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

Similar topics

14
by: Stefan Mueller | last post by:
With the following code I can add a new row to an existing table. That really works great. Many thanks to all who helped me so far. But my problem is that the added cells do somehow not have the...
5
by: Mike L | last post by:
I have two questions. 1) What is the code to check if datagrid already has a datasource? When the user clicks "ADD" button I want to add a record to the data grid, if the user clicks "ADD"...
3
by: Dean Slindee | last post by:
Is there a way to replace the commented out parameter add syntax with a single line of code, like the .Parameter.Add("@Letter"...) line below (which does not work)? 'Dim prmLetter As New...
4
by: Maarten | last post by:
i have the folowing code to setup my datagrid collumns Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load gridsetup() end sub
8
by: Yuk Tang | last post by:
I am tearing my hair out over this, since I can't see what I'm doing wrong (duh, if I knew, I wouldn't be asking the question). I am adding Field items to a Field Collection, but for some reason...
3
by: Greg Scharlemann | last post by:
I'm not sure the best way to accomplish this... my hunch is with javascript, but I'm not sure if using server side code (PHP) would be easier. I'm adding people to a database. People have a...
0
by: anureddy | last post by:
help me how to add datagridview columns to another table,using windowsapplications. and set the displaymember and value member datagridviewcomboboxcolumn. i used this below code but that not...
1
by: CrazyEswar | last post by:
I am trying to open Outlook2003 address book using asp.net with c#. I am able to open contact list. But I need to open address book directly. So please provide me samle code to open Outlook2003...
0
acoder
by: acoder | last post by:
Problem The select object's add method doesn't append options to the end of the list. Browser Internet Explorer Example The Javascript code for appending an option element at the end of a...
2
by: Question123 | last post by:
<root> <Element> <add key="1" value="1"/> <add key="2" value="2"/> <add key="3" value="3"/> <add key="4" value="4"/> </Element> <Items>
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.