Reputation: 1885
I'm trying to make a copy of a mailitem, move the copy to a different location and add a custom item property to it. But after I add the custom property, the item wont save and crash with the error mentionned above.
Here's my code, help me figure this out please!
Dim objCopiedItem, objControlItem
Set objCopiedItem = item.Copy
Call objCopiedItem.Move(objPSTFolder)
Dim property1 : Set property1 = GetMigrationProperty(objCopiedItem.ItemProperties)
if property1 is nothing Then
Set property1 = objCopiedItem.ItemProperties.Add("Migration ID", 1)
property1.Value = item.EntryID
objCopiedItem.Save
else
property1.Value = item.EntryID
objCopiedItem.Save
End If
The error occurs at objCopiedItem.Save, the operation works without problems if I add the properties to the original item and then copy/move and the new item, then delete the property on the original item.
Upvotes: 0
Views: 438
Reputation: 66215
Move is a function that returns the new item, not a sub:
Set objCopiedItem = item.Move(objPSTFolder)
Upvotes: 2