A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , ,

help: AppointmentItem.copy fail problem





 
 
Thread Tools Display Modes
  #1  
Old October 30th 06, 04:07 PM posted to microsoft.public.outlook.program_vba
meokey
external usenet poster
 
Posts: 1
Default help: AppointmentItem.copy fail problem

In a section of VBA in Outlook, I need to copy a appointment item (named
Item, in PST file) to another Calendar in Mailbox of Exchange server. I add a
UserProperty, RndID, to the appointmentitem, Item. But I find the
userproperty didn't be copied.

The code is as following:


Set myprop = Nothing
Set myprop = Item.UserProperties.Find("RndID")
If TypeName(myprop) = "Nothing" Then
Set myprop = Item.UserProperties.Add("RndID", olNumber)
myRndID = Int(Rnd() * 100000)
Item.UserProperties("RndID").Value = myRndID
Item.Save
End If
........
Item.Body = "testtest" & " " & myRndID
Item.Save
Set myCopiedItem = Item.Copy
myCopiedItem.Move myMailboxCal
MsgBox myCopiedItem.UserProperties("RndID").Value, , "Copied to
Mailbox"


The last code, which is to validate whether the whole item including all
properties is copied, failed with the message: Object variable or With block
variable not
set. Of couse, the body of the appointmentitem in Mailbox is blank. It shows
that the properties of RndID and Body of Item in PST did NOT be copied to
myCopiedItem and moved to myMailboxCal.

Any comments/suggestions will be very appreciated.
Ads
  #2  
Old October 31st 06, 12:25 AM posted to microsoft.public.outlook.program_vba
Jeff
external usenet poster
 
Posts: 28
Default help: AppointmentItem.copy fail problem

As a first step, you could use Outlook or OutlookSpy to double-check
that the property did not get copied.

On Oct 30, 11:07 am, meokey wrote:
In a section of VBA in Outlook, I need to copy a appointment item (named
Item, in PST file) to another Calendar in Mailbox of Exchange server. I add a
UserProperty, RndID, to the appointmentitem, Item. But I find the
userproperty didn't be copied.

The code is as following:

Set myprop = Nothing
Set myprop = Item.UserProperties.Find("RndID")
If TypeName(myprop) = "Nothing" Then
Set myprop = Item.UserProperties.Add("RndID", olNumber)
myRndID = Int(Rnd() * 100000)
Item.UserProperties("RndID").Value = myRndID
Item.Save
End If
........
Item.Body = "testtest" & " " & myRndID
Item.Save
Set myCopiedItem = Item.Copy
myCopiedItem.Move myMailboxCal
MsgBox myCopiedItem.UserProperties("RndID").Value, , "Copied to
Mailbox"

The last code, which is to validate whether the whole item including all
properties is copied, failed with the message: Object variable or With block
variable not
set. Of couse, the body of the appointmentitem in Mailbox is blank. It shows
that the properties of RndID and Body of Item in PST did NOT be copied to
myCopiedItem and moved to myMailboxCal.

Any comments/suggestions will be very appreciated.


  #3  
Old October 31st 06, 03:07 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 3,404
Default AppointmentItem.copy fail problem

Try getting the Item.EntryID and releasing the Item after saving it. Then
get the same item using NameSpace.GetItemFromID and use that to copy/move
and see if that works better.

--
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


"meokey" wrote in message
...
In a section of VBA in Outlook, I need to copy a appointment item (named
Item, in PST file) to another Calendar in Mailbox of Exchange server. I
add a
UserProperty, RndID, to the appointmentitem, Item. But I find the
userproperty didn't be copied.

The code is as following:


Set myprop = Nothing
Set myprop = Item.UserProperties.Find("RndID")
If TypeName(myprop) = "Nothing" Then
Set myprop = Item.UserProperties.Add("RndID", olNumber)
myRndID = Int(Rnd() * 100000)
Item.UserProperties("RndID").Value = myRndID
Item.Save
End If
........
Item.Body = "testtest" & " " & myRndID
Item.Save
Set myCopiedItem = Item.Copy
myCopiedItem.Move myMailboxCal
MsgBox myCopiedItem.UserProperties("RndID").Value, , "Copied to
Mailbox"


The last code, which is to validate whether the whole item including all
properties is copied, failed with the message: Object variable or With
block
variable not
set. Of couse, the body of the appointmentitem in Mailbox is blank. It
shows
that the properties of RndID and Body of Item in PST did NOT be copied to
myCopiedItem and moved to myMailboxCal.

Any comments/suggestions will be very appreciated.


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can i make AppointmentItem not editable in the calendar? eranhef@gmail.com Outlook - Using Forms 0 September 19th 06 06:59 AM
How to access the Private property on a Outlook.AppointmentItem PromisedOyster Outlook and VBA 1 August 11th 06 12:26 PM
fail to search text in old emails vito Outlook - General Queries 0 May 18th 06 03:20 AM
How to create AppointmentItem in inbox (Outlook 2002) Galois Add-ins for Outlook 2 April 27th 06 08:01 AM
AppointmentItem question (2003) Dana DeLouis Outlook and VBA 1 January 18th 06 05:13 PM


All times are GMT +1. The time now is 04:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Loans - Death Note Episodes - Loan - Internet Advertising - Facebook proxy list