can i see lotus notes hidden-document with reader field - lotus-notes

in this document, I use reader field to set who can read this document but as first my program is fault that wrong people set in this field and nobody can read this document. I write a code to see all document and that hidden document not show any item.
Set db=session.currentdatabase
Set dc=db.alldocuments
Dim i_count As Integer
For i_count = 1 To dc.Count
Set doccoll = dc.GetNthDocument(i_count)
Next
This is the result
enter image description here
How can I change reader field?

You can enable "Full Access Administration" on administrator client to see all documents in that server.

Related

Override Authors Field and allow access to some fields. Lotus Notes

I have a Notes Form containing many fields, tabbed tables, embedded views etc. Editing access is restricted to a small group via an Author field and the ACL to prevent changes to most of the data. However, I also need to allow editing of one or two fields to a wider user group. In essence the opposite to what one can do with Controlled Access Sections.
A move to XPages on this one is not a realistic option in this instance.
I know it is probably a non-starter but any help would be appreciated.
I would also follow the path that Richard describes in his respons, but without the delay. Write an agent, that Runs on behalf of a person / server who is allowed to edit everything in that database.
Then create a form that you open in a dialog that the user can fill and call the agent with runonserver.
Example code might look like this:
Dim ws as New NotesUIWorkspace
Dim ses as New NotesSession
Dim db as NotesDatabase
Dim ag as NotesAgent
Dim docTmp as NotesDocument
Dim strID as String
Dim varOK as Variant
Set db = ses.CurrentDatabase
Set ag = db.GetAgent( "RunMeOnServerOnBehalfOfSomeone" )
Set docTmp = new NotesDocument( db )
call docTmp.ReplaceItemValue( "ChangeUNID", docToEdit.UniversalID )
varOK = ws.Dialogbox( "YourSpecialDialogForm", True, True, False, False, False, False, "Enter values", docTmp, True, False, True )
If not varOK then exit sub
Call docTmp.Save( True, True, True ) '- runonserver cannot be called with a notesdocument that is unsaved
strId = docTmp.NoteID
Call ag.RunOnServer( strID )
In the agent you read the unid of the document to change and write the values from the docTmp to the target document.
Don't forget to cleanup the docTmp in the agent or in the code later.
of course you can use "reusable" parameter documents or one document per user. depending on how often this function ist needed.
But this seems to be a bit of a stretch (you need to keep track in your agent WHO requested a change, as all documents will be saved by the signer of the agent and not the user himself.
Probably a better solution would be to ADD the users to the author- field of the document and simply PROTECT everything else in the document with access controlled sections. You can completely hide those section headers and everything so that nobody can collapse them or if you don#t like the look of them.
There's no way to allow users without Author access the ability to directly edit part of the document. The only option I can think of would be to give them the ability to click a button that allows them to type their changes into a new temp document (using a form that only contains the fields that you want to expose), and set up an agent that runs when docs are created or modified that reads those documents copies the data from them back into the original document. There can be a bit of a delay before the changes are applied, though, so you'll have to warn users of that.

how to get list of Lotus notes mail file's owners name

I wonder if it is possible to generate a list of email users and their owners to a text file? I'm a beginner in Lotus script ... can there be any database in domino administrator where can i find such data? Screen
you can use the NotesDBDirectory class to loop through all dbs on server. If the database resides in subfolder mail, you can get the database using the notes database class. Normally the title of the database is the owners Name. But you can also get the calendar Profile document and read the field owner.
Another approach: take a look in names.nsf. you can Export data as CSV-file ...
Greetz, Markus
Code example:
Dim sess as new Notessession
Dim dbdir as NotesDBDirectory
Dim db as NotesDatabase
Dim Profile As NotesDocument
Set dbdir = New NotesDBDirectory("Servername")
Set db = dbdir.GetFirstDatabase(1247)
Do until db is nothing
'expecting the mail files are located in subfolder mail, check the path
If Ucase(Left(db.FilePath , 5)) = "MAIL\" Then
If not db.IsOpen Then
Call db.Open("","")
End If
Set Profile = db.GetProfileDocument("CalendarProfile")
Print Profile.Owner(0) ' prints out the owner name to Client Status bar or Server console
End If
Set db = dbdir.GetNextDatabase
Loop
The line
Print Profile.Owner(0) ' prints out the owner name to Client
must be modified to match your needs. You can use the Lotus script write Statement.
Take a look at IBM help Center:
https://www.ibm.com/support/knowledgecenter/en/SSVRGU_9.0.1/basic/H_NOTESDBDIRECTORY_CLASS.html
https://www.ibm.com/support/knowledgecenter/en/SSVRGU_9.0.1/basic/H_NOTESDATABASE_CLASS.html
https://www.ibm.com/support/knowledgecenter/de/SSVRGU_9.0.0/com.ibm.designer.domino.main.doc/LSAZ_WRITE_LB_STATEMENT.html
HTH, Markus
I'd iterate through the user documents in the server's names.nsf. Look at each user to see if they have an email database listed and, if so, output them to a text file.

Find dead doc link in Lotus Script

I have a database and also doc links, I am trying to access those doc link through web. I have found the method appendDocLink in the help. Looked through all the NotesRichTextItem, Document and NotesDocument properties and methods, but there's nothing to check dead link.
What I am trying to do is get all the doclinks in lotus script, and then check to see if they lead to an existing doc or if its a dead link. If yes then will send a mail to the admin about the dead link. All these things I want to happen using a schedule agent.
You need to traverse the NotesRichTextItem using NotesRichTextNavigator and find the elements of type NotesRichTextDocLink.
Dim rti As NotesRichTextItem
Dim rtnav As NotesRichTextNavigator
Dim rtlink As NotesRichTextDocLink
Set rti = doc.GetFirstItem("Body")
Set rtnav = rti.CreateNavigator
If Not rtnav.FindFirstElement(RTELEM_TYPE_DOCLINK) Then
Messagebox "No doclinks in Body item",, "No doclinks"
Exit Sub
End If
Do
Set rtlink = rtnav.GetElement
'Use rtlink.DocUNID to get document UNID and try to fetch the document
Loop While rtnav.FindNextElement
I am not sure whether creating new NotesDocument object from rtlink.DocUNID would result in error or NOTHING (in case document with that UNID is not present). You will have to check that yourself.
The above code snippet has been taken from here and modified for this answer.

Lotus Notes document to PDF

I need some help since I do not know where to start. Ideally, I would like to have a button that can convert my Lotus Notes document to a PDF file, then it will open up a new email then take the email address in that document to the "To" filed. At this point we use CutePDF writer to create the PDF file. I break down the process like the one below:
Print a document
User choose CutePDFwriter
Save the pdf file
Compose a new email with the email address that is on the Notes document placed on the 'To' field
Can anyone help me starting on this?
If you're happy to let the user select cutepdf as the printer, you should be able to get away with using #Commands in a button from the either the document or a view containing the documents (Check the notes designer help).
The only issue I can see is that the user will be able to change the path that cutepdf prints to, so you will have to make the user find the attachment again (but you will be able to automate the attachment dialog coming up).
Got my answer from Domino Designer help file. Use the code below to open up mail file
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim doc As NotesDocument
Dim item As NotesItem
Set doc = uidoc.Document
Set item = doc.GetFirstItem("QSContactEMail")
Set uidoc = workspace.ComposeDocument _
(mailserver$, mailfile$, "Memo")
Call uidoc.FieldAppendText("EnterSendTo", "Test")
For the printing I just call the print function and let the user choose CutePDF writer

Restricting access in Lotus Notes form

I would like to be able to let all users to create a form (QCR) but then no one should be able to edit the form except me and one other user. I have been tinkering around with the ACL and Authors and Readers field but have no luck.
Some more background:
1. This form is created by clicking a button from a separate database because some of the information in this QCR form are inherited from that database.
2. Users in the All group should be able to create this form
3. The users should be able to read all the documents in the QCR database but not edit them
4. I and one other users should be able to to read and edit all the documents
5. There are some codes in the QuerySave event to compare the value before and after a documents is being edited
What I have tried:
I created a group QCR_Access that has me and 1 other user as members. Then I created an Authors field, computed, with 'QCR_Access' as the Formula in the QCR Form. But no matter what kind of Access type that I gave to the All group (Depositor or Author), the application keeps giving me error whenever I tried to save a new document in the database with one of the user in the ALL group.
Below is the codes in the Querysave, might help give you some idea what I am doing.
Sub Querysave(Source As Notesuidocument, Continue As Variant)
' Compare the values in the form after it is saved with its original values when the document is not a new document.
Dim doc As NotesDocument
Set doc = Source.Document
Dim session As New NotesSession
Dim user As String
user = session.CommonUserName
If newDoc Then
doc.Log_Date = Cstr(Now())
doc.Log_User = user
doc.Log_Actions = "New document created."
Else
' Load fields value to the array
lastValues(0) = doc.QCR_Requestor(0)
lastValues(1) = doc.QCR_No(0)
...
lastValues(31) = doc.QCR_Tracking_Info(0)
' Compared each value in the array to see if there is any difference
Dim i As Integer
For i = 0 To 31
If lastValues(i) <> originalValues(i) Then
Call UpdateLogFields(doc,user,i)
End If
Next
End If
End Sub
Sub UpdateLogFields (doc As NotesDocument, user As String, i As Integer)
Dim logDate As NotesItem
Dim logUser As NotesItem
Dim logActions As NotesItem
Set logDate = doc.GetFirstItem("Log_Date")
Set logUser = doc.GetFirstItem("Log_User")
Set logActions = doc.GetFirstItem("Log_Actions")
' a space is needed otherwise the appended text is right next to the border
Call logDate.AppendToTextList(" " & Cstr(Now()))
Call logUser.AppendToTextList(" " & user)
Select Case i
Case 0: Call logActions.AppendToTextList(" Requestor is changed.")
Case 1: Call logActions.AppendToTextList(" QCR No is changed.")
...
Case 30: Call logActions.AppendToTextList(" Follow Up information is changed.")
Case 31: Call logActions.AppendToTextList(" Tracking information is changed.")
End Select
End Sub
I think you must definitely use authors field here, your description fits exactly for purpose... I would recommend you to use a role in this case thought, because that way you can assign it to someone else in emergencies or if you leave the company...
If you ACL is correctly setup, the you only need to add the value of the role like this in your authors field "[role]" I have attached a link with an image that shows how should your field look like if you inspect it.
http://bp1.blogger.com/T-j3ZLqfNQ/RsQXnWk20uI/AAAAAAAAAic/RBRJdD-wVs4/s1600-h/0.gif
Also, consider that if you write names to an authors field, the you need to use the fully qualified name of the people, otherwise it wouldn't work
If I'm following correctly, the members of the ALL group that are having trouble saving the QCR form, are the ones that are not in the QCR_Access group, correct? That would make sense given that the computed Authors field on the QCR form is set to only allow QCR_Access editing access.
The fix, then, would be to update that document's author field after the user has saved it. You could do that with some sort of agent that runs under a higher-privileged user account. You could also perhaps "hide" the document from the user who creates it until that agent runs, using a reader field.
It's been a while, but I think I opted for a lower-security solution when I faced this, essentially using form events to prevent editing. In that case you can prevent editing when the document is not new, and when the user is not in a certain group. You have to handle the QueryOpen and QueryModeChange events and put the logic there. NOTE: This isn't real security. Authors and Readers fields are the recommended way to handle security for a document.
Hope this helps!
You could make the formula for your authors field look like this:
#If(#IsNewDoc;"All";"QCR_Access");
There is one problem with this, however. If a regular user creates the document, saves it but does not close it, then tries to make changes and save it again, the second save will fail. To deal with that, you could give the users Depositor access and having your querySave code check the Database.CurrentAccessLevel property to see if the current user has Depositor access and prompt the user to ask "Are you sure you want to save? You will not be able to make additional changes."
Create two ACL groups in the Domino Directory (e.g.):
QCR_Editors
QCR_Creators
Put everyone into QCR_Creators, put just yourself and the other editor into QCR_Editors.
In the database access control list (ACL):
Give QCR_Editors "Editor" access (with "Delete documents," if needed.)
Give QCR_Creators "Author" access (with "Create documents" only.)
Note:
You do not need to use Authors or Readers fields on the form or documents.
Creators will have only one oportunity to save the document. Once it is saved, they will be locked out from further edits.
If you need additional functionality (like permitting several saves until done,) let me know.
-- Grant

Resources