none
Reading Items from a "Public" Calendar Outlook 2010 in C# RRS feed

  • Question

  • i am writing a small for the workshop that will display when items are due to be shipped, i am thinking an easy way for this to work would be for a colleague to have a shared calendar on her machine that she can update with info using Outlook that is already installed, this calendar can then be read from my app, and the info displayed on the screen... i can get access to my local calendars, but cannot seem to find any examples of accessing a shared calendar only.

    any help would be greatly appreciated.


    • Edited by racing57 Thursday, June 7, 2012 12:16 PM
    Thursday, June 7, 2012 9:59 AM

Answers

  • well i have managed to get the public calendar... i just need to pull out the items between specific dates now, i got to the public calendar with the following

                Outlook._Application olApp = new Microsoft.Office.Interop.Outlook.Application();
                Outlook._NameSpace olNS = olApp.GetNamespace("MAPI"); 
                Outlook._Folders oFolders;
                oFolders = olNS.Folders;
                Outlook.MAPIFolder oPublicFolder = oFolders["Public Folders - email@emailaddress.co.uk"];
                oFolders = oPublicFolder.Folders;
                Outlook.MAPIFolder oAllPFolder = oFolders["All Public Folders"];
                oFolders = oAllPFolder.Folders;
                Outlook.MAPIFolder oCalendar = oFolders["Company Calendar"];
                oFolders = oAllPFolder.Folders;


    Thursday, June 7, 2012 1:20 PM

All replies

  • how do you want to access that shared calendar? through outlook API? you will have to have outlook installed on your computer also and connected to exchange. Or do you want to access it differently?
    Thursday, June 7, 2012 10:42 AM
  • i dont mind, i can put outlook on the screen, basically i will have a 52" screen with built in pc on the wall in the factory/workshop, so i can either use outlook on the client, or i could access exchange directly as i will have access to the server also ?

    i have been reading up on this, and there are lots of ways to read local calendars, but i have not been able to find anything that allows me to access the shared calendar. i have one on my system that is called 'Company Calendar' when i loop through all the local folders, this folder is omitted.

    oh, the testing i have been doing is using the 'Microsoft.Office.Interop.Outlook'


    • Edited by racing57 Thursday, June 7, 2012 10:52 AM
    Thursday, June 7, 2012 10:48 AM
  • problem was not with showing up outlook, it can stay 'hidden'. I was more concerned if you want to access this through windows service or do not want to have outlook installed there. If outlook will be there then i guess you could access that shared folder using Session.GetSharedDefaultFolder http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook._namespace.getshareddefaultfolder
    Thursday, June 7, 2012 10:58 AM
  • Hi Damian, reading a little more into it, it is actually a calendar that is in a 'Public' folder, so is on the exchange server, i guess that is why i cannot find it when checking the local machine... so would i need to connect directly to the exchange server, or is there a way of accessing the calendar that is displayed on the local machine... i dont need to edit it the calendar from the client app, as this will be edited through outlook from one of my colleagues machines. i just need to read the calendar items in so i can populate the screen.
    Thursday, June 7, 2012 12:06 PM
  • well i have managed to get the public calendar... i just need to pull out the items between specific dates now, i got to the public calendar with the following

                Outlook._Application olApp = new Microsoft.Office.Interop.Outlook.Application();
                Outlook._NameSpace olNS = olApp.GetNamespace("MAPI"); 
                Outlook._Folders oFolders;
                oFolders = olNS.Folders;
                Outlook.MAPIFolder oPublicFolder = oFolders["Public Folders - email@emailaddress.co.uk"];
                oFolders = oPublicFolder.Folders;
                Outlook.MAPIFolder oAllPFolder = oFolders["All Public Folders"];
                oFolders = oAllPFolder.Folders;
                Outlook.MAPIFolder oCalendar = oFolders["Company Calendar"];
                oFolders = oAllPFolder.Folders;


    Thursday, June 7, 2012 1:20 PM
  • for accessing appointmentitems between specific dates you can use Restrict on Items property in folder. If you have recurring appoitments you can set IncludeReccurences on Items and sort them by start date.

    Thursday, June 7, 2012 2:11 PM
  • Thanks Damian, i dont need to worry about Reccurences, these will be job specific entries, basically showing people when items need to be ready.

    i will look into the restrict item, as i will have 3 views on the page, today, tomorrow, and 4 days...

    Thursday, June 7, 2012 2:15 PM