PC Review


Reply
Thread Tools Rate Thread

How to copy all calendar items from PST file to Exchange Folder?

 
 
Alan
Guest
Posts: n/a
 
      1st Jul 2005

Hi All,

I have a situation where I need to copy all the calendar items from a
PST calendar folder to an exchange calendar folder.

I can do this between the PST calendar folder and a sub-folder but not
to an exchange folder.

There are no permission issues in the exchange folder - I am the owner
and have full create, edit, delete etc permissions.

The code I have tried is below. The line that errors out is:

ObjCopy.Move ObjTarget

The error message is:

"Could not complete the operation. One or more paramteter values are
not valid."

The exact same code, including that line works fine if I substitute a
sub-folder of the PST calendar folder as the detination rather than
the exchange folder so I don't think it is a syntax issue.

When the code stops, if I choose 'debug' and check the value of
objTarget it is "Calendar" which is the name of the exchange folder.
objCopy is a valid calendar item in the source PST calendar folder, so
that appears to be okay too.

Just in case, I have ensured that there are no items in the exchange
folder prior to running the code so it cannot be a 'conflict' between
two items.

Any ideas?

Thanks,

Alan.



+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Sub Copy_Main_Cal_Items_To_Exchange()

' Declarations

Dim FolderCollection As Folders
Dim AlanMainMailFileFolders As Folders

Dim AlanCalendarFolders As Folders

Dim AlanCalendarItems As Items
Dim AlanTestDestinationCalendarItems As Items

Dim TotalItems As Integer
Dim Counter As Integer

Dim ObjTarget As MAPIFolder

Dim ObjItem As AppointmentItem
Dim ObjCopy As AppointmentItem




' Set up objects to be used

Set FolderCollection = Application.GetNamespace("MAPI").Folders

Set AlanMainMailFileFolders = FolderCollection("Alan - Main Mail
File").Folders
Set AlanCalendarItems = AlanMainMailFileFolders("Calendar").Items

Set AlanExchangeFolders = FolderCollection("Mailbox - Alan
Figgins").Folders
Set AlanExchangeCalendarFolder = AlanExchangeFolders("Calendar")



' Transfer the 'Main' calendar items to the TestDestination exchange
calendar

Set ObjTarget = AlanExchangeCalendarFolder

If Not ObjTarget Is Nothing Then

For Each ObjItem In AlanCalendarItems

Set ObjCopy = ObjItem.Copy

ObjCopy.Move ObjTarget

Set ObjCopy = Nothing

Next

End If




End Sub




+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+



 
Reply With Quote
 
 
 
 
Alan
Guest
Posts: n/a
 
      4th Jul 2005
"Alan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> Hi All,
>
> I have a situation where I need to copy all the calendar items from
> a PST calendar folder to an exchange calendar folder.
>
> I can do this between the PST calendar folder and a sub-folder but
> not to an exchange folder.
>
> There are no permission issues in the exchange folder - I am the
> owner and have full create, edit, delete etc permissions.
>
> The code I have tried is below. The line that errors out is:
>
> ObjCopy.Move ObjTarget
>
> The error message is:
>
> "Could not complete the operation. One or more paramteter values
> are not valid."
>
> The exact same code, including that line works fine if I substitute
> a sub-folder of the PST calendar folder as the detination rather
> than the exchange folder so I don't think it is a syntax issue.
>
> When the code stops, if I choose 'debug' and check the value of
> objTarget it is "Calendar" which is the name of the exchange folder.
> objCopy is a valid calendar item in the source PST calendar folder,
> so that appears to be okay too.
>
> Just in case, I have ensured that there are no items in the exchange
> folder prior to running the code so it cannot be a 'conflict'
> between two items.
>
> Any ideas?
>
> Thanks,
>
> Alan.
>
>
>
> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>


{Code snipped}

>
> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+



Hi Again,

I don't know if it is related, but to do this manually, you need to
switch to 'category' view first to select all the items (Ctrl-A).

Given that I can move them from a PST calendar folder to another
folder
in that PST file using the code posted, I cannot see how this would
matter, but you never know!

Thanks for any suggestions,

Alan.






 
Reply With Quote
 
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
Posts: n/a
 
      4th Jul 2005
Do you have permissions to create new items in that Public Folder? Can you
copy the items manually?

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/


"Alan" wrote:

> "Alan" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >
> > Hi All,
> >
> > I have a situation where I need to copy all the calendar items from
> > a PST calendar folder to an exchange calendar folder.
> >
> > I can do this between the PST calendar folder and a sub-folder but
> > not to an exchange folder.
> >
> > There are no permission issues in the exchange folder - I am the
> > owner and have full create, edit, delete etc permissions.
> >
> > The code I have tried is below. The line that errors out is:
> >
> > ObjCopy.Move ObjTarget
> >
> > The error message is:
> >
> > "Could not complete the operation. One or more paramteter values
> > are not valid."
> >
> > The exact same code, including that line works fine if I substitute
> > a sub-folder of the PST calendar folder as the detination rather
> > than the exchange folder so I don't think it is a syntax issue.
> >
> > When the code stops, if I choose 'debug' and check the value of
> > objTarget it is "Calendar" which is the name of the exchange folder.
> > objCopy is a valid calendar item in the source PST calendar folder,
> > so that appears to be okay too.
> >
> > Just in case, I have ensured that there are no items in the exchange
> > folder prior to running the code so it cannot be a 'conflict'
> > between two items.
> >
> > Any ideas?
> >
> > Thanks,
> >
> > Alan.
> >
> >
> >
> > +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> >

>
> {Code snipped}
>
> >
> > +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

>
>
> Hi Again,
>
> I don't know if it is related, but to do this manually, you need to
> switch to 'category' view first to select all the items (Ctrl-A).
>
> Given that I can move them from a PST calendar folder to another
> folder
> in that PST file using the code posted, I cannot see how this would
> matter, but you never know!
>
> Thanks for any suggestions,
>
> Alan.
>
>
>
>
>
>
>

 
Reply With Quote
 
Alan
Guest
Posts: n/a
 
      4th Jul 2005

"Eric Legault [MVP - Outlook]" <(E-Mail Removed)> wrote
in message news:58D0192E-3F7D-4ECE-959D-(E-Mail Removed)...
>
> Do you have permissions to create new items in that Public Folder?
> Can you copy the items manually?
>



Hi Eric,

There are no permission issues in the exchange folder - I am the
owner and have full create, edit, delete etc permissions.

I can do it manually no problem, just not programmatically.


Do you know why the line:

ObjCopy.Move ObjTarget

could error out?

The error message is:

"Could not complete the operation.
One or more paramteter values are not valid."

I have to be honest - I do not know how to interpret the message in
that I don't see what the 'parameters' are in this context, and given
that the same line works fine to another PST folder it seems to be
syntactically correct.

Thanks for your assistance - I very much appreciate your involvement,

Alan.





 
Reply With Quote
 
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
Posts: n/a
 
      5th Jul 2005
If you search for that error message in the MS Knowledge Base, you'll see all
kinds of completely different issues in Outlook that displays the same error
message. Unfortunately, none of them are 100% relevant to your situation.
The articles that are close seem to hint at a corrupt .pst or Exchange
folder, so you may want to rule that out by running your code against a
completely new test .pst file with new test items being copied to a new
Exchange folder.

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/


"Alan" wrote:

>
> "Eric Legault [MVP - Outlook]" <(E-Mail Removed)> wrote
> in message news:58D0192E-3F7D-4ECE-959D-(E-Mail Removed)...
> >
> > Do you have permissions to create new items in that Public Folder?
> > Can you copy the items manually?
> >

>
>
> Hi Eric,
>
> There are no permission issues in the exchange folder - I am the
> owner and have full create, edit, delete etc permissions.
>
> I can do it manually no problem, just not programmatically.
>
>
> Do you know why the line:
>
> ObjCopy.Move ObjTarget
>
> could error out?
>
> The error message is:
>
> "Could not complete the operation.
> One or more paramteter values are not valid."
>
> I have to be honest - I do not know how to interpret the message in
> that I don't see what the 'parameters' are in this context, and given
> that the same line works fine to another PST folder it seems to be
> syntactically correct.
>
> Thanks for your assistance - I very much appreciate your involvement,
>
> Alan.
>
>
>
>
>
>

 
Reply With Quote
 
Alan Alan
Guest
Posts: n/a
 
      5th Jul 2005

"Eric Legault [MVP - Outlook]" <(E-Mail Removed)> wrote in
message news:8B514652-7AC7-4107-8C4F-(E-Mail Removed)...
>
> If you search for that error message in the MS Knowledge Base, you'll see

all
> kinds of completely different issues in Outlook that displays the same

error
> message. Unfortunately, none of them are 100% relevant to your situation.
>


I agree - I had wondered if it was just me not comprehending, but thank you
for checking too.

>
> The articles that are close seem to hint at a corrupt .pst or Exchange
> folder, so you may want to rule that out by running your code against a
> completely new test .pst file with new test items being copied to a new
> Exchange folder.
>


I tried from three different PST files (including one that I created from
scratch and just entered a single calendar item to make it as safe as
possible - still the same results with the error on that same line.

Could I ask whether you are able to make it work by moving an item from a
PST calendar folder to an exchange calendar folder?

It errors out even if I create a sub-calendar folder in exchange, so there
is no need to risk you main calendar folder, but please do be careful!

Thanks,

Alan.


 
Reply With Quote
 
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
Posts: n/a
 
      5th Jul 2005
I tried your code and had no problems, although I did have to declare these
variables:

AlanExchangeFolders
AlanExchangeCalendarFolder

Other than that, I'm stumped.

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/


"Alan Alan" wrote:

>
> "Eric Legault [MVP - Outlook]" <(E-Mail Removed)> wrote in
> message news:8B514652-7AC7-4107-8C4F-(E-Mail Removed)...
> >
> > If you search for that error message in the MS Knowledge Base, you'll see

> all
> > kinds of completely different issues in Outlook that displays the same

> error
> > message. Unfortunately, none of them are 100% relevant to your situation.
> >

>
> I agree - I had wondered if it was just me not comprehending, but thank you
> for checking too.
>
> >
> > The articles that are close seem to hint at a corrupt .pst or Exchange
> > folder, so you may want to rule that out by running your code against a
> > completely new test .pst file with new test items being copied to a new
> > Exchange folder.
> >

>
> I tried from three different PST files (including one that I created from
> scratch and just entered a single calendar item to make it as safe as
> possible - still the same results with the error on that same line.
>
> Could I ask whether you are able to make it work by moving an item from a
> PST calendar folder to an exchange calendar folder?
>
> It errors out even if I create a sub-calendar folder in exchange, so there
> is no need to risk you main calendar folder, but please do be careful!
>
> Thanks,
>
> Alan.
>
>
>

 
Reply With Quote
 
Alan
Guest
Posts: n/a
 
      5th Jul 2005
"Eric Legault [MVP - Outlook]" <(E-Mail Removed)>
wrote in message
news:96C47902-9D01-4EFA-98A0-(E-Mail Removed)...
>
> I tried your code and had no problems, although I did have to
> declare these variables:
>
> AlanExchangeFolders
> AlanExchangeCalendarFolder
>
> Other than that, I'm stumped.
>


Hi Eric,

Thank you for trying for me.

Despite my statements to the contrary, I believe it *must* be a
permissions issue, since it works for you and for me to a PST
destination outside of my exchange folders.

I will re-examine the exchange setup and see if I can work it out.

I really appreciate your assistance with this - I owe you one (or a
few)!

Regards,

Alan.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SharePoint Calendar vs Exchange User's Shared Calendar vs ExchangePublic Folder of Calendar Items Jeff Microsoft Outlook Calendar 1 3rd Mar 2008 07:03 PM
NEED PUBLIC FOLDER CALENDAR ITEMS TO COPY TO USER'S EXCHANGE MAILB =?Utf-8?B?R2VvcmdlLCBNQ1A=?= Microsoft Outlook Installation 0 20th Apr 2005 10:37 PM
Copy calendar items from one folder to another? Katie Bisbee Microsoft Outlook Calendar 1 21st Jul 2004 04:33 AM
Outlook 2003/Exchange: How to automatically copy meetings between personal Calendar & Exchange Calendar Leon Microsoft Outlook Calendar 3 27th Apr 2004 11:00 PM
copy personal calendar items to public folder lynne baker Microsoft Outlook Calendar 1 19th Nov 2003 08:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:07 AM.