Solved

Create folder using the C API

Posted on 2003-10-23
10
294 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 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

20 Experts available now in Live!

Get 1:1 Help Now