does anyone know if it's possible to 'call' an Add-in procedure through a customized button in outlook 2013? Beacuse actually my add-in starts automatically when i open outlook, but i want to make the user decide when he wants to start it.
Asked
Active
Viewed 77 times
1 Answers
0
Yes, you may call public methods of add-ins from a VBA code assigned to custom buttons. See Walkthrough: Calling Code in an Application-Level Add-in from VBA for more information.
The add-in can add custom Ribbon controls, so the user will have a way to call its functionality. What exactly do you need to implement? Why do you need to call an add-in's procedure from another controls?

Eugene Astafiev
- 47,483
- 3
- 24
- 45
-
Thank you Eugene. I'll try it this way. What i'm trying to do, is to create an add-in with a log-in form that users must use to retrieve their appointments from another calendar in a custom crm. After they log-in they will see all theirs appointments retrieved (in another windows form) with a ftp connection on our DB and select which of them they want to add in the outlook calendar. But i'm having some troubles in saving the Outlook.AppointmentItem in the form1.cs because it can't find CreateItem method of the Application class. – mmuca May 21 '15 at 14:25
-
Could you be more specific? What form are you talking about? And what item do you need to create? – Eugene Astafiev May 21 '15 at 14:31
-
When the add-in starts it opens the form1 with the ".show()" instruction from the "ThisAddIn_Startup" method. This form1 (it's a windows form i added to the project) is the one i use only for the login. After the login it's done, the Class Form1 closes itself and opens Form2 (another windows form added). This second form will display all the appointments retrieved from the remote DB, given the user credentials. So now inside the Class Form2 i have a simple button that i want to use to save the appointments inside the outlook calendar. – mmuca May 21 '15 at 14:49
-
public void AddAppoint(DateTime data, String note, String luogo) { Outlook.AppointmentItem appt = Application.CreateItem(Outlook.OlItemType.olAppointmentItem) as Outlook.AppointmentItem; appt.Subject = note; appt.Location = luogo; appt.Start = data; appt.End = data.AddHours(1); appt.Save(); } – mmuca May 21 '15 at 14:51
-
'System.Windows.Form.Application' does not contain a definition for 'CreateItem' is the error message i have. The same code inside the class ThisAddIn works fine. – mmuca May 21 '15 at 14:55
-
Try to use an alias for the Outlook's namespace or declare the type names fully-qualified including namespaces. The Application property can't be resolved by the compiler (belong to two different namespaces declared). – Eugene Astafiev May 23 '15 at 09:32
-
you're right. That's what i needed. Now i don't have that problem anymore and it seems it works properly. Thanks – mmuca May 25 '15 at 11:56