Solved

Create folder using the C API

Posted on 2003-10-23
10
296 Views
Last Modified: 2013-12-18
Greetings.  I need to create a folder.  The methods available to LS classes do this, however they take the current default view as a column formula template and I need to choose another.  The C API function has the right parameters but I can't figure out how to get a proper handle to the template folder to pass with the function call.

Declare Function FolderCreate Lib "NNOTES" Alias "FolderCreate" _
( Byval hDataDB As Long, Byval hFolderDB As Long, Byval FormatNoteID As Long, Byval hFormatDB As Long _
, Byval szName As Lmbcs String, Byval wNameLen As Integer, Byval FolderType As Long, Byval dwFlags As Long _
, NoteID As Long) As Integer


I was able to get a good db handle b using the C API function

Declare Function W32NSFDbOpen Lib "nnotes" Alias "NSFDbOpen" ( _
Byval PathName As Lmbcs String, _
rethDb As Long _
) As Integer

but the long for the 'FormatNoteID' parameter I haven't a clue.  Any help will be greatly appreciated.  Don_Lawton@cqm.org
0
Comment
Question by:dglawton
  • 4
  • 3
10 Comments
 
LVL 14

Accepted Solution

by:
p_partha earned 63 total points
ID: 9607399
You don't require C api to create a folder.
PutInFolder/putAllInFolder method(s) of NotesDocument/NotesDocumentCollection classes create a new folder from default view/folder design
 Notesview/i.e also folder method NotesView.CreateFromTemplate("NewViewName") to create a folder from any existing one
You can retrieve an existing folder as NotesDocument using universalid of notesview class.

But if u want to learn c api,then u can use it
0
 

Author Comment

by:dglawton
ID: 9608616
My documentation (5.0.12) doesn't include a CreateFromTemplate method for NotesView.  Am I missing something?  Thanks
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9608893
It's undocumented :-)

Partha
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:dglawton
ID: 9609023
Not only undocumented, but the compiler rejects it to.  How do you use it? :-(
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9609064
i am sorry, i posted this answer from our document library reference. Haven't tried myself...


Partha
0
 
LVL 31

Assisted Solution

by:qwaletee
qwaletee earned 62 total points
ID: 9610992
Partha,

I'm pretty sure that it is wrong.

Try this:

Sub MakeFolderCopy ( sourceFolder as NotesView , newName as String) 'requires view design access
   Dim db as notesDatabase , folderNote as notesDocument
   Set db = sourceFolder.parent
   Set folderNote = db.getDocumentByUNID(sourceFolder.UniversalID)
   folderNote.copyToDatabase db
End Sub
0
 

Author Comment

by:dglawton
ID: 9614540
Looks good!  However...
I found two items in the folderNote that contained the name - $Title and $Name.  I changed the .values for both of them to newName, did the copy but the new folder had the old name.  Any ideas?  Thanks.

Don
0
 

Author Comment

by:dglawton
ID: 9614832
This worked...

Function GetSortFolder ( newName As String) As NotesView
      'db is Globally dimensioned, SORTFOLDER_TEMPLATE is a Global constant
      Dim  newFolderNote As NotesDocument
      Set newFolderNote = db.getDocumentByUNID(db.GetView(SORTFOLDER_TEMPLATE).UniversalID).copyToDatabase (db)
      newfolderNote.GetFirstItem("$Name").Values = newName
      NewfolderNote.GetFirstItem("$Title").Values = newName
      newFolderNote.Save True, True
      
      Set GetSortFolder = db.GetView(newName)
      
End Function

Thanks for all that help with this!

-Don
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

832 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