Create an appointment without start outlook

  • Thread starter othmane benchebab
  • Start date
O

othmane benchebab

hello

i create an asp.net application , and i want to create an appointment in outlook 2007.

When i start the application and in the same time i open outlook , i can create an appointment.
but xhen i start application and close outlook , i have a problem with (newAppointment.Body) and (newAppointment.GlobalAppointmentId)
can u help me please?
 
S

Sue Mosher [MVP-Outlook]

From ASP.net, you should be using iCalendar techniques to present a new appointment to the user, who can then choose to save it in Outlook. Outlook itself is not suitable to automate in server-basedcode.
 
O

othmane benchebab

Hi thank you for ure ansewer.
i m agree with u about that we can't automate outlook through an asp.net application.
but i try to automate outlook through a winform but i have the same problem when i try to debug my application.
 
S

Sue Mosher [MVP-Outlook]

What precisely do you mean by "the same problem"? With a client winform application, use the Application.CreateItem method from the Outlook object model to create a new appointment.
 
O

othmane benchebab

yes i do that but i have this problem

//__________________________________________________________ _
public Outlook.ApplicationClass outlookApplication;

public ObjetOutlook()
{
outlookApplication = new Microsoft.Office.Interop.Outlook.ApplicationClass();
}
nouveauRdv = (Outlook.AppointmentItem)outlookApplication.CreateItem(Micro soft.Office.Interop.Outlook.OlItemType.olAppointmentItem);

nouveauRdv.Start = Convert.ToDateTime(_start);
nouveauRdv.End = Convert.ToDateTime(_fin);


nouveauRdv.Save();
ID = nouveauRdv.GlobalAppointmentID;
//_____________________________________________________

but my ID is null when Outlook is closed.
have u any idea?
 
S

Sue Mosher [MVP-Outlook]

If Outlook is not already running, you need to call the Namespace.Logon method to ensure that you're properly connected with valid session. Since this is Outlook 2007, you should also fill in the Subject, as well as Start and End. Otherwise, I don't know why there'd be a problem.
 
O

othmane benchebab

Thank u you for ur help
that's work
public ObjetOutlook()
{
outlookApplication = new Microsoft.Office.Interop.Outlook.ApplicationClass();
// Get the NameSpace and Logon information.
// Outlook.NameSpace oNS = (Outlook.NameSpace)oApp.GetNamespace("mapi");
Outlook.NameSpace oNS = outlookApplication.GetNamespace("mapi");
//Log on by using a dialog box to choose the profile.
oNS.Logon(Missing.Value, Missing.Value, true, true); User = outlookApplication.Session.CurrentUser.Name;

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top