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?
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?