![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]() Hello Forum, I am writing my COM-Addin from VB 2005 for office XP. Now as ItemSent event's cancel is not working for office XP (http:// support.microsoft.com/kb/830519,) I have written the code for helper class in my Connect class (Shared Addin's connect class). Now my ItemSent event's Cancel is working perfectly. But main thing is that, I am cancelling the ItemSend and I am writing my code to create my custom mailitem in ItemSend event, filling that custom mailitem with some properties & saving that mailitem in SentItems folder (without actually sending it). My code snippet is as follows - ' This is my button on the explorer that opens a custom mailitem Private Sub cmdBarButton_Click(ByVal Ctrl As Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean) Handles cmdBarButton.Click Try MyMailItem = TryCast(myOut.Session.GetDefaultFolder(OlDefaultFo lders.olFolderInbox).Items.Add(myCustomForm), MailItem) Catch ex As System.Exception MsgBox("Exception while creating mailitem - " & ex.Message) End Try If MyMailItem IsNot Nothing Then MyMailItem.To = " Try MyMailItem.Display() Catch ex As System.Exception MsgBox ("Exception while displaying the form - " & ex.Message) Marshal.ReleaseComObject(MyMailItem) MyMailItem = Nothing End Try Else MsgBox ("Mail item can not be initialized") End If MyMailItem = Nothing End Sub 'And This is my ItemSend event DispId(61442) _ Public Sub ItemSend(ByVal Item As Object, ByRef Cancel As Boolean) If TypeOf Item Is MailItem Then If Item.MessageClass.ToUpper.ToString = myCustomForm.ToUpper.ToString Then Cancel = True MyMail = Item SendMailInBackground(MyMail) End If End If End Sub And in SendMailInBackground() procedure I am just creating a Sentitem mail. I get Exception - "The operation failed due to a registry or installation problem. Restart Outlook and try again. If the problem persists, please reinstall." at the line MyMailItem.Display() Also some times I am getting the error "DisconnectedContext was detected" at the line MyMailItem = TryCast(myOut.Session.GetDefaultFolder(OlDefaultFo lders.olFolderInbox).Items.Add(myCustomForm), MailItem) Please help me. Thanks in advance, Dhananjay |
Ads |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
HELP! The operation failed due to a registry or installation probl | Dylan | Outlook - Installation | 0 | March 13th 07 02:29 AM |
Retrieve email problem: "The operation failed" | HH | Outlook - General Queries | 1 | January 12th 07 11:24 PM |
The Operation Failed because of a registry or installation problem | Steven T Cameron | Outlook - Installation | 1 | November 14th 06 02:59 AM |
installation or registry problem | CORKIMKOER | Outlook - Installation | 1 | August 25th 06 07:16 PM |
operation failed after installation | Bob I | Outlook - Installation | 0 | February 15th 06 08:21 PM |