How to get Authors & Readers values from a notes document?
Read our top 7 articles-
2. XPage Export To Excel using Server side JavaScript
3. XPage Export To Excel using simple LotusScript
4. XPage Export To Excel using famous Client JavaScript in easy steps
5. xPage Mail Send Using very simple Lotus Script trick
6. xPage Mail Send Using Server side JavaScript
7. Learn XPage Repeat Control in Easy steps
How to get Authors & Readers values from a notes document?
Many times we may have faced this issue to find out authors and readers values from a document. If there is lot of security in a document we may have faced this issue. We usually find the names by searching in database designer and then we look into the document properties for authors and readers.
But we have identified one simple way to find authors and reader values with their field names. So you can easily find security behind the authors and readers.
Please note:
To find authors & readers you don’t need to have manager access to database. You can manage this task with minimum reader access to database.
But be careful, you can only run this scrip. But to create this script you need to have minimum Author access with extra privileges to create ‘Lotus Script/Java agent' access to database Access control list.
Now, please look into code, we have written details description for each line to get more idea for code, so you can customize this for your use.
Sub Initialize
'Copyrights
(xpagedomino.com)
Dim session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim uiview As NotesUIView
Dim Collection As NotesDocumentCollection
Set db=session.CurrentDatabase
' current database
Set uiview=ws.CurrentView
' set uiview
Set collection=uiview.Documents
' Get colletion of notes
document from opened view
Set doc=Collection.GetFirstDocument()
' get selected document .
select document manually
Dim item As NotesItem ' set item class
Dim Readers1 As String, Readers As String, dReaders As String
Dim Authers1 As String, Authers As String,dAuthers As String
dReaders="n"
dAuthers="n"
If Not doc Is Nothing Then
' get readers values from
document
Forall
items In doc.Items ' get all its values
If items.IsReaders Then ' search all readers values filter readers-only check for readers
Readers=Readers+items.Name
+"="+Cstr(items.Values(0))+Chr(13) 'joint reader
values
dReaders="N"
End If
End Forall
Readers1="Readers:" +Cstr(doc.UniversalID)+Chr(13)+Readers 'Joint Author values
If dReaders="n" Then
Readers1
="No readers
are available in this document"
End If
' get author values from
document
Forall
items In doc.Items
If items.IsAuthors Then ' search all author values filter author-only check for readers
Authers=Authers+items.Name
+"="+Cstr(items.Values(0))+Chr(13)
dAuhtors="y"
End If
End Forall
Authers1=("Authors: "+Cstr(doc.UniversalID) +Chr(13)+Authers) ' Joint author values
If dAuhtors="n" Then
Authors1
="No authors
are available in this document"
End If
Msgbox
(Readers1 +Chr(13) +Authers1)
' Populate all readers &
authors from document with m message box
'Reseat values
Readers1=""
Authers1=""
Readers=""
Authers=""
End If
End Sub
We think
that you have gone through the above code, now find how to run this code.
From database
agent
GO to
database designer à agent section
Create agentà select
lotus script agent.
Past this
code à then select agent property” run on all selected document’
Check
for agent property à this should
be “action menu selection” to run from
UI view.
From
View Button
Create
button ‘Check document security’ add this code to button event. (This button is
only for database designer so manage accordingly)
Now
Open view from where you want to run this agent/script.
Click
button you will get message box with all authors and reader / similarly run the
agent from action \ check document security ‘you will get message box with authors
and reader.
Read our Best 7 articles-
2. XPage Export To Excel using Server side JavaScript
3. XPage Export To Excel using simple LotusScript
4. XPage Export To Excel using famous Client JavaScript in easy steps
5. xPage Mail Send Using very simple Lotus Script trick
6. xPage Mail Send Using Server side JavaScript
7. Learn XPage Repeat Control in Easy steps
Thanks for reading this article, hope you like it, if you have any difficulty please contact us on ‘admin@xpagedomino.com’
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a comment