Ask a questionAsk a question
 

AnswerSync Appointment with Web service

  • Saturday, November 07, 2009 10:50 AMJohny 1111 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi ,

     

    I have already an application that is taken care of Appointments’ in a company .This application provides option to create Appointments in Outlook calendar by an Addin.

    Certain scenario’s customers will update the appointments in Custom Application rather than Outlook Appointment. So this case I need to do Sync both Appointments’.

     

    For this case I am planning to call a web service from Outlook (Ex :Call the sync routine whenever a Calendar owned by the logged in User is visible).I hooping to use the same addin for this purpose.

     

    So guys if you have approach or idea for the same kindly replay to the same.

    Thanks

Answers

  • Wednesday, November 11, 2009 2:46 AMBessie ZhaoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hello again John,

    As I mentioned above, here is a ViewSwitch event [See: Explorer.ViewSwitch Event], which is raised on an Explorer object when the view changes either because the user changed the view using the View menu or because the user selected another folder. Using View menu means changing view from View->Current View. Sorry for misleading you, it just does not fire when switching from Day View, Month View, Week View.

    In VSTO project, the expression of event needs to be defined as an application-level one. and this event will fire every time. Code like this,

            Outlook.Explorer explorer;
            private void ThisAddIn_Startup(object sender, System.EventArgs e)
            {
                explorer = this.Application.ActiveExplorer();
                explorer.ViewSwitch += new Microsoft.Office.Interop.Outlook.ExplorerEvents_10_ViewSwitchEventHandler(explorer_ViewSwitch);
            }

    Best regards,
    Bessie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

All Replies

  • Tuesday, November 10, 2009 4:30 AMBessie ZhaoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello Johny,

    Here, I think you could add a web reference in this add-in project [See: How to: Add and Remove Web References].  And now you could call the method defined in web service. The code sample like this.

                Outlook.Folder folder=this.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders .olFolderCalendar) as Outlook.Folder;
                Outlook.AppointmentItem appointitem=folder.Items.Add(Outlook.OlItemType.olAppointmentItem) as Outlook.AppointmentItem;
                appointitem.Subject="...";
                ...

                appointitem.Save();

    Best regards,
    Bessie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Tuesday, November 10, 2009 7:40 AMJohny 1111 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    Hi

    Thank you for your replay J

    This is not the problem of calling webservice using webreference, but need to know from where have to call

     

    I want to call this service routine from Outlook Addin after the Each Outlook Exchange server update and as well as each Calendar view change

     

    Thanks in advance

     

    Thanks

    Johny

  • Tuesday, November 10, 2009 9:59 AMBessie ZhaoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hello again Johny,

    Sorry for mistaking this scenario.

    <<I want to call this service routine from Outlook Addin after the Each Outlook Exchange server update and as well as each Calendar view change>>
    It seems that you want to trace the updating of the Exchange sever. As far as I know, Outlook object model does not expose such event/method.

    I am not sure that it works, just give a suggestion. In outlook object model, I think you could try to use ItemChange event of calendar folder items [See: Items.ItemChange Event], and in this event handler call method of this web service. Also outlook object model has a NameSpace Object related to exchange server [See: NameSpace Object Members]. However, there is no such an event firing when exchange server update. 

    For calendar view change, I guess you mean calendar folder switches between Day View, Month View, Week View. Here is a ViewSwitch event [See: Explorer.ViewSwitch Event], which is raised on an Explorer object when the view changes either because the user changed the view using the View menu or because the user selected another folder.

    Best regards,
    Bessie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Tuesday, November 10, 2009 10:13 AMJohny 1111 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi Bessie,

    Thank you for your response .Thank you once again


    I tried using the View switch event , but it seems firing only to folder switch like clicking on Calendar then Inbox... etc..

    I have also tried using BeforeViewSwitch event , but not even firing once

    Please see my code below

    this.Application.ActiveExplorer().ViewSwitch += new Microsoft.Office.Interop.Outlook.ExplorerEvents_10_ViewSwitchEventHandler(ThisAddIn_ViewSwitch);

    //Method

    void ThisAddIn_ViewSwitch()

    {

    throw new NotImplementedException();

    }

    Thanks

    John

  • Wednesday, November 11, 2009 2:46 AMBessie ZhaoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hello again John,

    As I mentioned above, here is a ViewSwitch event [See: Explorer.ViewSwitch Event], which is raised on an Explorer object when the view changes either because the user changed the view using the View menu or because the user selected another folder. Using View menu means changing view from View->Current View. Sorry for misleading you, it just does not fire when switching from Day View, Month View, Week View.

    In VSTO project, the expression of event needs to be defined as an application-level one. and this event will fire every time. Code like this,

            Outlook.Explorer explorer;
            private void ThisAddIn_Startup(object sender, System.EventArgs e)
            {
                explorer = this.Application.ActiveExplorer();
                explorer.ViewSwitch += new Microsoft.Office.Interop.Outlook.ExplorerEvents_10_ViewSwitchEventHandler(explorer_ViewSwitch);
            }

    Best regards,
    Bessie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.