Hot to create new calendar entry from C# code

Hello.I don’t know if this is the right forum, so if no, please direct we to the right one.

How can I create a new meeting or any other calendar entry for lotus notes using c#

code? I have the lotus dll’s, but I can’t find a way to create calendar object and to interact with lotus.

Thanx.

Eli.

Subject: RE: Hot to create new calendar entry from C# code.

can you explain how you are getting C# to talk to Lotus Notes to begin with?

Subject: RE: Hot to create new calendar entry from C# code.

Calendar entries are fairly complicated bits of machinery. You’ll want to look at several articles available in the Technical Library section (link is at left) using the search keyword “Calendar”. Of particular interest will be this article:

There’s also a Redbook that might be of interest:

http://www.redbooks.ibm.com/abstracts/sg245670.html

I don’t know what you mean about having the Lotus DLLs – you need a full install of either the Notes client or the Domino server on the machine unless you are using web access through agents/services on the host machine or talking to a server using DIIOP. (You can clean out many of the databases and templates to save space, but you need all of the executables, INIs and a few key databases to make the installation work.) You may have to manually register the Notes COM server (nlsxbe.dll) using regsvr32 if you are using an older release of Notes 6.x – there was a known installer problem that failed to register the DLL.

Unless you drop to unmanaged code (or broker through a third-party product like Proposion’s N2N ADO.NET provider), you’ll need to create a manged code wrapper DLL (it should happen when you add a reference to Lotus Domino Classes in your project). Then you can access the classes using the Lotus.Domino.ClassName syntax or head your code with a “using Lotus.Domino;” directive. Intellisense will give you most of the syntax as you go; you just need to translate the code in the articles from C/C++ and LotusScript to C#.

Note – there was a problem casting a NotesItem to a NotesRichText item last time I used C# with Notes, but that was a couple of years ago, so it may have been fixed since.

Subject: Hot to create new calendar entry from C# code.

Our customers have been using using Proposion N2N to create Calendar Entries for years now. Proposion N2N is an ADO.NET data driver that provides powerful, but fairly low-level, access to elements to Notes databases. Here is an example of an N2N command that creates an Appointment in a Notes database:

INSERT INTO Appointment SET AppointmentType=@AppointmentType, Principal=@Principal, Chair=@Chair, Subject=@Subject, Location=@Location, EndDate=@EndDate, EndTime=@EndTime, EndDateTime=@EndDateTime, StartDate=@StartDate, StartTime=@StartTime, StartDateTime=@StartDateTime, CalendarDateTime=@CalendarDateTime, ExcludeFromView=@ExcludeFromView, _ViewIcon=@ViewIcon, Body=RICHTEXT(@Body) RETURN UNID()"

As Stan explained in his post, figuring out what Notes items to set to achieve various types of C&S functionality can be rather daunting. The above example works for basic things, but does not handle Repeating Entries, Alarms, Meeting invitations, etc. To do this, you need to add additional items using the table in the link Stan provided.

But all this is about to change! In Proposion N2N 3.0 (currently in beta) we are adding a new set of wraper classes called “Collaboration Objects” which make all this a whole lot easier. This is a set of high-level objects called MailEntry, CalendarEntry, TaskEntry, ContactEntry and so on which make reading and writing standard Notes things a whole lot easier. You do not need to learn ADO.NET or the innards of how Notes C&S elements are stored.

For details, see Products A-Z or visit booth #323 at Lotusphere.

Here

Subject: RE: Hot to create new calendar entry from C# code.

I’ve been searching the whole Internet and didn’t find any article to do creating of new calendar entry in Lotus Notes from c#. Now I came across my test and try solution to make this work!

Domino.NotesDocument oNotesDocument = null;

        object oItemValue = null;



            if (_lotesNotesSession == null)

            {

                //Lotus Notes Object Creation

                _lotesNotesSession = new Domino.NotesSessionClass();

                //Initializing Lotus Notes Session

                _lotesNotesSession.Initialize(NotesPassword);

                //Creating Lotus Notes DataBase Object

                _localDatabase = _lotesNotesSession.GetDatabase(DominoServerName, @"mail\\xxx.nsf", false);



                if (!_localDatabase.IsOpen)

                {

                    _localDatabase.Open();

                }

                //Create an in memory document in the server database

                oNotesDocument = _localDatabase.CreateDocument();

                //Assign Field Values

                System.DateTime StartDate = new DateTime(2008,3,15);

                System.DateTime EndDate = new DateTime(2008, 3, 15);



                oNotesDocument.ReplaceItemValue("Form", "Appointment"); 

                oNotesDocument.ReplaceItemValue("AppointmentType", "3");

                oNotesDocument.ReplaceItemValue("Subject", "hello world");

                oNotesDocument.ReplaceItemValue("CALENDARDATETIME", StartDate);

                oNotesDocument.ReplaceItemValue("StartDateTime", StartDate);

                oNotesDocument.ReplaceItemValue("EndDateTime", EndDate);

                oNotesDocument.ReplaceItemValue("StartDate", StartDate);

                oNotesDocument.ReplaceItemValue("MeetingType", "1");



                oNotesDocument.ReplaceItemValue("Body", "gogogogogogo");

                oNotesDocument.ComputeWithForm(true, false); 

                oNotesDocument.Save(true, false, false);

                

            }//end if(_lotesNotesSession==null )