Tasks

Add-in Express™ Support Service
That's what is more important than anything else

Tasks
 
SSL




Posts: 178
Joined: 2014-01-05
I am currently using ProcessBeforeItemMove, to delete tasks I save in SQL Database, all works fine if I am in tasks view in outlook.

If I switch to ToDoList, the event isn't fired, is this correct?

Regards,

Tom
Posted 30 Oct, 2014 09:11:23 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Tom,

Make sure that you connect an ADXOutlookItemsEvents to this folder: NameSpace.GetDefaultfolder(olFolderToDo).


Andrei Smolin
Add-in Express Team Leader
Posted 31 Oct, 2014 06:06:33 Top
SSL




Posts: 178
Joined: 2014-01-05
Hi Andrei,

I thought I was with :

  Private Sub adxOutlookEvents_ExplorerFolderSwitch(sender As Object, explorer As Object) Handles adxOutlookEvents.ExplorerFolderSwitch
        Dim folder As Outlook.MAPIFolder = CType(explorer, Outlook.Explorer).CurrentFolder
        If folder Is Nothing Then Exit Sub
        itemsEvents.ConnectTo(folder, True)
    End Sub


I thought connect to current folder would connect me to either tasks folder or todo folder, depending on which one I have selected.
Posted 04 Nov, 2014 09:04:20 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Tom,

Outlook doesn't generate this event when you select a task in the To-Do bar.


Andrei Smolin
Add-in Express Team Leader
Posted 04 Nov, 2014 09:22:53 Top
SSL




Posts: 178
Joined: 2014-01-05
Hi Andrei,

Am I connecting to this folder within:

 Public Overrides Sub ProcessBeforeItemMove(item As Object, moveTo As Object, e As AddinExpress.MSO.ADXCancelEventArgs)


Do you have an example.

Regards,

Tom
Posted 04 Nov, 2014 09:37:14 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Tom,

I can't remember any example referrring to the folder NameSpace.GetDefaultfolder(olFolderToDo).

Could you please explain what scenario you are testing and what the problem is?


Andrei Smolin
Add-in Express Team Leader
Posted 05 Nov, 2014 03:05:17 Top
SSL




Posts: 178
Joined: 2014-01-05
Hi Andrei,

I am using ProcessBeforeItemMove to get currently deleted task item. If I am in task view all works as it should, my task information stored in DB gets deleted, if I switch to "ToDo" view, my task info in DB doesn't get deleted.


  
 Public Overrides Sub ProcessBeforeItemMove(item As Object, moveTo As Object, e As AddinExpress.MSO.ADXCancelEventArgs)

        Dim myDeletedFolder As Outlook.MAPIFolder = CType(moveTo, Outlook.MAPIFolder)

        If moveTo Is Nothing Then


            If (TypeOf item Is Outlook.TaskItem) Then
                Dim myTask As Outlook._TaskItem = Nothing
                myTask = CType(item, Outlook._TaskItem)

                'get email property
                Dim TaskProperty = modTasks.GetUserTaskProperties(CType(myTask, Outlook.TaskItem))

                'I delete mytask item from database here, dont need to show this code, nothing to do with getting task item

            End If

        ElseIf myDeletedFolder.Name = "Deleted Items" Then
            If (TypeOf item Is Outlook.TaskItem) Then
                Dim myTask As Outlook._TaskItem = Nothing
                myTask = CType(item, Outlook._TaskItem)

                'get email property
                Dim TaskProperty = modTasks.GetUserTaskProperties(CType(myTask, Outlook.TaskItem))

                'I delete mytask item from database here, dont need to show this code, nothing to do with getting task item

            End If
        End If

    End Sub
       


Regards

Tom
Posted 05 Nov, 2014 09:06:14 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Tom,

You need to have one more instance of ADXOutlookItemsEvents. Connect this instance to the folder NameSpace.GetDefaultfolder(olFolderToDo) on add-in startup


Andrei Smolin
Add-in Express Team Leader
Posted 06 Nov, 2014 09:32:38 Top
SSL




Posts: 178
Joined: 2014-01-05
Hi Andrei,

Not sure how to do this.

One other question, I am able to catch deleted items using "BeforeItemMove" and "ProcessBeforeDelete", the issues I now have is if I delete a calendar event from my phone, none of these events are raised.

If is possible to catch "ProcessItemAdd" when something is added to "Deleted Items"

if so can you give me an example.

Regards,

Tom
Posted 12 Nov, 2014 08:08:14 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
SSL writes:
Not sure how to do this.


Below is a raw sketch:

OutlookItemsClass1 events1 = new OutlookItemsClass1(this);
events1.Connect(folder1, ...);
OutlookItemsClass1 events2 = new OutlookItemsClass1(this);
events2.Connect(folder2, ...);


SSL writes:
if I delete a calendar event from my phone


Phone? I suppose you can only find this out when the calendar is synchronized. If there's no BeforeItemMove event, then you can use the approach described in http://www.add-in-express.com/creating-addins-blog/2011/11/10/outlook-newmail-custom-solution/.

SSL writes:
If is possible to catch "ProcessItemAdd" when something is added to "Deleted Items"


I believe this event should work for that folder. But I doubt the deleted calendar events will move to the Deleted Items folder.

You can regard an OutlookItemsClass as a set of rules. The same set of rules can be applied to several folders; this is demonstrated by the code sketch above. Also, you can have several sets and connect them to different folders. So you can add another OutlookItemsClass, handle ProcessItemAdd and connect the OutlookItemsClass to the Deleted Items.


Andrei Smolin
Add-in Express Team Leader
Posted 12 Nov, 2014 08:54:11 Top