PDA

View Full Version : CDO Scripting - [E_INVALIDARG(80070057)]


GoCarr
08-15-2005, 05:05 PM
I have a script that is set to copy a public folder to a local folder. It looks like so...

servername = "servername"
mailbox = "mailbox"
pubContactsfolderid = "000...etc"
set objSession = CreateObject("MAPI.Session")
strProfile = servername & vbLf & mailbox
objSession.Logon "",,, False,, True, strProfile
Set objcontactfolder = objSession.getdefaultfolder(5)
Set objInfoStore = objSession.GetInfoStore(objSession.Inbox.StoreID)
Set objpubstore = objSession.InfoStores("Public Folders")
set objpubContactsfolder = objSession.getfolder(pubContactsfolderid,objpubstore.id)
for each objcontact in objpubContactsfolder.messages
set objCopyContact = objcontact.copyto(objcontactfolder.ID,objInfoStore.ID)
objCopyContact.Unread = false
objCopyContact.Update
Set objCopyContact = Nothing
wscript.echo objcontact.subject
next
objsession.Logoff



Except I have the real server name, mailbox and folder ID in place. I have all the rights to this folder. When I get to the bolded line of code, it gives me the following error:

Run-time error '-2147024809 (80070057)':

[Collaboration Data Objects - [E_INVALIDARG(80070057)]]


Does anyone have any ideas?

nikkiH
08-15-2005, 09:43 PM
Invalid argument.

Perhaps one of the args is null or not a string?
Trace or print out the contents of pubContactsfolderid and objpubstore.id -- what gets shown?
I don't know if it matters, but technically the propery is ID, not id. Some languages are case-sensitive and you have it in capitals below that. Try changing it to ID instead.