Solved

Create folder using the C API

Posted on 2003-10-23
10
298 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
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 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

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.

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…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

733 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