Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Components
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB Components Issues specific to components in VB.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Components section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 6th, 2007, 05:16 AM
Friend of Wrox
 
Join Date: Oct 2006
Location: Northampton, Northants, United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default Outlook Calendar (in VB)

I am working toward writing a component that will synchronize my Outlook calendar with an Intranet. (Just getting started, I note)

With oFolder as an object pointing at my calendar folder in Outlook, I set and oItems collection to oFolder.Items and see that I have 124 entries. When I add in the IncludeRecurrences = True option, I get over 2 million entries, which I gather is because I have a series of recurring entries with no specified end date.

From what I read, I can alter the way in which I start my collection with something like the following, which should return the entries that are one week either side of today.

Set oItems = oFolder.Items.Restrict("[Start] > '" & (Date - 7) & "' AND [Start] < '" & (Date + 7) & "'")

However, when I check the oItems.Count, I see that I still have the 2 million ... which will obviously kill my application if I start looping through them to add to the database.

My question, then, is can I limit the collection to a date range of items that doesn't return a ridiculous amount of items?

Also, I noticed that I am not getting the popup thing which tells me the properties agains oItems, like I would have expected. I have got a few of the properties (start, subject, body, etc.,) from reading webpages, but wondered if someone might be able to point me in the direction of a more comprehensive list. With the synchronisation, I would like to see something like a GUID, who appoints a caldenar event, where it is, is there an alarm, etc.,

Any information would be greatly appreciated.

Regards,

Sean Anderson
__________________
Regards,

Sean Anderson
Reply With Quote
  #2 (permalink)  
Old September 28th, 2007, 04:01 AM
Registered User
 
Join Date: Sep 2007
Location: Sydney, NSW, Australia.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to knightcon
Default

I am trying to do something similar to you, synchronising my outlook calendar with an external 3rd party application. I was wondering if you could send me the code you are using to access all the appointments you have in your outlook calendar folder. Thanks.

Reply With Quote
  #3 (permalink)  
Old September 28th, 2007, 05:22 AM
Friend of Wrox
 
Join Date: Oct 2006
Location: Northampton, Northants, United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I did this in Javascript for a webpage, but I am sure that you could adapt it fairly easily into VB.


var oOutlook = new ActiveXObject("Outlook.Application");
var oNameSpace = oOutlook.GetNamespace("MAPI");
var oFolder = oNameSpace.GetDefaultFolder(9);
var oItems = oFolder.Items;
oItems.Sort ("Start");
oItems.IncludeRecurrences = false;

if (oItems.count == 0)
{
    alert("No events found in Calendar");
}
else
{
    for (var i = 1; i <= oItems.count; i++)
    {
        sData += "<TR>";

        sData += "<TD><INPUT name='exclude' type='checkbox' checked></TD>";

        sData += "<TD>" + busyStatus(oItems(i).BusyStatus) + "</TD>";

        if (oItems(i).AllDayEvent == true)
        {
            sData += "<TD>" + asDate(oItems(i).Start, "d/m/Y") + "</TD>";

            if (oItems(i).Duration == 1440)
            {
                sData += "<TD>1 Day</TD>";
            }
            else
            {
                sData += "<TD>" + (oItems(i).Duration/1440) + " Days</TD>";
            }
        }
        else
        {
            sData += "<TD>" + asDate(oItems(i).Start, "g:ia d/m/Y") + "</TD>";

            sData += "<TD>" + asDate(oItems(i).End, "g:ia d/m/Y") + "</TD>";
        }

        sData += "<TD>" + oItems(i).Subject + "</TD>";

        sData += "<TD style='display: none'>" + oItems(i).Organizer + "</TD>";

        sData += "<TD style='display: none'>" + oItems(i).Location + "</TD>";

        sData += "<TD style='display: none'>" + oItems(i).ReminderMinutesBeforeStart + "</TD>";

        sData += "<TD style='display: none'>" + oItems(i).EntryID + "</TD>";

        sData += "<TD style='display: none'>" + oItems(i).Body + "</TD>";

        if (oItems(i).AllDayEvent == true)
        {
            sData += "<TD style='display: none'>" + asDate(oItems(i).Start, "Y-m-d") + " 00:00:00</TD>";

            sData += "<TD style='display: none'>" + asDate(oItems(i).End, "Y-m-d") + " 00:00:00</TD>";
        }
        else
        {
            sData += "<TD style='display: none'>" + asDate(oItems(i).Start, "Y-m-d H:i") + ":00</TD>";

            sData += "<TD style='display: none'>" + asDate(oItems(i).End, "Y-m-d H:i") + ":00</TD>";
        }

        sData += "<TD style='display: none'>" + oItems(i).AllDayEvent + "</TD>";

        sData += "<TD style='display: none'>" + oItems(i).BusyStatus + "</TD>";

        sData += "<TD style='display: none'>" + asDate(oItems(i).CreationTime, "Y-m-d H:i") + ":00</TD>";

        sData += "<TD style='display: none'>" + oItems(i).Duration + "</TD>";

        sData += "</TR>";
    }


Regards,

Sean Anderson
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying Outlook Calendar in/thru Visual Basic mjai VB Components 1 August 20th, 2008 02:57 PM
Send MS Outlook Calendar Entry From ASP.NET wackoyacky ASP.NET 2.0 Basics 0 June 17th, 2007 10:02 AM
outlook calendar on web page Seeker55 Javascript How-To 0 March 28th, 2006 03:30 PM
Outlook calendar Selected Dates? avinashgavali Access 0 January 24th, 2005 01:42 AM
Using Outlook Calendar in Access Ray Pinnegar Access VBA 2 October 27th, 2003 04:44 AM



All times are GMT -4. The time now is 10:29 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.