![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I keep getting a "one or more parameter values are not valid" on the
"objEmail.Move objFolder" line. I can move it to an inbox sub folder without error, and I can manually drag the item to the public folder without error. Any ideas on what's wrong here? (I have publishing author client permisions on the folder.) John Sub MoveSpam() Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem Set objNS = Application.GetNamespace("MAPI") 'Set objInbox = objNS.GetDefaultFolder(olFolderInbox) 'Set objFolder = objInbox.Folders("Test") 'Set objFolder = objNS.Folders("Public Folders").Folders("All Public Folders").Folders("GFI AntiSpam Folders").Folders("This is spam email") For intX = 1 To objNS.Folders.Count If objNS.Folders.Item(intX).Name = "Public Folders" Then Set objFolder = objNS.Folders.Item(intX).Folders("All Public Folders") Set objFolder = objFolder.Folders("GFI AntiSpam Folders") Set objFolder = objFolder.Folders("This is spam email") Exit For End If Next If objFolder Is Nothing Then MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation, "INVALID FOLDER" End If If Application.ActiveExplorer.Selection.Count = 0 Then 'Require that this procedure be called only when a message is selected Exit Sub End If Set oSelection = Application.ActiveExplorer.Selection 'intCount = oSelection.Count 'For i = intCount To 1 Step -1 ' Set objItem = oSelection.Item(i) ' If objFolder.DefaultItemType = olMailItem Then ' If objItem.Class = olMail Then ' objItem.Move objFolder ' End If ' End If ' 'objItem.Copy objFolder 'Next For intX = ActiveExplorer.Selection.Count To 1 Step -1 Set objX = ActiveExplorer.Selection.Item(intX) If objX.Class = olMail Then Set objEmail = objX objEmail.Move objFolder End If Next 'For Each objItem In Application.ActiveExplorer.Selection ' If objFolder.DefaultItemType = olMailItem Then ' If objItem.Class = olMail Then ' objItem.Move objFolder ' End If ' End If 'Next Set objItem = Nothing Set objFolder = Nothing Set objInbox = Nothing Set objNS = Nothing End Sub |
Ads |
#2
|
|||
|
|||
![]() |
#4
|
|||
|
|||
![]()
After declaring various undeclared variables the code
I wasn't getting any error messages on that but I think I have everything declared now (VB is not my primary langauge and the code was mostly picked up from other posts here.) I'll put the updated code at the end of this message. elevate your permissions to owner Done and I gave myself full admin and directory rights as well. No change. Are any of the items you're attempting to move flagged as complete? objItem.FlagStatus = olNoFlag Set objMoved = objEmail.Move(objFolder) Same error Any problems running any other macros? Not that I'm aware of. What version of Outlook and Windows? Client: Windows XP SP2 Outlook 2002 SP3 Server: SBS2000 SP4 Exchange Server 2000 SP3 I am not an overly experienced exchange administrator, so it is possible that there is something wrong in that setup. It is mostly a default SBS setup. BTW the code works fine if I use: 'Set objInbox = objNS.GetDefaultFolder(olFolderInbox) 'Set objFolder = objInbox.Folders("Spam") Instead of the public folder. Thanks for your help on this. John Revised Code: Sub MoveSpam() Dim objFolder As Outlook.MAPIFolder Dim objInbox As Outlook.MAPIFolder Dim objNS As Outlook.NameSpace Dim objItem As Outlook.MailItem Dim objMoved As Outlook.MailItem Set objNS = Application.GetNamespace("MAPI") 'Set objInbox = objNS.GetDefaultFolder(olFolderInbox) 'Set objFolder = objInbox.Folders("Spam") Set objFolder = objNS.Folders("Public Folders").Folders("All Public Folders").Folders("GFI AntiSpam Folders").Folders("This is spam email") If objFolder Is Nothing Then MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation, "INVALID FOLDER" Exit Sub End If If Application.ActiveExplorer.Selection.Count = 0 Then 'Require that this procedure be called only when a message is selected Exit Sub End If For intX = ActiveExplorer.Selection.Count To 1 Step -1 Set objItem = ActiveExplorer.Selection.Item(intX) If objItem.Class = olMail Then 'objItem.Move objFolder Set objMoved = objItem.Move(objFolder) End If Next Set objItem = Nothing Set objFolder = Nothing Set objInbox = Nothing Set objNS = Nothing Set objMoved = Nothing End Sub Ken Slovak - [MVP - Outlook] wrote: I finally got some time to test your code here, after I created the correct public folder tree. After declaring various undeclared variables the code worked with no problems moving items to the public folder. If it works for you manually dragging and dropping items into the public folder then permissions shouldn't be a problem, but is there any way to elevate your permissions to owner just to make sure it's not some odd permissions issue? Are any of the items you're attempting to move flagged as complete? That's known to prevent moving until you clear the flag and then set it back again after the move. Although the code worked here see if it works for you when you call Move as a function: Set objMoved = objEmail.Move(objFolder) Any problems running any other macros? What version of Outlook and Windows? -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "JohnFenton" wrote in message ups.com... If no one here has any ideas for me, does anyone have a suggestion on where to go to get help on this one? wrote: I keep getting a "one or more parameter values are not valid" on the "objEmail.Move objFolder" line. I can move it to an inbox sub folder without error, and I can manually drag the item to the public folder without error. Any ideas on what's wrong here? (I have publishing author client permisions on the folder.) John Sub MoveSpam() Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem Set objNS = Application.GetNamespace("MAPI") 'Set objInbox = objNS.GetDefaultFolder(olFolderInbox) 'Set objFolder = objInbox.Folders("Test") 'Set objFolder = objNS.Folders("Public Folders").Folders("All Public Folders").Folders("GFI AntiSpam Folders").Folders("This is spam email") For intX = 1 To objNS.Folders.Count If objNS.Folders.Item(intX).Name = "Public Folders" Then Set objFolder = objNS.Folders.Item(intX).Folders("All Public Folders") Set objFolder = objFolder.Folders("GFI AntiSpam Folders") Set objFolder = objFolder.Folders("This is spam email") Exit For End If Next If objFolder Is Nothing Then MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation, "INVALID FOLDER" End If If Application.ActiveExplorer.Selection.Count = 0 Then 'Require that this procedure be called only when a message is selected Exit Sub End If Set oSelection = Application.ActiveExplorer.Selection 'intCount = oSelection.Count 'For i = intCount To 1 Step -1 ' Set objItem = oSelection.Item(i) ' If objFolder.DefaultItemType = olMailItem Then ' If objItem.Class = olMail Then ' objItem.Move objFolder ' End If ' End If ' 'objItem.Copy objFolder 'Next For intX = ActiveExplorer.Selection.Count To 1 Step -1 Set objX = ActiveExplorer.Selection.Item(intX) If objX.Class = olMail Then Set objEmail = objX objEmail.Move objFolder End If Next 'For Each objItem In Application.ActiveExplorer.Selection ' If objFolder.DefaultItemType = olMailItem Then ' If objItem.Class = olMail Then ' objItem.Move objFolder ' End If ' End If 'Next Set objItem = Nothing Set objFolder = Nothing Set objInbox = Nothing Set objNS = Nothing End Sub |
#5
|
|||
|
|||
![]()
If it works for Inbox it should work for the public folder. The code worked
for me for a public folder, so my only guess is it's some permissions issue. The only move issue I'm aware of is the one with a flag marked complete, but that would also affect moves to any other folder. Still the same error message? -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "JohnFenton" wrote in message oups.com... After declaring various undeclared variables the code I wasn't getting any error messages on that but I think I have everything declared now (VB is not my primary langauge and the code was mostly picked up from other posts here.) I'll put the updated code at the end of this message. elevate your permissions to owner Done and I gave myself full admin and directory rights as well. No change. Are any of the items you're attempting to move flagged as complete? objItem.FlagStatus = olNoFlag Set objMoved = objEmail.Move(objFolder) Same error Any problems running any other macros? Not that I'm aware of. What version of Outlook and Windows? Client: Windows XP SP2 Outlook 2002 SP3 Server: SBS2000 SP4 Exchange Server 2000 SP3 I am not an overly experienced exchange administrator, so it is possible that there is something wrong in that setup. It is mostly a default SBS setup. BTW the code works fine if I use: 'Set objInbox = objNS.GetDefaultFolder(olFolderInbox) 'Set objFolder = objInbox.Folders("Spam") Instead of the public folder. Thanks for your help on this. John Revised Code: Sub MoveSpam() Dim objFolder As Outlook.MAPIFolder Dim objInbox As Outlook.MAPIFolder Dim objNS As Outlook.NameSpace Dim objItem As Outlook.MailItem Dim objMoved As Outlook.MailItem Set objNS = Application.GetNamespace("MAPI") 'Set objInbox = objNS.GetDefaultFolder(olFolderInbox) 'Set objFolder = objInbox.Folders("Spam") Set objFolder = objNS.Folders("Public Folders").Folders("All Public Folders").Folders("GFI AntiSpam Folders").Folders("This is spam email") If objFolder Is Nothing Then MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation, "INVALID FOLDER" Exit Sub End If If Application.ActiveExplorer.Selection.Count = 0 Then 'Require that this procedure be called only when a message is selected Exit Sub End If For intX = ActiveExplorer.Selection.Count To 1 Step -1 Set objItem = ActiveExplorer.Selection.Item(intX) If objItem.Class = olMail Then 'objItem.Move objFolder Set objMoved = objItem.Move(objFolder) End If Next Set objItem = Nothing Set objFolder = Nothing Set objInbox = Nothing Set objNS = Nothing Set objMoved = Nothing End Sub |
#6
|
|||
|
|||
![]() I posted a reply yesterday but it's not showing. Still the same error message? Yes Maybe I have something setup wrong on the server, but it's odd that I can drag and drop the file into the same directory without any problems. John Ken Slovak - [MVP - Outlook] wrote: If it works for Inbox it should work for the public folder. The code worked for me for a public folder, so my only guess is it's some permissions issue. The only move issue I'm aware of is the one with a flag marked complete, but that would also affect moves to any other folder. Still the same error message? -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "JohnFenton" wrote in message oups.com... After declaring various undeclared variables the code I wasn't getting any error messages on that but I think I have everything declared now (VB is not my primary langauge and the code was mostly picked up from other posts here.) I'll put the updated code at the end of this message. elevate your permissions to owner Done and I gave myself full admin and directory rights as well. No change. Are any of the items you're attempting to move flagged as complete? objItem.FlagStatus = olNoFlag Set objMoved = objEmail.Move(objFolder) Same error Any problems running any other macros? Not that I'm aware of. What version of Outlook and Windows? Client: Windows XP SP2 Outlook 2002 SP3 Server: SBS2000 SP4 Exchange Server 2000 SP3 I am not an overly experienced exchange administrator, so it is possible that there is something wrong in that setup. It is mostly a default SBS setup. BTW the code works fine if I use: 'Set objInbox = objNS.GetDefaultFolder(olFolderInbox) 'Set objFolder = objInbox.Folders("Spam") Instead of the public folder. Thanks for your help on this. John Revised Code: Sub MoveSpam() Dim objFolder As Outlook.MAPIFolder Dim objInbox As Outlook.MAPIFolder Dim objNS As Outlook.NameSpace Dim objItem As Outlook.MailItem Dim objMoved As Outlook.MailItem Set objNS = Application.GetNamespace("MAPI") 'Set objInbox = objNS.GetDefaultFolder(olFolderInbox) 'Set objFolder = objInbox.Folders("Spam") Set objFolder = objNS.Folders("Public Folders").Folders("All Public Folders").Folders("GFI AntiSpam Folders").Folders("This is spam email") If objFolder Is Nothing Then MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation, "INVALID FOLDER" Exit Sub End If If Application.ActiveExplorer.Selection.Count = 0 Then 'Require that this procedure be called only when a message is selected Exit Sub End If For intX = ActiveExplorer.Selection.Count To 1 Step -1 Set objItem = ActiveExplorer.Selection.Item(intX) If objItem.Class = olMail Then 'objItem.Move objFolder Set objMoved = objItem.Move(objFolder) End If Next Set objItem = Nothing Set objFolder = Nothing Set objInbox = Nothing Set objNS = Nothing Set objMoved = Nothing End Sub |
#7
|
|||
|
|||
![]()
It's odd but the code works here so there's nothing intrinsically wrong with
it. I have no idea why it's not working for you. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "JohnFenton" wrote in message oups.com... I posted a reply yesterday but it's not showing. Still the same error message? Yes Maybe I have something setup wrong on the server, but it's odd that I can drag and drop the file into the same directory without any problems. John |
#8
|
|||
|
|||
![]() Thanks for checking this out for me. I greatly appreciate it. So I'm guessing if I want to resolve this the next step would be paid tech support. Or is there another place I should try first? John Ken Slovak - [MVP - Outlook] wrote: It's odd but the code works here so there's nothing intrinsically wrong with it. I have no idea why it's not working for you. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "JohnFenton" wrote in message oups.com... I posted a reply yesterday but it's not showing. Still the same error message? Yes Maybe I have something setup wrong on the server, but it's odd that I can drag and drop the file into the same directory without any problems. John |
#9
|
|||
|
|||
![]()
Paid support is certainly an option. I'd also maybe explore setting up
different computers and/or virtual machines and see if things are the same there. I'd also be playing with new profiles and possibly impersonating other users to see how deep this problem goes. All I can say is running as usual as admin and accessing the PF as owner the code worked for me. I also ran it as my dog, who's an Exchange admin but a power user as a Windows logon and who had publishing author rights on that PF. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "JohnFenton" wrote in message ps.com... Thanks for checking this out for me. I greatly appreciate it. So I'm guessing if I want to resolve this the next step would be paid tech support. Or is there another place I should try first? John |
#10
|
|||
|
|||
![]() Paid support is certainly an option. ... You were right, I played around a bit more and found it. PGP was interfering with it. Shutting down PGP alowed it to move just fine. Now I have to see if I can work around the PGP problem. John Ken Slovak - [MVP - Outlook] wrote: Paid support is certainly an option. I'd also maybe explore setting up different computers and/or virtual machines and see if things are the same there. I'd also be playing with new profiles and possibly impersonating other users to see how deep this problem goes. All I can say is running as usual as admin and accessing the PF as owner the code worked for me. I also ran it as my dog, who's an Exchange admin but a power user as a Windows logon and who had publishing author rights on that PF. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "JohnFenton" wrote in message ps.com... Thanks for checking this out for me. I greatly appreciate it. So I'm guessing if I want to resolve this the next step would be paid tech support. Or is there another place I should try first? John |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help problems setting up rule to move email to a public folder | Dab | Outlook - General Queries | 0 | October 18th 06 01:09 AM |
Copy mail item to one folder and then move it to another folder | LDMueller | Outlook - Using Forms | 1 | September 15th 06 03:15 PM |
activate contact folder from public folder with "show this folder as email address book using a prf file | Frankie K. | Outlook - Using Contacts | 7 | July 25th 06 05:37 PM |
How i export/copy/move messages in a public folder outlook 2003? | Olatunde R. Adeniran | Outlook - Using Contacts | 1 | May 3rd 06 06:51 PM |
move to Outlook Folder | Hlewis | Outlook and VBA | 9 | March 27th 06 01:39 PM |