Solved

Getting the list of views of a Lotus Notes database from C#

Posted on 2009-05-05
7
1,483 Views
Last Modified: 2013-12-18
Hello, I would like to populate the list of views of a lotus notes database from c# using the API. I have no problems connecting to Notes, accessing the database I want, but then I do not know how to get the list of existing views. Of course it is easy to access a specific view if you know its name (using _localdatabase.GetView(namesofview"). But I want the list of all views.
There seems to be a property in the API NotesDatabase.VIews, returning an object, but then I am lost. I would love to get some snippet in c#
0
Comment
Question by:pgirardier
7 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 24306448
There's a property NotesDatabase.Views, it's an array of NotesView objects. You can walk through that array, and each NotesView object has a Name property.
0
 

Author Comment

by:pgirardier
ID: 24306587
Thanks, would you have a code snippet?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 24306634
I have lots of C experience but no C# (yet). If you show me your current code, I might be able to adapt it.
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 22

Expert Comment

by:mbonaci
ID: 24306790
The class is named LNViewFolder.
It provides access to views or folders. Use LNDatabase::GetViewFolder to obtain a specific view or folder. The prototypes for this function are:

LNSTATUS GetViewFolder( const LNString &name, LNViewFolder *viewfolder )
LNSTATUS GetViewFolder( const NOTEID idnote, LNViewFolder *viewfolder )
LNSTATUS GetViewFolder( const UNID *unidnote, LNViewFolder *viewfolder )


You need this method:
LNDatabase::GetViews

Gets a pointer to an array of all shared views in the database.

Syntax
LNSTATUS GetViews( LNViewFolderArray *views )

Arguments
views
  Output, a pointer to an array of all shared views in the database.

Return value
  LNSTATUS
  Zero (LNNOERROR) if successful, non-zero otherwise.

Usage
  You cannot retrieve an array of personal views. To retrieve a personal view by name, use GetViewFolder.
0
 

Author Comment

by:pgirardier
ID: 24306860
I need to access the list of views from C# through the API, not from LS.
0
 
LVL 22

Accepted Solution

by:
Bill-Hanson earned 500 total points
ID: 24306943
Here's the function you need.

This example assumes you are using the COM library (Domino).
        private ArrayList GetViewNames(NotesDatabase db)
        {
            ArrayList retval = new ArrayList();
            Array views = (Array)db.Views;
            foreach(NotesView view in views){
                retval.Add(view.Name);
            }
            return retval;
        }

Open in new window

0
 

Author Closing Comment

by:pgirardier
ID: 31578093
Thanks a lot
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question