Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-06-2005, 02:10 PM
GivenRandy GivenRandy is offline
Novice
Can't Move the Items
 
Join Date: Dec 2005
Posts: 1
GivenRandy
Default Can't Move the Items

I have some inherited code that works under my login, but not under others. Which doesn't seem to make sense because we can open the PST under the other logins, it's just that the code gives an error "Can't move the items" when it tries to move in the function below. Any ideas? [Hmm, keeps losing the indentation/spaces in the copy-paste]

--------------------------------------
Public Function CopyMailFromReferenceToTarget(ByVal uniqueMailId As String, Optional ByVal blnCopyToInbox As Boolean = False) As Boolean Implements IMailAdapter.CopyMailFromReferenceToTarget

Dim copyFolder As Outlook.MAPIFolder
Dim itemToBeAdded As Object
Dim itemCopy As Object
Dim itemParent As Outlook.MAPIFolder

Try
CopyMailFromReferenceToTarget = True

If _mailApp Is Nothing Then
Throw New ApplicationException("Object not initialized. Initialize the object first.")
End If

If _referenceMailDatabase Is Nothing Then
Throw New ApplicationException("Reference Pst file not set. Set it first.")
End If

'Get the mail to be added from reference personal folder
itemToBeAdded = GetItem(uniqueMailId, _referenceMailDatabase.StoreID)

'Make the copy of the mail
itemCopy = itemToBeAdded.Copy()

'Get the folder where to copy
itemParent = itemToBeAdded.Parent

If _targetMailDatabase Is Nothing Then
Throw New ApplicationException("Target Pst file not set. Set it first.")
End If

If blnCopyToInbox Then
copyFolder = GetFolder("\\Personal Folders\Inbox", _targetMailDatabase)
Else
copyFolder = GetFolder(itemParent.FolderPath, _targetMailDatabase)
End If

'Copy the mail to the desired mail datababase
itemCopy.Move(copyFolder)

Catch ex As Exception
NotifyUser(ex.Message, MessageBoxIcon.Error)


CopyMailFromReferenceToTarget = False

Finally
FreeComObject(itemCopy)
FreeComObject(itemToBeAdded)
FreeComObject(copyFolder)
FreeComObject(itemParent)
End Try

End Function
--------------------------------------
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I move file folders ..please? steve e Outlook 0 05-15-2008 10:21 AM
Can't delete or move some contacts Froglips Outlook 0 09-22-2007 05:42 AM
Tools for assigning Categories or Contacts to many items?? Bat Outlook 0 07-05-2007 11:25 AM
deleted items not going in to trash glg4e Outlook 0 06-27-2006 10:19 AM
Moving Items windsurfer Outlook 0 12-06-2005 06:36 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:53 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft