wonder if anyone can help... I have access db with a whole lot of vb code... If i use access 2000 it works perfectly but when using 2003 it doesn't work properly. The db copies outlook mailboxes... I'm not quite sure why it wont work properly, i can copy my own mailbox but trying to copy some elses wont work, if i export the mailboxes directly through outlook then i can copy them... this isn't an outlook related issue... here is the code which doesn't seem to work: -
Private Sub CopyMailItems(ns As Outlook.NameSpace, strUserFullName As String, strRecip As String)
-
On Error GoTo CopyErrHandler
-
-
Dim folder1 As MAPIFolder, oFolder As MAPIFolder
-
Dim strMailboxName As String, strStatus As String
-
Dim intConnect As Integer, intOther As Integer
-
Dim strDupTest As String, ErrString, strSearch As String
-
Dim Complete As Boolean
-
-
Set dbs = CurrentDb
-
Set rst = dbs.OpenRecordset("Status")
-
MsgBox "copymailitems1", vbOKOnly, "test"
-
intConnect = ConnectToBox()
-
If intConnect = 6 Then
-
MsgBox "copymailitems2", vbOKOnly, "test"
-
strMailboxName = "Mailbox - " & strUserFullName
-
Set UserMailbox = ns.Folders(strMailboxName)
-
'If user has not connected to mailbox, rest of code will not run. Error Handler will "kick in"
-
strStatus = StatusTest()
-
MsgBox "copymailitems3", vbOKOnly, "test"
-
If strStatus <> "Copy Started" Then
-
MsgBox "copymailitems4", vbOKOnly, "test"
-
strStatus = "Copy Started"
-
Call UpdateStatus(strStatus)
-
End If
-
Screen.MousePointer = 11
-
-
'Copy folders and its subfolders to empty pst
-
strPstFolderName = CreateEmptyPst(ns, strRecip, strUserFullName)
-
MsgBox "copymailitems5", vbOKOnly, "test"
-
Set PersonalFolder = ns.Folders(strPstFolderName)
-
For Each folder1 In UserMailbox.Folders 'ns.Folders(strMailboxName).Folders
-
MsgBox "copymailitems6", vbOKOnly, "test"
-
Set CopiedFolder = folder1.CopyTo(PersonalFolder) '****
-
MsgBox "copymailitems7", vbOKOnly, "test"
-
Next
-
MsgBox "copymailitems8", vbOKOnly, "test"
-
Set CopiedFolder = Nothing
-
'copy messages from top of Information Store to pst
-
For Each msg In ns.Folders(strMailboxName).Items
-
MsgBox "copymailitems9", vbOKOnly, "test"
-
Set CopiedItem = msg.Copy
-
CopiedItem.Move PersonalFolder
-
Next
-
Set CopiedItem = Nothing
-
Set oFolder = ns.Folders.Item(strPstFolderName)
-
-
Screen.MousePointer = 0
-
Complete = VerifyContents(ns, strMailboxName)
-
If Complete = True Then
-
MsgBox "All items have been copied.", vbOKOnly + vbInformation, "Mailbox Copy"
-
strStatus = "Copy Complete"
-
' Set objFolder = objName.Folders.Item("Personal Folders")
-
ns.RemoveStore PersonalFolder
-
Else
-
MsgBox "Please copy data to folders where differences have been noted. " & _
-
"Please revisit page once copying has been completed", vbOKOnly + vbInformation, _
-
"Mailbox Copy"
-
strStatus = "Copy Partial"
-
DoCmd.OpenForm "frmCopyComplete"
-
End If
-
Call UpdateStatus(strStatus)
-
End If
-
-
CopyErrHandler:
-
Select Case Err.Number
-
Case -2147221233 'Not connected to user's mailbox in Outlook
-
intConnect = ConnectToBox()
-
If intConnect = 6 Then
-
Resume
-
End If
-
Case Else
-
strSearch = "Can't copy folder." 'don't have permission to copy folder
-
ErrString = InStr(1, Err.Description, strSearch)
-
If ErrString = 1 Then
-
Resume Next
-
End If
-
End Select
-
-
Screen.MousePointer = 0
-
-
End Sub
-
-
i have added the msgboxs which says copymailitems, just to try see where it stops working... it would seem like it is after this line:
-
-
MsgBox "copymailitems6", vbOKOnly, "test"
-
Set CopiedFolder = folder1.CopyTo(PersonalFolder)
-
Any ideas or anything would be greatly appreciated...
Thanx
0 1525 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Thomi Richards |
last post by:
Hi,
I'm trying to create a simple stack class using C++ and templates.
Everything works well and good if I amke the class totally inline.
However, as soon as I try to seperate the class into a...
|
by: Russ |
last post by:
Hello. My new dev machine is running XP Pro. In the past all
equipment has only used Windows 2000. I have had a lot of problems
getting my projects up and running on the new machine. The current...
|
by: Carmine Cairo |
last post by:
Hi,
I'm working on a project and today I've note a little problem during the
compile fase.
Here a little piece of code:
// 1st version
welldone = 0;
size = p->getSize();
backbone = new...
|
by: Chris LaJoie |
last post by:
Our company has been developing a program in C# for some time now, and we
haven't had any problems with it, but just last night something cropped up
that has me, and everyone else, stumped.
I...
|
by: Holger (David) Wagner |
last post by:
Hi Group,
I've searched the Web for precompilers that compile ASPX/ASCX pages just
like it can be done with JSPs, but so far, I've only found approaches
targetted at increasing the performance....
| |
by: collection60 |
last post by:
I've been developing some Unix based shell tools.
They work fine on Linux and MacOSX.
I want to compile them on Win32. But I can't get hash_map to compile. I
tried downloading stl (and...
|
by: Boris Yeltsin |
last post by:
I use Master Pages, so I make use of URL rebasing through the ~ operator,
like this in the <head>:
<link runat="server" href="~/Root.master.css" media="screen"
rel="stylesheet" type="text/css" />...
|
by: mistral |
last post by:
Need compile python code, source is in html and starts with parameters:
#!/bin/sh -
"exec" "python" "-O" "$0" "$@"
I have installed ActivePython for windows.
|
by: Finger.Octopus |
last post by:
I dont know whats terribly going wrong with this, well I know there's
some memory allocation with this but I tried hard to fix it and when
it gets fixed it doesn't shows up the desired value, this...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |