Link to home
Start Free TrialLog in
Avatar of fatihdi
fatihdi

asked on

Getting the selected documents into the document collection and traversing through them for an operation !!!

Hi,

I am trying to get the selected documents in a particular database through lotusscript .

I am getting an error in my code below !!! as object not set to a variable,

what am i doing wrong here? How can I solve this problem !!!

If there is no documents selected then a messagebox can pop up and warn the user, if documents selected on those selected documents I want to do some operation !!! How can I achieve it? what would be the way to do that? I am a newbie tnx alot for assistance !!!!!
Dim session As NotesSession
	Dim uiview As NotesUIView
	Dim dc As NotesDocumentCollection
	Dim doc As NotesDocument
	Dim ws As NotesUIWorkspace
	Dim person As NotesName
	Dim db As NotesDatabase
	
    Set db=session.Currentdatabase
    Set dc=db.Unprocesseddocuments
    
    'Set uiview = ws.Currentview
	'Set dc = uiview.Documents
		
	If dc.Count>0 Then

			Set doc = dc.GetFirstDocument
		
			While Not (doc Is Nothing)
			If doc.HasItem ("AdSoyad") Then
		        
		    	Set person=doc.AdSoyad(0)
		        MessageBox("send the mail mf")
		        
			End If
			Set doc = dc.GetNextDocument (doc)
		
			Wend
		
	Else
     		MessageBox("Lütfen Mesaj gönderilecek dokümani seçiniz !!!")
    End If

Open in new window

SOLUTION
Avatar of CRAK
CRAK
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fatihdi
fatihdi

ASKER

yes with your help i passed the first stage but now although no document is selected in the view it gets the first document to the document collection.

If I select documents that i correctly brings the documents i selected to the document collection so I need a way to get the selected documents in a view into the collection, what would be the right way to do it?
should I use view navigators etc...?

can you help me with the code ? thank you
Be aware that you most likely always have at least 1 doc selected: the one your "cursor" is on. Only exception that I know of is a category...

I don't think that I understand  the rest of your question: you have dc as a document collection (i.e. whatever docs you've selected). Do you want to add those document to a view, or do you want additional docs from the view added to the collection? For now my guess is that the collection is ok.

If it is of any use to you, you could also use something like...

dc=db.search({person="AdSoyad"}, nothing, 0)

...to build a collection.

If you want the selected documents in a view, I think you need to use the view actions. In such an action you can walk through the selected documents.

Otherwise, use the database.UnprocessedDocuments property.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial