Solved

Challeging Question

Posted on 2000-02-17
9
181 Views
Last Modified: 2013-12-18
Hi,
 I have a requirement where in I have to search documents in Inbox folder of a persons mail file and look for the text category= and based on the value say category=others the agent should put the document in others folder. Can anyone let me know how to do this. I appreciate if one can send a sample code for this

Regards
Rajen
0
Comment
Question by:Rajen
9 Comments
 
LVL 1

Expert Comment

by:rfharris
ID: 2533131
Is your search limited to the subject field, the body field, both or unknown?
0
 

Author Comment

by:Rajen
ID: 2533368
Adjusted points to 100
0
 

Author Comment

by:Rajen
ID: 2533375
HI,
Search is subjected to body field only

Regards
Rajen
0
 

Expert Comment

by:fayeb
ID: 2534321
If you look in you notes templates there is one called Search in here you can configure the database to search a specific database for a specific word
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 9

Accepted Solution

by:
Arunkumar earned 100 total points
ID: 2534452
Hi Rajen !!!

Here is the code.  You may put this in an agent.  And run it from actions menu.

======================================
Dim dc as notesdocumentcollection
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim ss as new notessession
Set db = ss.CurentDatabase
Dim view as notesview
Set view = db.GetView("($Inbox)")

formula = |FIELD Body Contains "category=others" |

Set dc = view.FTSearch(formula , 0 )

If dc.Count = 0 then
msgbox "No documents found for category = others"
Else
Print "Found " & dc.count & " documents for category=others"
Call dc.PutAllInFolder("Others")
End If
=======================================

Good Luck !!!

-Arun

PS:Dont schedule this agent since session class in included in this.
0
 

Author Comment

by:Rajen
ID: 2535800
Hi Arun,
How are u. Hope u remember me.You are from chennai and presently at New York na.Thanks for the code, but the thing is the category might be different ie not only others but also some other vlue say"marketting" etc. In such case how will u extract this value alone in order to put the document in that category

Rajen
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 2538036
Hi Rajen,

You got a terrific memory.  I was in NY till Dec.99 Then moved to MI(michigan)
Working for DaimlerChrysler (a car manufacturing co.)

Coming to your code. Try the following.

======================================
Dim dc as notesdocumentcollection
Dim db As NotesDatabase
Dim ss as new notessession
Dim doc as notesdocument
Set db = ss.CurrentDatabase
Dim view as notesview
Set view = db.GetView("($Inbox)")

txt = InputBox$("What category you want to search ?")

 formula = |FIELD Body Contains category= "| & txt & |"|

j = view.FTSearch(formula , 0 )

For i = 1 To j
  Set doc = view.GetNthDocument( i )
  Call doc.PutInFolder( txt )
Next

If j = 0 then
msgbox "No documents found for selected category"
Else
Print "Found " & j & " documents for specified category"
End If
=======================================
Good Luck !

-Arun

PS1:  This code will create new folders byitself if you dont have that category of search.
PS2: I did not have time to debug this code.  Feel free to contact me if you have any issues.

0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 2538039
Oops !  I guess you will have to include one more in declarations

Dim formula as String

-Arun
0
 

Author Comment

by:Rajen
ID: 2539995
Hi Arun,
Let me thankyou for the code. I will test your code also. I have also written a code for this. But here iam replacing newline with #. But if the category value is going to be in the last line it will not replace. Any suggestion. I will try ur code also. Thanks

Rajen


Sub Initialize
     Dim sess As New NotesSession    
     Dim db As notesDatabase
     Dim coll As NotesDocumentCollection
     Dim seldoc As NotesDocument
     Set db = sess.CurrentDatabase
     Set coll = db.UnprocessedDocuments
     For i = 1 To coll.count
          Set newdoc = New NotesDocument(db)          
          Set Seldoc = coll.GetnthDocument(i)
          Dim rtitem As NotesRichTextitem
          Set rtitem = seldoc.GetFirstitem("Body")
          tmp = rtitem.getFormattedText(True,0)
          Newdoc.Fld1=tmp
          Flag="Tmp"          
          Newdoc.Fld2 = Evaluate(| @ReplaceSubstring(Fld1;@NewLine;"#")|, newdoc)
         
DoProcess:                              
          Fromvalue = Evaluate(| @Middle(Fld2;"Category = ";"#") |,Newdoc)
          newfolder$=fromvalue(0)
          Call seldoc.PutInFolder( newfolder$ )
          If Flag(0) = "" Then
               
               Goto Exit_fn
          Else
               Goto DoProcess
          End If
         
Exit_fn:                  
     Next
     Msgbox fromvalue(0)
          'Msgbox Fromvalue(0)
End Sub
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

Suggested Solutions

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…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

23 Experts available now in Live!

Get 1:1 Help Now