LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read shared outlook calendar / all folders in my calendar

How can I access another appointment folder in red (1)? Or how is it possible to read all calender folders under "meine Kalender" (my calendar)? With the code below (2) I get access to my calendar only. I tried it with (3), to get the ref of the recipient, resolve it and getsharedfolder how is it writen here, but i cant read the count.

1) readOutlookCalendar3.JPG

2)

readOutlookCalendar4.jpg

3)readOutlookCalendar6.jpg

0 Kudos
Message 1 of 5
(4,114 Views)

I haven't worked with Microsoft's API to be worlds of help.

 

I did want to hit on a couple points.

 

First, did the code you linked work for you?  If so, we are finding a way to incorporate it into your code.  If not, ths likely is using an older/newer version of the API and we won't want to go down that path.

 

Second, please stop hating yourself.  The only reason you'd program in such a dizzying fashion is if you're not very fond of yourself.  Everything on the left of your code comes after the node on the right.  Instead of creating all of those loops, just swap the position of the code.  It'll make everything easier to read.  As you move forward in development, you'll appreciate getting into that habit now.  Otherwise, you'll go back to edit some code and realize exactly why I suggest that style means you hate yourself.

0 Kudos
Message 2 of 5
(4,085 Views)

Hi Rokot,

 

some time ago, I implemented an automated appointment creation in .NET. If you can read a little bit of .NET code you should be able to see the necessary classes and functions.

The following code checks all available calendars and creates a new one ("Opentime") if the calendar does not exist yet ("iCalendarIndex == -1"). After that the calendar searches all events in a certain timeframe and deletes them ("calendarService.Events.Delete").

 

 

var calendars = calendarService.CalendarList.List().Execute().Items;
int iCalendarIndex = -1;
int i = 0;
foreach (CalendarListEntry entry in calendars)
{
    if (entry.Summary.Contains("OpenTime", true))
    {
        iCalendarIndex = i;
        break;
    }
    i++;
}


if (iCalendarIndex == -1)
{
    Calendar calendar = new Calendar();
    calendar.Summary = "OpenTime";
    calendar.TimeZone = "Europe/Berlin";
    calendar = calendarService.Calendars.Insert(calendar).Execute();
    strCalendarID = calendar.Id;
    //throw new OpenTimeException("Google Calendar 'OpenTime' not found.");
}
else
{
    CalendarListEntry calendar = calendars[iCalendarIndex];
    strCalendarID = calendar.Id;
}

DateTime startTime13 = DateTime.Now;
EventsResource.ListRequest lr = calendarService.Events.List(strCalendarID);
lr.ShowDeleted = false;
lr.MaxResults = 2500;

//DateTime timeStart = startDate.Value.AddDays(-1);
DateTime timeEnd = endDate.Value;
DateTime timeTempStart;
DateTime timeTempEnd = startDate.Value.AddDays(-1);
do
{
    timeTempStart = timeTempEnd;
    timeTempEnd = timeTempEnd.AddDays(30);
    if (DateTime.Compare(timeTempEnd, timeEnd) > 0)
    {
        timeTempEnd = timeEnd;
    }

    lr.TimeMin = timeTempStart.AddDays(-1);
    lr.TimeMax = timeTempEnd;
    Events request = null;

    request = lr.Execute();

    List<Event> lEventsFound = (List<Event>)request.Items;

    foreach (Event tempEvent in lEventsFound)
    {
        calendarService.Events.Delete(strCalendarID, tempEvent.Id).ExecuteAsync();
    }

} while (DateTime.Compare(timeTempEnd, timeEnd) < 0);

Just a hint from my side: Please always attach a working code example as a VI or a VI snippet. Why should anyone try to reproduce the code from a screenshot if you already did the work?

 

Best regards,

Christoph

 

Staff Applications Engineer
National Instruments
Certified LabVIEW Developer (CLD), Certified LabVIEW Embedded Systems Developer (CLED)


Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved
0 Kudos
Message 3 of 5
(4,047 Views)

Hi Christoph. I did not find the calandarService in .NET-constructor node.

Here is a simple example with LabVIEW 2012 SP1 and activex. This reads only the "Kalender" (blue). How do I access the calendars "A&D Sitrac" (green) and "Test2" (red)?readOutlookCalendar7.JPG

ReadCalendarSimple Front Panel: readOutlookCalendar8.JPG

0 Kudos
Message 4 of 5
(4,022 Views)

Here is a solution to read out all calendar under "my calendar".

VI:readOutlookCalendar9.JPG

Outlook:readOutlookCalendar10.JPG

0 Kudos
Message 5 of 5
(3,990 Views)