Results 1 to 21 of 21

Thread: [2005] - Display Shared Outlook Calendar in Application

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    111

    Question [2005] - Display Shared Outlook Calendar in Application

    Hi All,

    I've tried finding articles relating to this question without success. I would like to display a shared outlook calendar within my application which allows the normal functions of an outlook calendar. Any suggestions / links would be much appreciated.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] - Display Shared Outlook Calendar in Application

    AFAIK there is no Outlook control like that for use in VB. You will have to recreate it probably using the Outlook Object Model.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    111

    Question Re: [2005] - Display Shared Outlook Calendar in Application

    Thanks for the reply. I found a team calendar form that mimics an outlook calendar but it was written in C# and converting it to VB would take forever. Does anyone know of anything similar which has been written in VB?

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] - Display Shared Outlook Calendar in Application

    There are free utilities and sites that have code converters.

    http://tangiblesoftwaresolutions.com is one that offers a free unlimited time trial version.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    111

    Question Re: [2005] - Display Shared Outlook Calendar in Application

    Cheers for the link. The project has been converted but when I make changes, the following error message is displayed.

    Code generation for property 'CalendarItems' failed. Error was: 'Type 'CalendarLibrary.CalendarItem' In Assembly 'CalendarLibrary, Version = 1.0.3071.26008, Culture = neutral, PublicTokenKey = null' is not marked as serializable.
    I looked around google and found an article on 'codeproject' which I downloaded and built but I have no idea how to use it.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] - Display Shared Outlook Calendar in Application

    Sounds like the serializable attribute is missing from for the class that contains the CalendarItems property.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    111

    Question Re: [2005] - Display Shared Outlook Calendar in Application

    Any suggestions on how to fix it? Would I have have to go back to the source code, add the attribute and re-compile?

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] - Display Shared Outlook Calendar in Application

    Lets start at the beginning.

    Before you converted the C# code you tested it and it compiled and ran? what version is the C# code for and what version of VS are you using?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    111

    Question Re: [2005] - Display Shared Outlook Calendar in Application

    The project compiled and ran under C# but I get the same error message in the C# Project (e.g When I change the name of the Form). Not sure what you mean by C# Version but I found v2.0.50727. Visual Studio 2008 is being used for this project.

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] - Display Shared Outlook Calendar in Application

    Can you post the link to the project? If it gave an error before you converted it then there is a problem with the original code, not the conversion.

    Ps, if you dont change the name of the form does it work?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    111

    Question Re: [2005] - Display Shared Outlook Calendar in Application

    Link to the file is Here

    The form works as expected after it has been compiled. Changing a control name etc then compiling / saving will display that serialization error.

  12. #12
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [2005] - Display Shared Outlook Calendar in Application

    I'm sure there will be a better way (so ive probably wasted the last 25 mins of my life) but here is one way you could extract the existing appointments from the calendar:
    vb.net Code:
    1. 'make sure you include this if you are going to try and use this example
    2. Imports Microsoft.Office.Interop
    3.  
    4. 'I just copied and pasted my entire form so this is just the standard windows form class declaration
    5. Public Class Form1
    6.  
    7. 'Declare the outlook objects we are going to use
    8.     Dim app As Outlook.Application
    9.     Dim calendarcontents As Outlook.MAPIFolder
    10.  
    11. 'Im just using the Form Load event to fill the datagridview
    12.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    13.  
    14.         app = New Outlook.Application
    15.        
    16.         'Log in to Outlook profile, this must already exist on the PC
    17.         app.Session.Logon("Outlook_Profile_Name_Here", "Password_Here", False, True)
    18.        
    19.         'Get the default calendar for this outlook profile
    20.         calendarcontents = app.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar)
    21.  
    22.         'Loop through all items in the calendar and add them to my datagridview control
    23.         For i As Integer = 1 To calendarcontents.Items.Count
    24.             appointmentgrid.Rows.Add()
    25.             appointmentgrid.Rows(i - 1).Cells("starttime").Value = calendarcontents.Items(i).Start
    26.             appointmentgrid.Rows(i - 1).Cells("endtime").Value = calendarcontents.Items(i).End
    27.             appointmentgrid.Rows(i - 1).Cells("title").Value = calendarcontents.Items(i).subject
    28.         Next
    29.  
    30.     End Sub
    31. End Class
    In that example I am just adding the start time, end time and subject/title to a DataGrideView control. I'm sure if you really ran out of options you could just create your own calendar and then possibly use the methods I have used above to add existing appointmets to it. Also, in my example I am just getting the default mailbox's calender folder, you could specify a specific mailbox's calendar using the \\mailboxname\calendar format.
    If you search google you will find a way to add appointments as well so you could just use your DIY calendar control to add appointments as well.

    Note - I added a reference to the Outlook 11.0 Object Library and obviously Outlook needs to be installed on the machine that this would run from or the code will not work. At the end of the day, if you have to resort to this method you might decide its easier to just let the users use Outlook to add appointments instead of doing it through your app as I can see it being quite a bit of work.
    Like I said though, someone else will probably have a better solution
    Last edited by chris128; May 30th, 2008 at 10:13 AM.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  13. #13

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    111

    Question Re: [2005] - Display Shared Outlook Calendar in Application

    Hi chris128,

    That would work perfectly but is it possible to update the datagrid based on a certain date. Also, the calendar in question is actually located in a public folder and relies on NT security permissions for access.

  14. #14
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [2005] - Display Shared Outlook Calendar in Application

    erm yeah you could use the method I described above to loop through all of the calendar appointment items but add an IF statement in that basicaly says if the start date is equal to the date that the user has selected then show the details of the appointment in the datagrid and if not, then hide the details. Hope that makes sense.

    To access the shared calendar in a public folder I believe you would just use the FolderPath property and point it to "\\Public Folders\foldername\calendarname"
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] - Display Shared Outlook Calendar in Application

    You have to transverse the Public folders one level at a time and not use the full path all at once. Also, that is the default public folder name which of course could be named differently.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  16. #16
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [2005] - Display Shared Outlook Calendar in Application

    Quote Originally Posted by RobDog888
    You have to transverse the Public folders one level at a time and not use the full path all at once. Also, that is the default public folder name which of course could be named differently.
    oh right, I didnt know you could only traverse one folder at a time... how odd.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  17. #17
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] - Display Shared Outlook Calendar in Application

    Yea, it makes for a pain in coding but you'd figure they would have given some kind of functionality like Explorer can go directly to a complete path. In Outlook you have the GetFolderFromID but you'd have to know/store the .EntryID first of that public folder.

    Although you can go like so...

    oApp.Session.Folders.Item(0).Folders.Item(0).Folders.Item(0).Name

    etc. to drill down the folder path if you know where you need to go.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  18. #18

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    111

    Question Re: [2005] - Display Shared Outlook Calendar in Application

    Using "oApp.Session.Folders.Item" could cause some grief because the directory structure could be changed at any given time. Is it possible to scan exchange / outlook for what calendars a user has permission to access and then place them in a drop down list?

    After selecting one of the calendars, the contents will be displayed.

    P.S - How did you go with the link that I posted RobDog888?

  19. #19
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] - Display Shared Outlook Calendar in Application

    It runs for me but my conversion utility is on my other system so I'll try converting it tomorrow (just stopped by for a quick visit).

    If you only changed the control name in the Calendar.cs class then it wil break as the control name is referenced throughout the entire project. You need to change it everywhere to keep it working.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  20. #20
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] - Display Shared Outlook Calendar in Application

    Quote Originally Posted by nolim8ts
    Using "oApp.Session.Folders.Item" could cause some grief because the directory structure could be changed at any given time. Is it possible to scan exchange / outlook for what calendars a user has permission to access and then place them in a drop down list?

    After selecting one of the calendars, the contents will be displayed.

    P.S - How did you go with the link that I posted RobDog888?
    This was only in reference to drilling down the public folders as th first three folders do not get renamed once they are set.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  21. #21

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    111

    Question Re: [2005] - Display Shared Outlook Calendar in Application

    Hi RobDog888,

    Any luck in converting the file?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width