none
Owner of a Calendar RRS feed

  • Question

  • Hi out there,

    I'm working on an Outlook-Addin, that is booking vacations for our emplyoees (c#, Outlook 2013/16/365). The problem: There are users, that do not do that themselves, but give others (asssistants of them) full access to their calendar, an let the assistants enter the appointments from their outlook (by "Open calender of other user" ...).

    The number of days is calulated, that number is subtracted from the remaining vacation, the data are written to a database etc.

    It is essential, that the subtraction should happen on the ledger of the "owner" of the calendar, and not on the current user of the session.

    In earlier versions of Outlook I simply created a new appointment on the current calendar, added an additional user, saved the item, and read the property organizer. But that runs into trouble with Outlook 2016.

    So my question is: Is there another way of getting the "Owner" of a calendar?

    Best Regards

    Andreas

    • Moved by Steve Fan Tuesday, December 20, 2016 5:54 AM
    Friday, December 16, 2016 3:53 PM

All replies

  • Hi Andreas,

    This forum is for general questions and feedback related to Outlook. Since your question is more related to Outlook Add-in, I'll move it to the Outlook for Developers forum:

    https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=outlookdev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

     Regards,

    Steve Fan


    Please remember to mark the replies as answers if they helped.

    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Tuesday, December 20, 2016 5:53 AM
  • Hello Andreas,

    You can use the GetSharedDefaultFolder method of the Namespace class which returns a Folder object that represents the specified default folder for the specified user.

    Sub ResolveName()  
     Dim myNamespace As Outlook.NameSpace  
     Dim myRecipient As Outlook.Recipient  
     Dim CalendarFolder As Outlook.Folder 
     Set myNamespace = Application.GetNamespace("MAPI")  
     Set myRecipient = myNamespace.CreateRecipient("Eugene Astafiev")  
     myRecipient.Resolve  
     If myRecipient.Resolved Then  
      Call ShowCalendar(myNamespace, myRecipient)  
     End If  
    End Sub 
     
      
    Sub ShowCalendar(myNamespace, myRecipient)  
     Dim CalendarFolder As Outlook.Folder 
     Set CalendarFolder = _  
     myNamespace.GetSharedDefaultFolder _  
     (myRecipient, olFolderCalendar)  
     CalendarFolder.Display  
    End Sub


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Tuesday, December 20, 2016 6:54 AM