Solved

Need to copy an open PST File

Posted on 2002-06-12
23
189 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:CraigLazar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 6
  • 3
  • +4
23 Comments
 
LVL 1

Accepted Solution

by:
barendb earned 300 total points
ID: 7074802
I've tried everything before, but 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.

Outlook puts some type of system lock on the file, so that nothing else can access it while outlook is open.

If you get a solution to this let me know.

Barend
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7074810
>> windows api copy file function
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
0
 

Expert Comment

by:fesar
ID: 7074910
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:\temp1.pst")

Hope this will help you. I tried with Outlook 2000 and outlook 98.

Thanks,
Francis.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Author Comment

by:CraigLazar
ID: 7074981
Sorry fesar
does not work

thanx

Craig
0
 
LVL 4

Author Comment

by:CraigLazar
ID: 7074982
Sorry fesar
does not work

thanx

Craig
0
 

Expert Comment

by:fesar
ID: 7074997
Hi Craig,

        What error does it gave? Can you be more specific on what you want.

Regards,
Francis.
0
 

Expert Comment

by:fesar
ID: 7075002
Hi Craig,

        What error does it gave? Can you be more specific on what you want.

Regards,
Francis.
0
 
LVL 4

Author Comment

by:CraigLazar
ID: 7075033
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
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 7075782
%listening
0
 
LVL 4

Author Comment

by:CraigLazar
ID: 7076638
huh ?
0
 
LVL 5

Expert Comment

by:dgorin
ID: 7077078
Listening is a way for someone to hook on this thread and get email updates while looking for the answer.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7077394
Craig, any comments for my suggestion above?
0
 
LVL 4

Author Comment

by:CraigLazar
ID: 7077658
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
0
 
LVL 4

Author Comment

by:CraigLazar
ID: 7137346
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
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7900179
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
0
 
LVL 4

Author Comment

by:CraigLazar
ID: 7900657
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
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7900809
>>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
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7901023
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
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7901033
Indeed! Points for barendb!
0
 
LVL 4

Author Comment

by:CraigLazar
ID: 7902596
100%

cool thanx again

have a great weekend

cheers
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7902606
CraigLazar, if you agree, you should accept barendb's comment as answer!
CHeers
0
 
LVL 4

Author Comment

by:CraigLazar
ID: 7902610
I humbly appologise for leaving this question open

:)
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7902625
No problem :-)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question