CraigLazar
asked on
Need to copy an open PST File
Hi
Please can someone help with copying an open outlook pst file. windows api copy file function does not work. Gives me an access error that the file is locked. I know it cna be done cause i ahve seen a little software app that does it. I need to get it working on the local oc and or a pst file on a network
thanx
Craig
Please can someone help with copying an open outlook pst file. windows api copy file function does not work. Gives me an access error that the file is locked. I know it cna be done cause i ahve seen a little software app that does it. I need to get it working on the local oc and or a pst file on a network
thanx
Craig
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi Craig,
Hope the below code helps you. I tried this code with an open mail of an PST. It copied.
Private Declare Function CopyFile Lib "kernel32" Alias _
"CopyFileA" (ByVal lpExistingFileName As String, ByVal _
lpNewFileName As String, ByVal bFailIfExists As Long) As Long
Sub Copy(Source As String, Target As String)
Dim RetVal As Long
RetVal = CopyFile(Trim$(Source), Trim(Target), False)
If RetVal Then
MsgBox "File copied!"
Else
MsgBox "Error. File not copied"
End If
End Sub
Then just call thee function as
copy("C:\temp.pst","C:\tem p1.pst")
Hope this will help you. I tried with Outlook 2000 and outlook 98.
Thanks,
Francis.
Hope the below code helps you. I tried this code with an open mail of an PST. It copied.
Private Declare Function CopyFile Lib "kernel32" Alias _
"CopyFileA" (ByVal lpExistingFileName As String, ByVal _
lpNewFileName As String, ByVal bFailIfExists As Long) As Long
Sub Copy(Source As String, Target As String)
Dim RetVal As Long
RetVal = CopyFile(Trim$(Source), Trim(Target), False)
If RetVal Then
MsgBox "File copied!"
Else
MsgBox "Error. File not copied"
End If
End Sub
Then just call thee function as
copy("C:\temp.pst","C:\tem
Hope this will help you. I tried with Outlook 2000 and outlook 98.
Thanks,
Francis.
ASKER
Sorry fesar
does not work
thanx
Craig
does not work
thanx
Craig
ASKER
Sorry fesar
does not work
thanx
Craig
does not work
thanx
Craig
Hi Craig,
What error does it gave? Can you be more specific on what you want.
Regards,
Francis.
What error does it gave? Can you be more specific on what you want.
Regards,
Francis.
Hi Craig,
What error does it gave? Can you be more specific on what you want.
Regards,
Francis.
What error does it gave? Can you be more specific on what you want.
Regards,
Francis.
ASKER
get in your app file not copied error
if u have your outlook open, i want to be able to copy your pst file to another location
if u have your outlook open, i want to be able to copy your pst file to another location
%listening
ASKER
huh ?
Listening is a way for someone to hook on this thread and get email updates while looking for the answer.
Craig, any comments for my suggestion above?
ASKER
hi angell, wel not really any comments, as in that i have tried api calls etc and i g=have not been able to get it working
thanx
Craig
thanx
Craig
ASKER
Hi Guys
well to keep u upto date
i still have not found the answer of copying an open pst file, so i hav created a little app that shecks to see if outlook is closed, if it is open it closes normally using the outlook object library, then i copy
but thanx
for all the input
Cheers
Craig
well to keep u upto date
i still have not found the answer of copying an open pst file, so i hav created a little app that shecks to see if outlook is closed, if it is open it closes normally using the outlook object library, then i copy
but thanx
for all the input
Cheers
Craig
Hi CraigLazar,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Accept barendb's comment(s) as an answer.
CraigLazar, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you. DO NOT accept this comment as an answer.
EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Accept barendb's comment(s) as an answer.
CraigLazar, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you. DO NOT accept this comment as an answer.
EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
ASKER
Hi Sorry for leaving this question open
unfortunately i was unable to copy the open pst file.
So i landed up creating another application which automatically closes outlook before i back it up.
But thanks to all that provided help to this question
cheers
Craig
unfortunately i was unable to copy the open pst file.
So i landed up creating another application which automatically closes outlook before i back it up.
But thanks to all that provided help to this question
cheers
Craig
>>So i landed up creating another application which automatically closes outlook before i back it up.
Part of my first comment was:
>>if the win api doesn't work, the only alternatives you have is:
* close outlook to copy the file
CHeers
Part of my first comment was:
>>if the win api doesn't work, the only alternatives you have is:
* close outlook to copy the file
CHeers
And barendb said it first:
>>...there is no way that an open PST file will copy, I had to close outlook from my app and then re-open it after the copy.
So I recommended that he get credit for the correct answer.
-- Dan
>>...there is no way that an open PST file will copy, I had to close outlook from my app and then re-open it after the copy.
So I recommended that he get credit for the correct answer.
-- Dan
Indeed! Points for barendb!
ASKER
100%
cool thanx again
have a great weekend
cheers
cool thanx again
have a great weekend
cheers
CraigLazar, if you agree, you should accept barendb's comment as answer!
CHeers
CHeers
ASKER
I humbly appologise for leaving this question open
:)
:)
No problem :-)
if the win api doesn't work, the only alternatives you have is:
* close outlook to copy the file
* ask outlook to get the data
if you can't close outlook, you have to use outlooks export functionality, which can export the data to a .pst file.
CHeers