.NET Components for Mobility

how to create new task in pocketoutlook? - creating empty tasks

Last post 05-10-2008 8:17 AM by kedzier. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-09-2008 11:52 AM

    how to create new task in pocketoutlook? - creating empty tasks

     I've tried using the windowsmobile.pocketoutlook to create an task, in a foreach statment, and i give up.

    method that I use:

           public void AddTask(string subject, DateTime startDate)
            {
                InTheHand.WindowsMobile.PocketOutlook.OutlookSession o = Outlook;

                ith.TaskCollection tc = o.Tasks.Items;

                ith.Task t = tc.AddNew();
                tc.Add(t);
                t.Properties.Add("wfm");
                t.AddCategory("mgr");
                t.Subject = subject;
                t.StartDate = startDate;
                t.Body = "task created";
                t.Update(); 

    or

     

           public void AddTask(string subject, DateTime startDate)
            {
                InTheHand.WindowsMobile.PocketOutlook.OutlookSession o = Outlook;

                ith.TaskCollection tc = o.Tasks.Items;

                ith.Task t = tc.AddNew();


                t.Properties.Add("wfm");
                t.AddCategory("mgr");
                t.Subject = subject;
                t.StartDate = startDate;
                t.Body = "task created";
                t.Update(); 

    }

    ones work another not Big Smile  it's a lottery :)

    Can someone please post a C# or VB.NET code snippet that shows how to do it?

    Thanks!
     
    PK 
    Filed under:
  • 05-10-2008 7:46 AM In reply to

    Re: how to create new task in pocketoutlook? - creating empty tasks

    Task t = session.Tasks.Items.AddNew();

    t.Subject = subject;

    t.StartDate = startDate;

    //etc

    t.Update();

     

    The first example above is wrong because you shouldn't use AddNew and then Add with the same task - it is already part of the collection.

    Peter

    Peter Foot
    Microsoft Device Application Development MVP
    www.peterfoot.net | www.inthehand.com
  • 05-10-2008 8:17 AM In reply to

    Re: how to create new task in pocketoutlook? - creating empty tasks

    not exacly bcs, I tried to do like you write, but it dosen't work!

    it work if I do:

    t.Subject = subject;

    t.Update();

    t.StartDate = startDate;

    t.Update();

     

    Mayby it is my device I do not know! But thanks a lot for quick reply :)

    PK 

Page 1 of 1 (3 items)
Copyright © 2001-2008 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.