Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2009-05-05
7
Medium Priority
?
1,743 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Loops Section Overview

972 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