?
Solved

Create folder using the C API

Posted on 2003-10-23
10
Medium Priority
?
305 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
[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
  • 4
  • 3
10 Comments
 
LVL 14

Accepted Solution

by:
p_partha earned 252 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

770 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