Python Forum
[Outlook] How to delete items from To-Do List?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Outlook] How to delete items from To-Do List?
#1
Hello,

I searched the archives and elsewhere with "outlook to-do list items delete", but came back empty handed.

I'm using Outlook 2007, and need to delete items in the To-Do List section that match a given pattern. How do I do this?

import sys
import win32com.client
import re

olFolderTodo = 28

outlook = win32com.client.Dispatch("Outlook.Application")
ns = outlook.GetNamespace("MAPI")
todo_folder = ns.GetDefaultFolder(olFolderTodo)
todo_items = todo_folder.Items

p = re.compile('(https://twitter\.com/.+?)\?.+')

for i in range(0, 0 + len(todo_items)):
    item = u'{0}'.format(todo_items[i])
    m = p.search(item)
    if m:
        print(m.group(1))

        #HERE
Thank you.
Reply
#2
This might sound dumb, but are the items actually in outlook? Or are they stored on the imap/exchange server?

I don't know about to-do items, but Outlook does weird things with iCal events, like copying them locally and ignoring remote changes.

That said, it looks like most of your code is copied from this stack overflow answer: https://stackoverflow.com/a/19044929
Which links to this article: https://www.add-in-express.com/creating-...et-delete/

The article has examples of how to delete tasks. ie: it might be as simple as item.Delete().
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to parse and group hierarchical list items from an unindented string in Python? ann23fr 0 179 Mar-27-2024, 01:16 PM
Last Post: ann23fr
  Search Outlook Inbox for set of values cubangt 1 1,063 Jun-28-2023, 09:29 PM
Last Post: cubangt
  Save image from outlook email cubangt 1 694 Jun-07-2023, 06:52 PM
Last Post: cubangt
  Why do I have to repeat items in list slices in order to make this work? Pythonica 7 1,321 May-22-2023, 10:39 PM
Last Post: ICanIBB
  Delete strings from a list to create a new only number list Dvdscot 8 1,512 May-01-2023, 09:06 PM
Last Post: deanhystad
  Finding combinations of list of items (30 or so) LynnS 1 872 Jan-25-2023, 02:57 PM
Last Post: deanhystad
  For Word, Count in List (Counts.Items()) new_coder_231013 6 2,576 Jul-21-2022, 02:51 PM
Last Post: new_coder_231013
  How to get list of exactly 10 items? Mark17 1 2,504 May-26-2022, 01:37 PM
Last Post: Mark17
  how to assign items from a list to a dictionary CompleteNewb 3 1,567 Mar-19-2022, 01:25 AM
Last Post: deanhystad
  Mark outlook emails as read using Python! shane88 2 6,543 Feb-24-2022, 11:19 PM
Last Post: Pedroski55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020