Solved

Create folder using the C API

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

Author Comment

by:dglawton
ID: 9609023
Not only undocumented, but the compiler rejects it to.  How do you use it? :-(
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
A short film showing how OnPage and Connectwise integration works.

919 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now