P
PuppetMaster
I am writing a VB6 Com Add-in for Outlook 2002 with Exchange accounts.
Essentially, I am just altering the subject line and then resaving the
mail object. However, for some users they receive an error: "The
function cannot be performed because the message has been changed".
I have also now trapped this error, reloaded the object, make the
subject line change and resave the object - all within a few lines of
code - but the error can still occur!
More peculiar, is that it only seems to affect certain Exchange
accounts and is not machine specific - for one user it works fine, but
a different user logs on to the same machine and it doesn't work.
Any help would be greatly appreciated!!
Below is a code extract: -
On Error GoTo writeProblem
failedSaves = 0
saveIt:
itemObj.subject = newSubject
itemObj.Save
myLogger.log "Saved local object with subject change"
itemObj.subject = mails.removeMailFlag(itemObj.subject)
Call itemObj.SaveAs(frmSaveMail.dd_saveDir.Value & "\" &
projectFilename)
myLogger.log "Mail saved to " & frmSaveMail.dd_saveDir.Value & "\"
& projectFilename
[snip]
writeProblem:
Set itemObj = Nothing
If Err.Number = -2147221239 Then 'Object has changed
failedSaves = failedSaves + 1
myLogger.log "ERROR[" & CStr(failedSaves) & "]: saveMail():
Could not save to " & frmSaveMail.dd_saveDir.Value
myLogger.log Err.Number & ", " & Err.Description
If failedSaves < 10 Then
Set itemObj =
oApp.GetNamespace("MAPI").GetItemFromID(mailID)
myLogger.log "Going to retry saving."
Resume saveIt
Else
myLogger.log "Failed too many times! Giving up."
End If
End If
Essentially, I am just altering the subject line and then resaving the
mail object. However, for some users they receive an error: "The
function cannot be performed because the message has been changed".
I have also now trapped this error, reloaded the object, make the
subject line change and resave the object - all within a few lines of
code - but the error can still occur!
More peculiar, is that it only seems to affect certain Exchange
accounts and is not machine specific - for one user it works fine, but
a different user logs on to the same machine and it doesn't work.
Any help would be greatly appreciated!!
Below is a code extract: -
On Error GoTo writeProblem
failedSaves = 0
saveIt:
itemObj.subject = newSubject
itemObj.Save
myLogger.log "Saved local object with subject change"
itemObj.subject = mails.removeMailFlag(itemObj.subject)
Call itemObj.SaveAs(frmSaveMail.dd_saveDir.Value & "\" &
projectFilename)
myLogger.log "Mail saved to " & frmSaveMail.dd_saveDir.Value & "\"
& projectFilename
[snip]
writeProblem:
Set itemObj = Nothing
If Err.Number = -2147221239 Then 'Object has changed
failedSaves = failedSaves + 1
myLogger.log "ERROR[" & CStr(failedSaves) & "]: saveMail():
Could not save to " & frmSaveMail.dd_saveDir.Value
myLogger.log Err.Number & ", " & Err.Description
If failedSaves < 10 Then
Set itemObj =
oApp.GetNamespace("MAPI").GetItemFromID(mailID)
myLogger.log "Going to retry saving."
Resume saveIt
Else
myLogger.log "Failed too many times! Giving up."
End If
End If