Bonjour tout le monde,
Je suis en train de déveloper un petit utilitaire qui permet l'impression,
suite a un click d'un bouton que je rajoute à la barre d'outil de Outlook,
de tout les attachements PDF contenu dans la boite de reception, ce qui en
dévelopement fonctionne plus ou moins bien,
Je me demandais, le code fonctionnant une fois sur 10 en développement
peut être qu'il y a une partie que je n'ai pas compris encore pour
déveloper des add-ins,
J'ai démaré avec le wizard de visual studio pour faire un add-in, ajouté
les bonnes références pour Outlook et suivi des exemples trouvés sur
Google, mais je n'arrive toujours pas a faire fonctionner de façon
régulière soit sur mon poste ou tout autre poste ou j'install le petit
utilitaire,
Qqun aurait une idée sur la façon de procéder pour débugger ou pour
implenter l'application sur un autre poste ? sur mon poste le debug semble
foncionner une fois sur 10 également ...
Merci à l'avance !
Him
Bonjour tout le monde,
Je suis en train de déveloper un petit utilitaire qui permet l'impression,
suite a un click d'un bouton que je rajoute à la barre d'outil de Outlook,
de tout les attachements PDF contenu dans la boite de reception, ce qui en
dévelopement fonctionne plus ou moins bien,
Je me demandais, le code fonctionnant une fois sur 10 en développement
peut être qu'il y a une partie que je n'ai pas compris encore pour
déveloper des add-ins,
J'ai démaré avec le wizard de visual studio pour faire un add-in, ajouté
les bonnes références pour Outlook et suivi des exemples trouvés sur
Google, mais je n'arrive toujours pas a faire fonctionner de façon
régulière soit sur mon poste ou tout autre poste ou j'install le petit
utilitaire,
Qqun aurait une idée sur la façon de procéder pour débugger ou pour
implenter l'application sur un autre poste ? sur mon poste le debug semble
foncionner une fois sur 10 également ...
Merci à l'avance !
Him
Bonjour tout le monde,
Je suis en train de déveloper un petit utilitaire qui permet l'impression,
suite a un click d'un bouton que je rajoute à la barre d'outil de Outlook,
de tout les attachements PDF contenu dans la boite de reception, ce qui en
dévelopement fonctionne plus ou moins bien,
Je me demandais, le code fonctionnant une fois sur 10 en développement
peut être qu'il y a une partie que je n'ai pas compris encore pour
déveloper des add-ins,
J'ai démaré avec le wizard de visual studio pour faire un add-in, ajouté
les bonnes références pour Outlook et suivi des exemples trouvés sur
Google, mais je n'arrive toujours pas a faire fonctionner de façon
régulière soit sur mon poste ou tout autre poste ou j'install le petit
utilitaire,
Qqun aurait une idée sur la façon de procéder pour débugger ou pour
implenter l'application sur un autre poste ? sur mon poste le debug semble
foncionner une fois sur 10 également ...
Merci à l'avance !
Him
Merci de ta réponse,
Par contre j'aimerais pouvoir le debugger localement avant pour être
certain que le tout fonctionne,
Physiquement j'ai un petit bouton que je rajoute dans la barre d'outil de
outlook qui s'affiche très bien , par contre le reste ne semble pas tout
le temps fonctionner et je ne comprend pas trop pourquoi, voici un bout de
mon code peut être y a t-il quelque chose dedans qui cause ce problème,
bien que il ait déjà fonctionné !
Public Sub OnStartupComplete(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnStartupComplete
On Error Resume Next
Dim oCommandBars As CommandBars
Dim oStandardBar As CommandBar
' Set up a custom button on the "Standard" command bar.
oCommandBars = applicationObject.CommandBars
If oCommandBars Is Nothing Then
' Outlook has the CommandBars collection on the Explorer object.
oCommandBars = applicationObject.ActiveExplorer.CommandBars
End If
oStandardBar = oCommandBars.Item("Standard")
If oStandardBar Is Nothing Then
' Access names its main toolbar Database.
oStandardBar = oCommandBars.Item("Database")
End If
' In case the button was not deleted, use the exiting one.
MyButton = oStandardBar.Controls.Item("Polyform Auto-print")
If MyButton Is Nothing Then
MyButton = oStandardBar.Controls.Add(1)
With MyButton
.Caption = "Polyform Auto-Print"
.Style = MsoButtonStyle.msoButtonCaption
' The following items are optional, but recommended.
' The Tag property lets you quickly find the control
' and helps MSO keep track of it when more than
' one application window is visible. The property is required
' by some Office applications and should be provided.
.Tag = "Polyform Auto-print"
' The OnAction property is optional but recommended.
' It should be set to the ProgID of the add-in, so that if
' the add-in is not loaded when a user clicks the button,
' MSO loads the add-in automatically and then raises
' the Click event for the add-in to handle.
.OnAction = "!<MyCOMAddin.Connect>"
.Visible = True
End With
End If
MsgBox("button load")
oStandardBar = Nothing
oCommandBars = Nothing
End Sub
Private Sub MyButton_Click(ByVal Ctrl As
Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean)
Handles MyButton.Click
Dim myOutlook As Outlook.Application = New Outlook.Application
Dim myNs 'As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim myMessage As Object
Dim pathName As String
Dim myAttachement As Outlook.Attachment
Dim items As Outlook.Items
myNs = myOutlook.GetNamespace("MAPI")
myFolder = myNs.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
items = myFolder.Items
MsgBox("variable setter")
Dim i As Integer
Dim oMsg As Outlook.MailItem
Dim attch, monExt, maLongueur
For i = 1 To items.Count
oMsg = items.Item(i)
If oMsg.Attachments.Count > 0 Then
oMsg.Attachments.Item(i).SaveAsFile("c:travailtempattachements" &
oMsg.Attachments.Item(i).FileName)
maLongueur = Len(oMsg.Attachments.Item(i).FileName)
monExt = Mid(oMsg.Attachments.Item(i).FileName, maLongueur - 2, 3)
MsgBox("Entre dans le case " & maLongueur & " " & monExt)
Select Case monExt
Case "pdf"
Process.Start("c:Program FilesAdobeAcrobat 6.0ReaderAcroRd32.exe",
"/p/h ""C:travailtempattachements" & oMsg.Attachments.Item(i).FileName
& "")
End Select
MsgBox(oMsg.Attachments.Item(i).FileName)
End If
Next i
myOutlook = Nothing
myNs = Nothing
myFolder = Nothing
oMsg = Nothing
items = Nothing
MsgBox("Tout les commandes ont été imprimé correctement !")
End Sub
Donc je me demande s'il n'y a pas quelque chose de pas bien programmé ,
parce que je développe en .net depuis 6-7 mois pour Win Ce mais j'avais
j'amais touché a ce genre de programmation sauf de vb6 dans le temps =)
Merci !
Him
Merci de ta réponse,
Par contre j'aimerais pouvoir le debugger localement avant pour être
certain que le tout fonctionne,
Physiquement j'ai un petit bouton que je rajoute dans la barre d'outil de
outlook qui s'affiche très bien , par contre le reste ne semble pas tout
le temps fonctionner et je ne comprend pas trop pourquoi, voici un bout de
mon code peut être y a t-il quelque chose dedans qui cause ce problème,
bien que il ait déjà fonctionné !
Public Sub OnStartupComplete(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnStartupComplete
On Error Resume Next
Dim oCommandBars As CommandBars
Dim oStandardBar As CommandBar
' Set up a custom button on the "Standard" command bar.
oCommandBars = applicationObject.CommandBars
If oCommandBars Is Nothing Then
' Outlook has the CommandBars collection on the Explorer object.
oCommandBars = applicationObject.ActiveExplorer.CommandBars
End If
oStandardBar = oCommandBars.Item("Standard")
If oStandardBar Is Nothing Then
' Access names its main toolbar Database.
oStandardBar = oCommandBars.Item("Database")
End If
' In case the button was not deleted, use the exiting one.
MyButton = oStandardBar.Controls.Item("Polyform Auto-print")
If MyButton Is Nothing Then
MyButton = oStandardBar.Controls.Add(1)
With MyButton
.Caption = "Polyform Auto-Print"
.Style = MsoButtonStyle.msoButtonCaption
' The following items are optional, but recommended.
' The Tag property lets you quickly find the control
' and helps MSO keep track of it when more than
' one application window is visible. The property is required
' by some Office applications and should be provided.
.Tag = "Polyform Auto-print"
' The OnAction property is optional but recommended.
' It should be set to the ProgID of the add-in, so that if
' the add-in is not loaded when a user clicks the button,
' MSO loads the add-in automatically and then raises
' the Click event for the add-in to handle.
.OnAction = "!<MyCOMAddin.Connect>"
.Visible = True
End With
End If
MsgBox("button load")
oStandardBar = Nothing
oCommandBars = Nothing
End Sub
Private Sub MyButton_Click(ByVal Ctrl As
Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean)
Handles MyButton.Click
Dim myOutlook As Outlook.Application = New Outlook.Application
Dim myNs 'As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim myMessage As Object
Dim pathName As String
Dim myAttachement As Outlook.Attachment
Dim items As Outlook.Items
myNs = myOutlook.GetNamespace("MAPI")
myFolder = myNs.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
items = myFolder.Items
MsgBox("variable setter")
Dim i As Integer
Dim oMsg As Outlook.MailItem
Dim attch, monExt, maLongueur
For i = 1 To items.Count
oMsg = items.Item(i)
If oMsg.Attachments.Count > 0 Then
oMsg.Attachments.Item(i).SaveAsFile("c:travailtempattachements" &
oMsg.Attachments.Item(i).FileName)
maLongueur = Len(oMsg.Attachments.Item(i).FileName)
monExt = Mid(oMsg.Attachments.Item(i).FileName, maLongueur - 2, 3)
MsgBox("Entre dans le case " & maLongueur & " " & monExt)
Select Case monExt
Case "pdf"
Process.Start("c:Program FilesAdobeAcrobat 6.0ReaderAcroRd32.exe",
"/p/h ""C:travailtempattachements" & oMsg.Attachments.Item(i).FileName
& "")
End Select
MsgBox(oMsg.Attachments.Item(i).FileName)
End If
Next i
myOutlook = Nothing
myNs = Nothing
myFolder = Nothing
oMsg = Nothing
items = Nothing
MsgBox("Tout les commandes ont été imprimé correctement !")
End Sub
Donc je me demande s'il n'y a pas quelque chose de pas bien programmé ,
parce que je développe en .net depuis 6-7 mois pour Win Ce mais j'avais
j'amais touché a ce genre de programmation sauf de vb6 dans le temps =)
Merci !
Him
Merci de ta réponse,
Par contre j'aimerais pouvoir le debugger localement avant pour être
certain que le tout fonctionne,
Physiquement j'ai un petit bouton que je rajoute dans la barre d'outil de
outlook qui s'affiche très bien , par contre le reste ne semble pas tout
le temps fonctionner et je ne comprend pas trop pourquoi, voici un bout de
mon code peut être y a t-il quelque chose dedans qui cause ce problème,
bien que il ait déjà fonctionné !
Public Sub OnStartupComplete(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnStartupComplete
On Error Resume Next
Dim oCommandBars As CommandBars
Dim oStandardBar As CommandBar
' Set up a custom button on the "Standard" command bar.
oCommandBars = applicationObject.CommandBars
If oCommandBars Is Nothing Then
' Outlook has the CommandBars collection on the Explorer object.
oCommandBars = applicationObject.ActiveExplorer.CommandBars
End If
oStandardBar = oCommandBars.Item("Standard")
If oStandardBar Is Nothing Then
' Access names its main toolbar Database.
oStandardBar = oCommandBars.Item("Database")
End If
' In case the button was not deleted, use the exiting one.
MyButton = oStandardBar.Controls.Item("Polyform Auto-print")
If MyButton Is Nothing Then
MyButton = oStandardBar.Controls.Add(1)
With MyButton
.Caption = "Polyform Auto-Print"
.Style = MsoButtonStyle.msoButtonCaption
' The following items are optional, but recommended.
' The Tag property lets you quickly find the control
' and helps MSO keep track of it when more than
' one application window is visible. The property is required
' by some Office applications and should be provided.
.Tag = "Polyform Auto-print"
' The OnAction property is optional but recommended.
' It should be set to the ProgID of the add-in, so that if
' the add-in is not loaded when a user clicks the button,
' MSO loads the add-in automatically and then raises
' the Click event for the add-in to handle.
.OnAction = "!<MyCOMAddin.Connect>"
.Visible = True
End With
End If
MsgBox("button load")
oStandardBar = Nothing
oCommandBars = Nothing
End Sub
Private Sub MyButton_Click(ByVal Ctrl As
Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean)
Handles MyButton.Click
Dim myOutlook As Outlook.Application = New Outlook.Application
Dim myNs 'As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim myMessage As Object
Dim pathName As String
Dim myAttachement As Outlook.Attachment
Dim items As Outlook.Items
myNs = myOutlook.GetNamespace("MAPI")
myFolder = myNs.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
items = myFolder.Items
MsgBox("variable setter")
Dim i As Integer
Dim oMsg As Outlook.MailItem
Dim attch, monExt, maLongueur
For i = 1 To items.Count
oMsg = items.Item(i)
If oMsg.Attachments.Count > 0 Then
oMsg.Attachments.Item(i).SaveAsFile("c:travailtempattachements" &
oMsg.Attachments.Item(i).FileName)
maLongueur = Len(oMsg.Attachments.Item(i).FileName)
monExt = Mid(oMsg.Attachments.Item(i).FileName, maLongueur - 2, 3)
MsgBox("Entre dans le case " & maLongueur & " " & monExt)
Select Case monExt
Case "pdf"
Process.Start("c:Program FilesAdobeAcrobat 6.0ReaderAcroRd32.exe",
"/p/h ""C:travailtempattachements" & oMsg.Attachments.Item(i).FileName
& "")
End Select
MsgBox(oMsg.Attachments.Item(i).FileName)
End If
Next i
myOutlook = Nothing
myNs = Nothing
myFolder = Nothing
oMsg = Nothing
items = Nothing
MsgBox("Tout les commandes ont été imprimé correctement !")
End Sub
Donc je me demande s'il n'y a pas quelque chose de pas bien programmé ,
parce que je développe en .net depuis 6-7 mois pour Win Ce mais j'avais
j'amais touché a ce genre de programmation sauf de vb6 dans le temps =)
Merci !
Him