Error in Outlook Object Model with redemption and google apps prem

Status
Not open for further replies.
G

Gpg

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
 
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 - , MCDBA, MCTS (SharePoint programming, etc.)

"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

>
 
RE: Error in Outlook Object Model with redemption and google apps

Hi Eric,

thank's for your quickly response

the error is in "SafemailCopy.item = safemail.item.copy"

the message throwed is "Unable to complete the operation because the service

provider does not support."

i call "OutlookApp = New Outlook.Application" twice because i need to

display and retrieve the template email and without freeing and regrab the

template, outlook doesn't store and display correctly his content.

i've also discused about this with Dmitry Streblechenko and it' seem that's

an Outlook Model Object Error. i user Google Apps Premier, with a mapi

support for outlook, but i not know how it's work, what is comming from

outlook and what is comming from google apps

so, i'm in trouble...

with exchange, it's work fine

"Eric Legault " 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 - , MCDBA, MCTS (SharePoint programming, etc.)
>

>

>

> "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
> >
 
Re: Error in Outlook Object Model with redemption and google apps

It simply looks like the MAPI message store provider provided by Google does

not support that functionality

Dmitry Streblechenko (MVP)

-

"Gpg" <Gpg> wrote in message

news:7C2ECFBD-20B6-442B-A4BE-488A4BA4F527@microsoft.com...
> Hi Eric,

> thank's for your quickly response

> the error is in "SafemailCopy.item = safemail.item.copy"
> the message throwed is "Unable to complete the operation because the
> service
> provider does not support."

> i call "OutlookApp = New Outlook.Application" twice because i need to
> display and retrieve the template email and without freeing and regrab the
> template, outlook doesn't store and display correctly his content.

> i've also discused about this with Dmitry Streblechenko and it' seem
> that's
> an Outlook Model Object Error. i user Google Apps Premier, with a mapi
> support for outlook, but i not know how it's work, what is comming from
> outlook and what is comming from google apps

> so, i'm in trouble...

> with exchange, it's work fine

> "Eric Legault " 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 - , MCDBA, MCTS (SharePoint programming, etc.)
> >

> >

> >

>

>
>> "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
> >> >
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
V Outlook Error The Attempted operation Failed. An Object Could Not be found Outlook VBA and Custom Forms 0
A Run time error 424. object required in outlook 2013 Outlook VBA and Custom Forms 10
vodkasoda Object could not be found Error in Outlook 2007 Outlook VBA and Custom Forms 5
J Object Variable or With Block Not Set Error in Outlook 2016 and not Outlook 2013 Outlook VBA and Custom Forms 3
A vb6 run time error 5 when Outlook 2007 Explorer object displayed Outlook VBA and Custom Forms 1
G Outlook 365 My iCloud Outlook doesn’t work after reinstalling Microsoft365 on Windows 10 PC – now I get error message on contacts and calendar Using Outlook 1
P now on office 365 but getting error messages about missing Outlook 2013 cache folders Using Outlook 2
U Outlook 2019 VBA run-time error 424 Outlook VBA and Custom Forms 2
V Outlook error 500 Using Outlook 2
D We're sorry but outlook has run into an error Using Outlook 6
D Outlook 2016 Outlook Error Msg "The operation cannot be performed ..." How to Stop it Using Outlook 4
H Outlook 2019 Certificate error Using Outlook 2
V Date and/or time error in Outlook Form Outlook VBA and Custom Forms 0
A Run-time error '430' on certain emails when trying to set "Outlook.mailitem" as "ActiveExplorer.Selection.Item" Outlook VBA and Custom Forms 2
I Error saving screenshots in a custom form in outlook 2016, outlook 365 - ok in outlook 2013, outlook 2010 Outlook VBA and Custom Forms 5
D Outlook VBA error extracting property data from GetRules collection Outlook VBA and Custom Forms 10
L Outlook 2019 MAC sync error after working for 4 hours Using Outlook 1
M Desktop Version Of Outlook Generating Error Using Outlook 4
T Outlook 2016 CSV Translator Import Error Using Outlook 6
avant-guvnor Outlook.Application now produces error Outlook VBA and Custom Forms 5
N Error 0x80090326 when trying to setup IMAP account on Outlook.com Using Outlook.com accounts in Outlook 1
N Saving And Deleting Outlook Attachments with Unknown Error Message Outlook VBA and Custom Forms 1
M Outlook 2013 fails to start -- missing WindowsCodecs.dll error Using Outlook 3
J Outlook - 2013 - Error msg when copying folders from Online Archives to another user's mailbox Using Outlook 0
Diane Poremsky Error Opening Outlook and Control Panel's Mail Applet Using Outlook 0
Diane Poremsky Cannot start Microsoft Office Outlook Error Message Using Outlook 0
U .pst file error at opening outlook Using Outlook 1
A Outlook Macro Causing Excel Error Outlook VBA and Custom Forms 0
Diane Poremsky Outlook Error Ox800CCC13 in Windows 10 Using Outlook 2
N Outlook 2013 installation error Using Outlook 1
HenWin Outlook 2007 and Comcast certificate error Using Outlook 1
P Encryption Type Error - Verizon and Outlook 2010 Using Outlook 0
M Outlook Email Connection Error Using Outlook 3
T Outlook 2010 sync error Using Outlook 0
H 2010 Outlook 0x800CCC92 Error Using Outlook 2
RBLampert Outlook downloads error out if one particular account is the first to download Using Outlook 0
M VBA Code to Restart Outlook on error Outlook VBA and Custom Forms 3
E Microsoft Office Outlook 2007 Send Error Using Outlook 11
C Error installing BCM: requires outlook BCM (Business Contact Manager) 25
A error message outlook 2003 Using Outlook 1
S Outlook 2010 I am getting error code 0x8DE00006 'the operation failed'. outlook 2010 send/receive progress Using Outlook.com accounts in Outlook 2
B Exchange 2010 / Outlook 20070 "client error in synchronization log" Exchange Server Administration 1
B 0x800CCC0F Error using POP3 in Outlook 2010 and 2013 Using Outlook 1
E Outlook 2013 default file error Using Outlook 1
H Outlook Error message Using Outlook 10
B Outlook to Word Template error Using Outlook 4
J Just installed Outlook 2010 on computer and user is getting a 0x80004005 error Using Outlook.com accounts in Outlook 1
J Outlook 2007 Error sharing Calendar: Error while preparing to send sharing message Using Outlook.com accounts in Outlook 2
J Customizing PST error message in Outlook Using Outlook 8
R Outlook 2013 cannot send email error 0x700700c1 Using Outlook 1

Similar threads

Back
Top