![]() |
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
|
|||
|
|||
![]()
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.olMailIte m) 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.OlDefa ultFolders.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 |
Ads |
#2
|
|||
|
|||
![]()
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.olMailIte m) 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.OlDefa ultFolders.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 |
#3
|
|||
|
|||
![]()
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 [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.olMailIte m) 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.OlDefa ultFolders.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 |
#4
|
|||
|
|||
![]()
It simply looks like the MAPI message store provider provided by Google does
not support that functionality -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "Gpg" wrote in message ... 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 [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.olMailIte m) 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.OlDefa ultFolders.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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Why does the Address property of the Recipient object in the Outlook object model look funny? | Omatase | Outlook - General Queries | 2 | July 13th 07 09:09 PM |
Outlook Object Model Threading | MON205 | Outlook - General Queries | 8 | May 6th 07 04:37 PM |
Outlook Object Model Threading | MON205 | Add-ins for Outlook | 8 | May 6th 07 04:37 PM |
Outlook object model guard | Mark Priem | Outlook and VBA | 7 | January 3rd 07 06:41 PM |
How to redistribute Outlook Object Model? | papachina | Outlook and VBA | 5 | September 11th 06 07:14 PM |