Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find Folder, Remove contacts and import contacts from Ex
Message
From
17/12/2009 17:31:31
Scott Sherman
Puyallup Tribal Health Authority
Tacoma, Washington, United States
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01439064
Message ID:
01439677
Views:
32
I am having an intermittent problem with "myItem.Delete()" below. Sometimes it works great and sometimes I get an OLE error "Parameter not optional". Same computer each time. Have any idea what would cause this?

myOlApp = CREATEOBJECT("Outlook.Application")
nms = myOlApp.GetNamespace("MAPI")
myFolder = nms.GetDefaultFolder(10)

lcFolderName = "text weather"
llFolderExists = .F.
FOR EACH loFolder IN myFolder.Folders
IF loFolder.NAME = lcFolderName
llFolderExists = .T.
lcTWfolder = loFolder
EXIT
ENDIF
ENDFOR

IF NOT llFolderExists
lcTWfolder = myFolder.Folders.ADD("text weather")
ENDIF

fldContacts = lcTWfolder.Items
myItems = fldContacts.RESTRICT("[CompanyName] = 'Texting'")
FOR i=myItems.COUNT TO 1 STEP -1
myItem = myItems.ITEM(i)
IF (myItem.CLASS = 40)
myItem.Delete()
ENDIF
ENDFOR
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform