• Subject: RE: Error in Outlook Object Model with redemption and google apps prem
  • Author: James
  • Date: 09 Dec 2010
  • References: 1 2
i had to post this just to get to the thread from google!

Eric Legault [MVP - Outlook] wrote:
> Where exactly are you getting the error? Can you add more error handling
> around the .Save and .Send methods to narrow it down?
>
> Also, why are you calling "OutlookApp = New Outlook.Application" twice?
> This may be excessive and could contribute to your problems.
>
> What is the purpose of your code anyway?
>
> --
> Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
> Try Picture Attachments Wizard for Outlook:
> http://www.collaborativeinnovations.ca
> Blog: http://blogs.officezealot.com/legault/
>
>
> "Gpg" wrote:
>
> > Hi all,
> >
> >
> > Y try to make a email as template. When template is done, i (try to)
copying
> > and send it
> > Here is my code sample (i’ve added som messagebox for showing where
is the
> > error…)
> >
> > Private Sub test(ByVal destinataires As String, ByVal KeepTemplateMail As
> > Boolean)
> > Dim findOutlook As Boolean = False
> > Dim processes As Process() = Process.GetProcesses()
> > If processes.Length > 1 Then
> > Dim i As Integer = 0
> > For i = 0 To processes.Length - 1
> > If processes(i).ProcessName.ToUpper = "OUTLOOK" Then
> > findOutlook = True : i = processes.Length
> > Next
> > End If
> > If Not findOutlook Then Process.Start("Outlook.exe")
> >
> >
> > Dim OutlookApp As Outlook.Application = Nothing
> > Dim SafeMail As Redemption.SafeMailItem = Nothing
> > Dim SafeMailCopy As Redemption.SafeMailItem = Nothing
> > Try
> > OutlookApp = New Outlook.Application
> > SafeMail = New Redemption.SafeMailItem
> > SafeMail.Item =
> > OutlookApp.CreateItem(Outlook.OlItemType.olMailItem)
> > SafeMail.save()
> > Dim EntryId As String = SafeMail.Item.EntryId
> > SafeMail.display(True)
> > SafeMail = Nothing
> > OutlookApp = Nothing
> > GC.Collect()
> > GC.WaitForPendingFinalizers()
> > GC.Collect()
> > GC.WaitForPendingFinalizers()
> >
> > OutlookApp = New Outlook.Application
> > SafeMail = New Redemption.SafeMailItem
> >
> > For Each item As Outlook.MailItem In
> >
OutlookApp.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts).Items
> > SafeMail.Item = item
> > If SafeMail.Item.EntryId = EntryId Then
> > If MessageBox.Show("Sending template?", "Test",
> > MessageBoxButtons.YesNo, MessageBoxIcon.Question) =
> > Windows.Forms.DialogResult.Yes Then
> > SafeMailCopy = New Redemption.SafeMailItem
> > MessageBox.Show("Copy template")
> >
> > Try
> > SafeMailCopy.Item = SafeMail.Item.copy()
> > MessageBox.Show("Copy template ok")
> > Catch ex As System.Exception
> > MessageBox.Show("Copy template ko")
> > Exit For
> > End Try
> > SafeMailCopy.Item.to = str
> > SafeMailCopy.Item.CC = ""
> > SafeMailCopy.Item.BCC = ""
> > MessageBox.Show("Save template")
> > SafeMailCopy.save()
> > MessageBox.Show("Save template ok")
> > MessageBox.Show("Send template")
> > SafeMailCopy.Send()
> > MessageBox.Show("Send template ok")
> > SafeMailCopy = Nothing
> > GC.Collect()
> > GC.WaitForPendingFinalizers()
> > GC.Collect()
> > GC.WaitForPendingFinalizers()

> > If Not KeepTemplateMail Then SafeMail.Item.delete()
> > Exit For
> > End If
> > Next
> > Catch ex As System.Exception : Messagebox.Show(ex.Message)
> > Finally
> > SafeMailCopy = Nothing
> > SafeMail = Nothing
> > OutlookApp = Nothing
> > GC.Collect()
> > GC.WaitForPendingFinalizers()
> > GC.Collect()
> > GC.WaitForPendingFinalizers()
> > End Try
> > End Sub
> >
> > So, this red line fork perfectly with outlook connected to exchange or
Gmail
> > (throught IMAP) and not with GoogleAppsPremier and GoogleAppsSync.
> >
> > An error like ÂŤ Unable to complete the operation because the service
> > provider does not support. Âť Is throwed.
> >
> > i've already contacted Dmitry and he's respond that's this error come from
> > the Outlook Object Model and not from Redemption
> >
> > So, witch difference are in this Model? how to turn around that?
> >
> > Thank's in advance
> >
> > Excuse me for my pitiful English
> >
> > Gpg
> >
> >

______________________________________
Posted from http://outlook-center.com
Outlook forums, articles, tips.
02 Sep 2009Error in Outlook Object Model with redemption and google apps prem.Gpg
02 Sep 2009\ RE: Error in Outlook Object Model with redemption and google apps prem.Eric Legault [MVP - O...
02 Sep 2009   |- RE: Error in Outlook Object Model with redemption and google apps.Gpg
02 Sep 2009   |  \ Re: Error in Outlook Object Model with redemption and google apps.Dmitry Streblechenko
09 Dec 2010   |- RE: Error in Outlook Object Model with redemption and google apps prem.jam
09 Dec 2010   |- RE: Error in Outlook Object Model with redemption and google apps prem.efr
09 Dec 2010   \ RE: Error in Outlook Object Model with redemption and google apps prem.James
Contact Us
All times are in (US) Eastern Daylight Time (GMT -4:00)