none
Parent of CurrentItem of an inspector always points to default calendar RRS feed

  • Question

  • hi,

    when i open an an inspector to create a new appointment item,,Is there any way to know ,for which calendar(default or shared) application inspector has been opened?

    Right now i am trying to get in this way

    Public Class ThisAddIn
        Dim ApptEventHandler As New CalClass

        Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
            Try
                ApptEventHandler.Initialize_handler(Me.Application)
                'AddHandler (CType(Application, Outlook.ApplicationEvents_10_Event)).Quit, AddressOf ThisAddIn_Quit
            Catch exc As System.Exception
                CodeSite.SendException(exc)
            End Try
        End Sub

    End Class

     CalClass

    Public Class CalClass

    Dim WithEvents AppInspectors As Outlook.Inspectors

    Public Sub Initialize_handler(ByVal Application As Outlook.Application)

    AppInspectors = Application.Inspectors

    end sub

     

    Private Sub AppInspectors_NewInspector(ByVal Inspector As Microsoft.Office.Interop.Outlook.Inspector) Handles AppInspectors.NewInspector

     Dim CurrentItem As Outlook.AppointmentItem = Inspector.CurrentItem

    Log(CurrentItem.Parent.FolderPath)

    End Sub

    End Class

    CurrentItem.Parent.FolderPath  always give path of Default calendar folder no matter on which calendar i am goig to create an appointment. is it a default behavior, then is there any other way to do that?

    i am using VSTO2005 with outlook 2007

    Thanks

    NItin

     

     

    Friday, August 19, 2011 1:51 PM

Answers

  • Hi Tom,

     

    I was not aware about that what you pointed out. it seems like its a default behavior. well, i found some other wayto do that.

    may be useful for someone else,

    i am using explorer.FolderSwitch event, so before opening any inspector for a particular calendar in a folder, a folderswoitch event will fire and there we can get what is current folder and store its refrence  in some global variable and and when inspector will open use tha variable.

    Thanks

    Tuesday, August 23, 2011 8:27 AM

All replies

  • Hello,

    Try to pre-select a date/time in the non-default calendar and then create an appointment in the Outlook 2007 UI via File | New | Appointment. Does CurrentItem.Parent.FolderPath returns the default calendar in this case?


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    • Edited by Andrei Smolin Friday, August 19, 2011 2:44 PM syntax correction
    Friday, August 19, 2011 2:43 PM
  •  

    Hi Anderi,

     

    Thanks for responding!

    i did not try in this way yet, but actual user of my addin will not be creating appointment in this way, they might create an appointment through context menu and selecting New Appointment option. in this way CurrentItem.Parent.FolderPath is always giving me folder path for default calendar.

     

    Thanks

     

    Friday, August 19, 2011 9:19 PM
  • Hi Nitrup,

     

    Thanks for posting in the MSDN Forum.

     

    It’s based on my understanding the new appointment item has no host folder before it saved. And it will be saved in to the default account’s calendar folder. So it’s seems meaningless to retrieve the CurrentItem.Parent.FolderPath.

     

    If I have misunderstanding anything please feel free to let me know.

     

    Have a good day,

     

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, August 23, 2011 3:29 AM
    Moderator
  • Hi Tom,

     

    I was not aware about that what you pointed out. it seems like its a default behavior. well, i found some other wayto do that.

    may be useful for someone else,

    i am using explorer.FolderSwitch event, so before opening any inspector for a particular calendar in a folder, a folderswoitch event will fire and there we can get what is current folder and store its refrence  in some global variable and and when inspector will open use tha variable.

    Thanks

    Tuesday, August 23, 2011 8:27 AM
  • Hi Nitrup,

     

    I’m glad to hear you have solved your issue. Thanks for share your solution here, it will be very beneficial for all of the community members who have similar problem to see how you solved it.

     

    Have a good day,

     

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, August 24, 2011 7:09 AM
    Moderator