Solved

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

Posted on 2009-05-05
7
1,435 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now