Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-05-05
7
Medium Priority
?
1,689 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

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

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

715 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