Solved

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

Posted on 2009-05-05
7
1,508 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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!
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

790 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