iPhone and Fix it Script

Hello everyone…

Using iMap on your iPhone with your Lotus account works fine for simple mail management.

But since version 2.x of the iPhone firmware, Apple has introduced a bug.

Since I’m a apple iphone customer, I’m not to be believed as is usual with Apple.

Problem.

If you delete a message from your mail box with the iPhone, the message is copied to the “deleted message” folder (as it should), but the message still remains in the inbox. This only started with the firmware 2.x upgrades.

I’ve created a script to fix that, but would like to know if a view exists or not.

ie… set view = db.GetView (“ViewName”)

if view ISNull then exit else…

How would you do this?

Anyway here is my current interation of this script for all who wish to use it or change as they see fit.

Set it to run when document is modified in the deleted messages folder or on a 15 min schedule… (your choice).

Sub Initialize

Dim s As New NotesSession

Dim db As NotesDatabase

Dim view1 As NotesView

Dim view2 As NotesView

Dim doc1 As NotesDocument

Dim doc2 As NotesDocument

Dim tempDoc As NotesDocument

Dim item1 As NotesItem

Dim item2 As NotesItem



Dim sub_text1 As String

Dim sub_text2 As String



Set db = s.CurrentDatabase

Set view1 = db.GetView ("Deleted Messages")

Set doc1 = view1.GetFirstDocument



While Not ( doc1 Is Nothing )

	Set tempDoc = doc1

	Set item1 = doc1.getFirstItem ( "subject" )

	sub_text1 = item1.text

	

	Set view2 = db.GetView ("($Inbox)")

	Set doc2 = view2.GetLastDocument

	While Not (doc2 Is Nothing)

		Set tempDoc2 = doc2

		Set item2 = doc2.GetFirstItem ("subject")

		sub_text2 = item2.text

		

		If sub_text2=sub_text1 Then

			Call tempDoc2.Remove ( True )

			foundit = 1

			Goto firstWhile

		End If

		Set doc2 = view2.GetPrevDocument ( doc2 )

	Wend

firstWhile:

	Set doc1=view1.GetNextDocument ( doc1 )

	If foundit = 1 Then

		Call tempdoc.remove ( True )	

		foundit = 0

	End If

Wend

End Sub

If there is a more effecient way of doing this, I would be all ears…

thanks

Brett

Subject: iPhone and Fix it Script

db.getView(‘myView’) will return Nothing if ‘myView’ is not found. So you could say;

dim view as NotesView

set view = db.getView(‘myView’)

if not ( view is Nothing ) then

… do stuff

else

… throw error

end if

– Jeff

Subject: RE: iPhone and Fix it Script

ah yes…Thanks…

Quite obvious once I saw this…

thank you

Subject: RE: iPhone and Fix it Script

I had not noticed that folder. Thanks for the info.

Here is an agent that will remove the deleted messages.

On Error Resume Next

Dim s As New NotesSession

Call s.CurrentDatabase.GetView(“Deleted Messages”).AllEntries.RemoveAll(False)