varvoura
asked on
Is it possible while you're in Views - All Document view to find out what folder/view a document is stored in - We're using R6
Hi there,
Here's another brain teaser!
Users requesting that they're able to see in which Folder a document is stored when they're logged to "All Documents" view. Probably if we have an additional column at the beginning of the view, which stores and displays the folder name.
I can't see any functions in lotus designer that will achieve this.
Also, another request is to be able to sort document by (subject, then date). Can we do this by sorting by subject as primary sort and date as secondary sort on subject?
I know that R7 already has subject sorting functionality enabled.
Any ideas??
Best Regards,
Vera
Here's another brain teaser!
Users requesting that they're able to see in which Folder a document is stored when they're logged to "All Documents" view. Probably if we have an additional column at the beginning of the view, which stores and displays the folder name.
I can't see any functions in lotus designer that will achieve this.
Also, another request is to be able to sort document by (subject, then date). Can we do this by sorting by subject as primary sort and date as secondary sort on subject?
I know that R7 already has subject sorting functionality enabled.
Any ideas??
Best Regards,
Vera
ASKER
cezarF,
1. I tried the notesdoc.folderreference with the db.folderreferenceenabled property, I'd say five months ago, but had no luck.
But now that you saying it may work, I'll give it another try and I'll let you know.
2. I set this up before i left work today, where I checked the sort of "Subject" as" both" and made the secondary sort on "Date" column Descending. I have noticed that you can't use "both" on the secondary sort column.
Thanks again.
Varvoura
1. I tried the notesdoc.folderreference with the db.folderreferenceenabled property, I'd say five months ago, but had no luck.
But now that you saying it may work, I'll give it another try and I'll let you know.
2. I set this up before i left work today, where I checked the sort of "Subject" as" both" and made the secondary sort on "Date" column Descending. I have noticed that you can't use "both" on the secondary sort column.
Thanks again.
Varvoura
varvoura,
1. I'll give it a try when I'm free.
2. Can't use both. Maybe IBM anticipated that the users might get confused with primary and secondary sort column if they give both.
:)
1. I'll give it a try when I'm free.
2. Can't use both. Maybe IBM anticipated that the users might get confused with primary and secondary sort column if they give both.
:)
I found this from LN Designer help for NotesDatabasee FolderReferencesEnabled property
Usage
The database must have the $FolderInfo and $FolderRefInfo hidden views to support folder references. These views can be copied from the mail template. This property does not return view references.
The database must be at the Release 5 file format level or greater.
Maintaining folder references impacts performance. <------
The database must be open to use this property.
For more information, see the FolderReferences property in the NotesDocument class.
you might want to think twice before doing it. :)
Usage
The database must have the $FolderInfo and $FolderRefInfo hidden views to support folder references. These views can be copied from the mail template. This property does not return view references.
The database must be at the Release 5 file format level or greater.
Maintaining folder references impacts performance. <------
The database must be open to use this property.
For more information, see the FolderReferences property in the NotesDocument class.
you might want to think twice before doing it. :)
ASKER
A specific user who is also a manager is desperate for FolderReference in her "All Documents" views in the mail database. I'd say that she'd rather have this feature than high db performance.
I'll also test from my side to see if I come to a solution with question 1.
Thanks,
Varvoura
I'll also test from my side to see if I come to a solution with question 1.
Thanks,
Varvoura
With respect to the FolderReference attempt, I'm terribly afraid it won't work. A document doesn't "know" that it has been put into a folder, so the field inside the document isn't updated automatically.
What might be feasible is an action-button "Gimme the folders on this document" in the view.
What might be feasible is an action-button "Gimme the folders on this document" in the view.
ASKER
Hi sjef,
yup, it doesn't work, I have tried using the action button with the following code from help, but all what i get is the reference to the folder, whereas I need the folder name displaying somewhere even if it has to print in the status bar.
As I said before, I went through all paths of FolderReference months ago, unsuccessfully.
Here's my modified code from help in an action button.
sub click
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim doc As notesdocument
Dim doccoll As NotesDocumentCollection
Set doccoll = db.AllDocuments
Set doc = doccoll.GetFirstDocument
If Not (db.FolderReferencesEnable d) Then
db.FolderReferencesEnabled = True
End If
While Not(doc Is Nothing)
i = 0
Forall FolderReference In doc.FolderReferences
i = i+1
Print doc.noteid, "", i, "", FolderReference
End Forall
Set doc = doccoll.GetNextDocument(do c)
Wend
end sub
Thanks,
Varvoura
yup, it doesn't work, I have tried using the action button with the following code from help, but all what i get is the reference to the folder, whereas I need the folder name displaying somewhere even if it has to print in the status bar.
As I said before, I went through all paths of FolderReference months ago, unsuccessfully.
Here's my modified code from help in an action button.
sub click
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim doc As notesdocument
Dim doccoll As NotesDocumentCollection
Set doccoll = db.AllDocuments
Set doc = doccoll.GetFirstDocument
If Not (db.FolderReferencesEnable
db.FolderReferencesEnabled
End If
While Not(doc Is Nothing)
i = 0
Forall FolderReference In doc.FolderReferences
i = i+1
Print doc.noteid, "", i, "", FolderReference
End Forall
Set doc = doccoll.GetNextDocument(do
Wend
end sub
Thanks,
Varvoura
ASKER
Tried also to replace the db.alldocuments with db.unprocesseddocuments and placed the code in an agent to run manually, same results!
I tried in my test database and it works. One addition though:
While Not(doc Is Nothing)
i = 0
Forall FolderReference In doc.FolderReferences
If FolderReference<>"" Then
i = i+1
Print doc.noteid, "", i, "", FolderReference
End If
End Forall
Set doc = doccoll.GetNextDocument(do c)
Wend
You copied both views from the mail database?
While Not(doc Is Nothing)
i = 0
Forall FolderReference In doc.FolderReferences
If FolderReference<>"" Then
i = i+1
Print doc.noteid, "", i, "", FolderReference
End If
End Forall
Set doc = doccoll.GetNextDocument(do
Wend
You copied both views from the mail database?
ASKER
OK, let's see
I have added your line of code and what happens when i preview it after the modifications is that, it runs like crazy trying to print all reference to status bar, where it is almost undistinguishable, then when I finish running, it places one number in the status bar(suposedly one reference) this number never changes even when you move to all different documents which resides in different folders.
a) not acceptable - Reference Numbers will mean nothing to no one.
b) Can we change the reference number to a folder name so that what it is displaying in the status bar is the folder name that the selected document resides in, I don't want the code to cycle through all the documents in all views before it give me the folder name, I want to be able to see it as soon as I select the document
c)Also, I have noticed that when this runs, it gives me the same number when it stops 3182 no matter which document in the view is selected. Surely, documents stored in the "Inbox" have different reference than those "folder1"....
d) What I am trying to do is instead of going through to view and folder in my inbox, these can be many, I can go to my "All Documents" view and search for documents that I want, then when I select one of these documents, I will be able to see the name of the folder that this document is filed in, other than "all Documents" view. So for example, if one of these documents is stored in "varvoura" folder as well as "All Documents", I would like when I select that document from "All documents" view to display on status bar "This document is filed in Folder: "Varvoura"
I know I waffled a lot up there, but I am trying to get my point across.
Your help will be much appreciated.
Regards,
Varvoura
I have added your line of code and what happens when i preview it after the modifications is that, it runs like crazy trying to print all reference to status bar, where it is almost undistinguishable, then when I finish running, it places one number in the status bar(suposedly one reference) this number never changes even when you move to all different documents which resides in different folders.
a) not acceptable - Reference Numbers will mean nothing to no one.
b) Can we change the reference number to a folder name so that what it is displaying in the status bar is the folder name that the selected document resides in, I don't want the code to cycle through all the documents in all views before it give me the folder name, I want to be able to see it as soon as I select the document
c)Also, I have noticed that when this runs, it gives me the same number when it stops 3182 no matter which document in the view is selected. Surely, documents stored in the "Inbox" have different reference than those "folder1"....
d) What I am trying to do is instead of going through to view and folder in my inbox, these can be many, I can go to my "All Documents" view and search for documents that I want, then when I select one of these documents, I will be able to see the name of the folder that this document is filed in, other than "all Documents" view. So for example, if one of these documents is stored in "varvoura" folder as well as "All Documents", I would like when I select that document from "All documents" view to display on status bar "This document is filed in Folder: "Varvoura"
I know I waffled a lot up there, but I am trying to get my point across.
Your help will be much appreciated.
Regards,
Varvoura
I used UnprocessedDocuments so it will give you the results for only a few documents. Or just one, which could easily be put into a MsgBox.
a) What do you mean? The reference number is yours I think. Only the FolderReference seems interesting to me
b) That's where UnprocessedDocuments comes in
c) ??
d) So put the code in an agent, that is available in all views.
I love waffles, especially the Belgian ones... :-P
a) What do you mean? The reference number is yours I think. Only the FolderReference seems interesting to me
b) That's where UnprocessedDocuments comes in
c) ??
d) So put the code in an agent, that is available in all views.
I love waffles, especially the Belgian ones... :-P
Varvoura,
A couple of things, if you enable folderreferences, only those documents placed in folders will show up, so you would have to removethem and then put them back in the folder. Also, the status bar message tends to get usurped by Notes activities. Like checking mail or selecting a document. With this in mind, I did an agent that you can put in the mail template and have visible to users that will show the folder reference.
-if the db is not enabled, and they have rights, they can enable the folderreference
-if they select documents in a folder and folderreference is enabled but the documents don't have the reference, it will ask the user if they want a reference created, if so, it will remove and put them back in the folder.
-if they're in a view, and click the agent, it will simply report the folder reference
- you can remark out the msgbox's and use the print statements if you like. How you configure the agent properties decides if it will process all selected or just the first selected document.
See if this works for you:
Sub Initialize
'Set agent to run on all selected documents if you want to cycle through all in a folder and enable them
'Or set agent to run none if you only intend to implement on views and only want one document processed.
'I have both message box and print statements - because the print statements tend to get wiped out
'when Notes checks for mail or adds to the status bar with it's own message
Dim Session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim uiview As NotesUIView, view As NotesView
Dim isFolder As Boolean,fname As String
Dim response As Integer
Set uiview =ws.currentview
Set view = uiview.view
If view.IsFolder Then isFolder = True
fname = view.name
Dim db As NotesDatabase
Set db = session.currentdatabase
Dim doc As NotesDocument
Dim coll As NotesDocumentCollection
Set coll = db.UnprocessedDocuments
On Error Goto Handle_Error
Dim FolderList As Variant, str_Folders As String
If coll.count <1 Then
Msgbox "You need to select a document",,"No Document Selected"
Exit Sub
End If
'Checking to see if FolderReferences is enabled
If Not (db.FolderReferencesEnable d) Then
'You might need to adjust here for permissions to enable...
response = Messagebox("Folder references are not enabled, did you want to enable them?", 36,"Enable Folder References?")
If response = 6 Then
db.FolderReferencesEnabled = True
Msgbox "Folder references have been enabled, you probably have to close and reopen Notes" + Chr(13) +_
"All new documents placed in folders will contain a folder reference. Current documents placed in folders have to be " + Chr(13) + _
"removed and then moved back into the folder." + _
"This agent will ask you if you want to do this on a per document basis.",,"Folder References Enabled"
Exit Sub
Else
'If folder references are not enabled, then this will exit
Msgbox "You need to have Folder References enabled for this action to work",,"Folder References not enabled"
Exit Sub
End If
End If
Dim docsummary As Variant, str_Msg As String
'cycle through the selected documents
'if the user is in a FOLDER, then this will as if they want to set the folder reference for the selected document(s)
'if the user is in a VIEW, then it will simply report the results.
Set doc = coll.getfirstdocument
While Not doc Is Nothing
docsummary = Evaluate({(@Name([CN];From ) + " [" + @Left(Subject;30) + "...]")}, doc)
FolderList = doc.FolderReferences
If Len(FolderList(0))>0 Then
x = Ubound(folderList)
Select Case Ubound(FolderList)+1
Case Is >1
str_Folders = Join(FolderList, ", ")
str_Msg = docSummary(0) + Chr(13) + "Document is located in: " + str_Folders + " folders"
Case 1
str_Folders = FolderList(0)
str_Msg = docSummary(0) + Chr(13) + "Document is located in: " + str_Folders + " folder"
Case Else
'Shouldn't have a value
End Select
Msgbox str_Msg,,"Folder Reference"
Print docSummary(0) + ": Located in: " + str_Folders + " folder"
Else
'If the user is checking documents in folders, then this will remove and put them back in the folder
If isFolder Then
response = Msgbox (docSummary(0) + Chr(13) + "Did you want to create a reference to this folder?",36,"Create a Reference?")
If response = 6 Then
Call doc.RemoveFromFolder(fname )
ws. viewrefresh
Call doc.PutInFolder(fname)
Msgbox "The reference to " + fname + " has been created",,"Folder Reference Created"
End If
Else
str_Msg = docSummary(0) + Chr(13) + "Doesn't have a folder reference"
Msgbox str_Msg,,"No Folder Reference"
Print docSummary(0) + ": No folder reference"
End If
End If
Set doc = coll.GetNextDocument(doc)
Wend
Exit Sub
Handle_Error:
'Just in case the user doesn't have enough rights or some unforeseen error occurs
Err =0
Msgbox "Sorry, there was a problem processing this request: " + Chr(13) + "Error: " + Error$ + "-" + Str(Err),,"Unable to Continue"
Exit Sub
End Sub
A couple of things, if you enable folderreferences, only those documents placed in folders will show up, so you would have to removethem and then put them back in the folder. Also, the status bar message tends to get usurped by Notes activities. Like checking mail or selecting a document. With this in mind, I did an agent that you can put in the mail template and have visible to users that will show the folder reference.
-if the db is not enabled, and they have rights, they can enable the folderreference
-if they select documents in a folder and folderreference is enabled but the documents don't have the reference, it will ask the user if they want a reference created, if so, it will remove and put them back in the folder.
-if they're in a view, and click the agent, it will simply report the folder reference
- you can remark out the msgbox's and use the print statements if you like. How you configure the agent properties decides if it will process all selected or just the first selected document.
See if this works for you:
Sub Initialize
'Set agent to run on all selected documents if you want to cycle through all in a folder and enable them
'Or set agent to run none if you only intend to implement on views and only want one document processed.
'I have both message box and print statements - because the print statements tend to get wiped out
'when Notes checks for mail or adds to the status bar with it's own message
Dim Session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim uiview As NotesUIView, view As NotesView
Dim isFolder As Boolean,fname As String
Dim response As Integer
Set uiview =ws.currentview
Set view = uiview.view
If view.IsFolder Then isFolder = True
fname = view.name
Dim db As NotesDatabase
Set db = session.currentdatabase
Dim doc As NotesDocument
Dim coll As NotesDocumentCollection
Set coll = db.UnprocessedDocuments
On Error Goto Handle_Error
Dim FolderList As Variant, str_Folders As String
If coll.count <1 Then
Msgbox "You need to select a document",,"No Document Selected"
Exit Sub
End If
'Checking to see if FolderReferences is enabled
If Not (db.FolderReferencesEnable
'You might need to adjust here for permissions to enable...
response = Messagebox("Folder references are not enabled, did you want to enable them?", 36,"Enable Folder References?")
If response = 6 Then
db.FolderReferencesEnabled
Msgbox "Folder references have been enabled, you probably have to close and reopen Notes" + Chr(13) +_
"All new documents placed in folders will contain a folder reference. Current documents placed in folders have to be " + Chr(13) + _
"removed and then moved back into the folder." + _
"This agent will ask you if you want to do this on a per document basis.",,"Folder References Enabled"
Exit Sub
Else
'If folder references are not enabled, then this will exit
Msgbox "You need to have Folder References enabled for this action to work",,"Folder References not enabled"
Exit Sub
End If
End If
Dim docsummary As Variant, str_Msg As String
'cycle through the selected documents
'if the user is in a FOLDER, then this will as if they want to set the folder reference for the selected document(s)
'if the user is in a VIEW, then it will simply report the results.
Set doc = coll.getfirstdocument
While Not doc Is Nothing
docsummary = Evaluate({(@Name([CN];From
FolderList = doc.FolderReferences
If Len(FolderList(0))>0 Then
x = Ubound(folderList)
Select Case Ubound(FolderList)+1
Case Is >1
str_Folders = Join(FolderList, ", ")
str_Msg = docSummary(0) + Chr(13) + "Document is located in: " + str_Folders + " folders"
Case 1
str_Folders = FolderList(0)
str_Msg = docSummary(0) + Chr(13) + "Document is located in: " + str_Folders + " folder"
Case Else
'Shouldn't have a value
End Select
Msgbox str_Msg,,"Folder Reference"
Print docSummary(0) + ": Located in: " + str_Folders + " folder"
Else
'If the user is checking documents in folders, then this will remove and put them back in the folder
If isFolder Then
response = Msgbox (docSummary(0) + Chr(13) + "Did you want to create a reference to this folder?",36,"Create a Reference?")
If response = 6 Then
Call doc.RemoveFromFolder(fname
ws. viewrefresh
Call doc.PutInFolder(fname)
Msgbox "The reference to " + fname + " has been created",,"Folder Reference Created"
End If
Else
str_Msg = docSummary(0) + Chr(13) + "Doesn't have a folder reference"
Msgbox str_Msg,,"No Folder Reference"
Print docSummary(0) + ": No folder reference"
End If
End If
Set doc = coll.GetNextDocument(doc)
Wend
Exit Sub
Handle_Error:
'Just in case the user doesn't have enough rights or some unforeseen error occurs
Err =0
Msgbox "Sorry, there was a problem processing this request: " + Chr(13) + "Error: " + Error$ + "-" + Str(Err),,"Unable to Continue"
Exit Sub
End Sub
Now I know why I'm constantly in between jobs... ;)
sjef_bosman,
The key here is that if the folderreference is turned on, it only works on NEW documents placed in a folder after the property is enabled. So, you have to remove and put back into folder for the reference to take hold. You kinda have to look in the hidden folders to see that there are no entries...:)
The key here is that if the folderreference is turned on, it only works on NEW documents placed in a folder after the property is enabled. So, you have to remove and put back into folder for the reference to take hold. You kinda have to look in the hidden folders to see that there are no entries...:)
ASKER
Hi sjef,
Are you telling me that I'll have to remove each document from the folder and put it back once the folder reference is enabled on the database for his to take effect? Almost impossible. Would a RefreshAllDocs in each folder refresh all documents, hence, reference is distinguished?
Also, I have taken a copy of you code and place it in an agent "manual/selected documents" when I run the agent I get the messagox "my name, sender name "testing(subject of email), does not have folder reference.
that's fine but now the folderreference is enabled, I go back in and create a draft document, then test the agent again, the same message appears. isn't suppose to work fine on new documents when the Folder Reference is enabled?
What am I doing wrong?
Can you enable Folder Reference through database properties without running the LS script?
Thanks,
Varvoura
Are you telling me that I'll have to remove each document from the folder and put it back once the folder reference is enabled on the database for his to take effect? Almost impossible. Would a RefreshAllDocs in each folder refresh all documents, hence, reference is distinguished?
Also, I have taken a copy of you code and place it in an agent "manual/selected documents" when I run the agent I get the messagox "my name, sender name "testing(subject of email), does not have folder reference.
that's fine but now the folderreference is enabled, I go back in and create a draft document, then test the agent again, the same message appears. isn't suppose to work fine on new documents when the Folder Reference is enabled?
What am I doing wrong?
Can you enable Folder Reference through database properties without running the LS script?
Thanks,
Varvoura
ASKER
My bad, SORRY!!
I tested again and I think that it worked!!
Let me run again another mailbox, then I'll let you know the results tomorrow.
Can we be a bit more sophisticated and maybe include this code in an action button, maybe a right mouse click or something?
We'll advise
Thanks.
varvoura
I tested again and I think that it worked!!
Let me run again another mailbox, then I'll let you know the results tomorrow.
Can we be a bit more sophisticated and maybe include this code in an action button, maybe a right mouse click or something?
We'll advise
Thanks.
varvoura
Vera,
Don't thank me, it's not my code! About "sophisticated": I think you're asking too much, after the free ride Marilyn gave you. You can always ask, of course... ;)
Don't thank me, it's not my code! About "sophisticated": I think you're asking too much, after the free ride Marilyn gave you. You can always ask, of course... ;)
ASKER
MARYLIN, THANK YOU!!!!!!!!!!!!!!!!!!!
Forgive my ignorance, I was too concerned to get this to work and overlooked who really posted the code solution.
Regards,
Varvoura
Forgive my ignorance, I was too concerned to get this to work and overlooked who really posted the code solution.
Regards,
Varvoura
ASKER
Marylin, Don't worry too much about mouse right click.......
sjef, if you don't ask, you don't receive, even the bible says that!!!
One last question, I don't really understand, haven't read much about the points,
how are these distributed, who distribute them(admin or member logging the question)?
thanks,
vera
sjef, if you don't ask, you don't receive, even the bible says that!!!
One last question, I don't really understand, haven't read much about the points,
how are these distributed, who distribute them(admin or member logging the question)?
thanks,
vera
Varvoura,
If you run the agent from a view, it will simply display the folder reference, if it exists (since it doesn't know the folder the document is in). If you run it from a folder, it will ask if you want to create a folder reference and then create the reference. After folderreference is enabled it will only work on NEW documents placed in the folders - smile, I didn't make the rule.
You could:
Run a global agent on every mail file that enables db.folderreference, and then steps through and removes and replaces the folder entries in order to establish the status quo. Similar to the update folder action that users press in order to update their folders from a previous version. I'm thinking the users would have to run it themselves. (that would be another question, I think if you needed assistance with the global agent)
Create a second button that is displayed in the ALLDocuments view that calls the agent. The agent makes it available to every folder or view. Just remember that you are changing the mail template, so you should create a new mail template, else you may find you will have duplicate views where you added the button. (Uh, don't put new button in inbox folder, since it won't update all the folders spawned from the inbox before you made the change.)
I believe you distribute the points when you award them..:)
If you run the agent from a view, it will simply display the folder reference, if it exists (since it doesn't know the folder the document is in). If you run it from a folder, it will ask if you want to create a folder reference and then create the reference. After folderreference is enabled it will only work on NEW documents placed in the folders - smile, I didn't make the rule.
You could:
Run a global agent on every mail file that enables db.folderreference, and then steps through and removes and replaces the folder entries in order to establish the status quo. Similar to the update folder action that users press in order to update their folders from a previous version. I'm thinking the users would have to run it themselves. (that would be another question, I think if you needed assistance with the global agent)
Create a second button that is displayed in the ALLDocuments view that calls the agent. The agent makes it available to every folder or view. Just remember that you are changing the mail template, so you should create a new mail template, else you may find you will have duplicate views where you added the button. (Uh, don't put new button in inbox folder, since it won't update all the folders spawned from the inbox before you made the change.)
I believe you distribute the points when you award them..:)
Also, in my tests, I had to close and reopen Notes after folderreference was enabled..
I basically opened a folder, selected a bunch of documents and then ran the agent. It enabled the property and created the references. The next time I opened Notes and went to the view, ran the agent and it displayed the reference on those that I created.
I basically opened a folder, selected a bunch of documents and then ran the agent. It enabled the property and created the references. The next time I opened Notes and went to the view, ran the agent and it displayed the reference on those that I created.
Also, with regard to showing the folder name in the view.. I don't think that's possible. the $FolderRef field that Cezar speaks of is created on the document, but it holds the unique id of the folder design element. (Which is contained in the $FolderInfo view). It would take a dblookup to associate the foldername to the unid, and you can't do that in a column formula.
In answer to your initial question to have the folderreference displayed in a view - not possible, I think. The $FolderRef field is a UNID pointing to the folder design element. (If you hard code the folder name on the doucment, and you subsequently change the folder name, the $FolderRef value will be correct, but your hard coded entry of the name will not) I don't know of a way to dynamically lookup the $FolderRef in a column formula.
In answer to your question >>Would a RefreshAllDocs in each folder refresh all documents<< no, unfortunately. The Upgrade Folder Design action does do it IF the folder design is really replaced (it creates a new folder inheriting the design you specify, moves the documents to the new folder design and deletes the old folder)
In answer to your question >>Would a RefreshAllDocs in each folder refresh all documents<< no, unfortunately. The Upgrade Folder Design action does do it IF the folder design is really replaced (it creates a new folder inheriting the design you specify, moves the documents to the new folder design and deletes the old folder)
ASKER
Hi Marilyn,
Since you've been the expert here, may I ask one more question?
I know that this code will return "[Username, subject....], doesn't have a folder reference if the document is filed in a view as opposed to a folder.
Is there anyway that the view name can also be processed? I can't see any documentation in help to viewreference?
Thanks,
Varvoura
Since you've been the expert here, may I ask one more question?
I know that this code will return "[Username, subject....], doesn't have a folder reference if the document is filed in a view as opposed to a folder.
Is there anyway that the view name can also be processed? I can't see any documentation in help to viewreference?
Thanks,
Varvoura
Hi varvoura,
No, there is no view reference. Views are a different animal and the documents that are shown in a view are there because of a selection formula or criteria (i.e. show me all sent emails, all calendar entries, all emails having attachments, etc. Documents can be in all views or no views (a profile doesn't appear in a view). A folder has no selection criteria, you have to put or remove documents into folders. In this sense, you put seemingly unrelated documents into a folder called "Acme" because those various emails, meetings, appts, all relate to Acme.
You could create a private view to show all documents having the word "Orange" in the subject. And all documents that meet that search criteria would appear in the folder without any further assistance from the user. The same documents would still appear in the all documents view, and those sent would appear in the sent view.
Does this make sense?
No, there is no view reference. Views are a different animal and the documents that are shown in a view are there because of a selection formula or criteria (i.e. show me all sent emails, all calendar entries, all emails having attachments, etc. Documents can be in all views or no views (a profile doesn't appear in a view). A folder has no selection criteria, you have to put or remove documents into folders. In this sense, you put seemingly unrelated documents into a folder called "Acme" because those various emails, meetings, appts, all relate to Acme.
You could create a private view to show all documents having the word "Orange" in the subject. And all documents that meet that search criteria would appear in the folder without any further assistance from the user. The same documents would still appear in the all documents view, and those sent would appear in the sent view.
Does this make sense?
Marilyn, here's a teaser...
forall views
open the view
get the select statement
evaluate it using the current document
if positive then
document appears in the view!
fi
llarof
Can be optimized when many documents have to be checked, by first creating a cache for the select statements and view names, e.g. in a List of Strings. Have fun!
forall views
open the view
get the select statement
evaluate it using the current document
if positive then
document appears in the view!
fi
llarof
Can be optimized when many documents have to be checked, by first creating a cache for the select statements and view names, e.g. in a List of Strings. Have fun!
ASKER
exactly what I need, I was trying to enable folder reference on each folder in a users mailbox, this user had 2000 documents in inbox alone. Other folders had similar document count.
I started enabling folder reference on inbox and after the 50th document, I go sick of it.
I know a scheduled agent can do this in the background, but how about if I want to do this on the fly for a user without having to go through each document individually?
thanks
varvoura
I started enabling folder reference on inbox and after the 50th document, I go sick of it.
I know a scheduled agent can do this in the background, but how about if I want to do this on the fly for a user without having to go through each document individually?
thanks
varvoura
ASKER
Marilyn,
I tried sjef suggestion above by first capturing the results of the coll.count so that I can get the collection count, then tried to run a forall loop to enable the folder reference so that I won't have to enable each document individually when I have 100's of documents selected.
what I did,
dim results as variant
results = coll.count
if results > 1 then
forall documents in results
If Not (db.FolderReferencesEnable d) Then
db.FolderReferencesEnabled = True
end if
end forall
...and the rest of your code as is after that.
It doesn't seem to work for me, for are my other options?
Thanks,
Varvoura
I tried sjef suggestion above by first capturing the results of the coll.count so that I can get the collection count, then tried to run a forall loop to enable the folder reference so that I won't have to enable each document individually when I have 100's of documents selected.
what I did,
dim results as variant
results = coll.count
if results > 1 then
forall documents in results
If Not (db.FolderReferencesEnable
db.FolderReferencesEnabled
end if
end forall
...and the rest of your code as is after that.
It doesn't seem to work for me, for are my other options?
Thanks,
Varvoura
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The above if pasted in an agent will cycle through and instantiate all stuff in folders - take them out and put them back. It's just an extraction of the original code. :)
sjef.. intriguing and clever! Not sure I would ever do this, but never say never, they say... !
sjef.. intriguing and clever! Not sure I would ever do this, but never say never, they say... !
ASKER
Marilyn,
Just a small change to the above agent
set viewlist = db.views
changed to viewlist = db.views ---Because it was creating a type mistmatch error
I've also blocked the section where system folders are blocked. I wanted every folders in mail db processed.
Marilyn, Thank you for your extraordinary effort and help, you were AMAZING even though at times I was asking a bit much!
Sjef, thanks for your intuitive ideas and brain teaser, great helpers too
cezarF, thanks for your input and ideas too, true eye opener.
the majority of this points will go to Marilyn, 150, 50 for each sjef and cezarF.
Pls guys tell me if I haven't been fair.
Best Regards,
Varvoura
Just a small change to the above agent
set viewlist = db.views
changed to viewlist = db.views ---Because it was creating a type mistmatch error
I've also blocked the section where system folders are blocked. I wanted every folders in mail db processed.
Marilyn, Thank you for your extraordinary effort and help, you were AMAZING even though at times I was asking a bit much!
Sjef, thanks for your intuitive ideas and brain teaser, great helpers too
cezarF, thanks for your input and ideas too, true eye opener.
the majority of this points will go to Marilyn, 150, 50 for each sjef and cezarF.
Pls guys tell me if I haven't been fair.
Best Regards,
Varvoura
Glad you solve it.
And yes, the idea is very fair, but instead you gave the loot to Marilyn. Which is fine by me. To give several people points on the same question, you have to click "Split". A new screen in the browser lets you split the points over many answers. Next time better :)
And yes, the idea is very fair, but instead you gave the loot to Marilyn. Which is fine by me. To give several people points on the same question, you have to click "Split". A new screen in the browser lets you split the points over many answers. Next time better :)
varvoura, thanks for the catch on my typo! Glad it worked for you. sjef.. did you want me to give you and czar points? I can create additional questions for you.
ASKER
Marilyn,
I have one question which i have spend all morning debating with my boss. It isn't LS scripting but it is rather a technical question.
FolderReference.
I know that folderreference is picked up from $folderinfo and $folderrefinfo views and are placed on the document in the $FolderRefID and $FolderInfo fields on the document that when the folderreference is enabled on the database.
Now why isn't the FolderReference enabled on every new created database by default? Is there a way that this can be done automatically when a new user starts up and his mailbox is newly created?
Basically what I am trying to do is from now have every user that I'll be creating new account for with folderreference enabled on his/her mailbox, this way, I'll slowly deal with all the other preexisting users that we have by enabling folderreference on their mailboxes. Does this make sense?
Also, what's wrong with lotus? why didn't they create a database property, same like every other properties that they have which enable or disable folderreference with a check mark(same as soft deletion), this way we can enable this function on everyone's mailbox very easily.
Or this is there a function available which I am missing?
Can we maybe modify the memo form and include those two fields ($FolderRefID and $FolderInfo) on it and then try to refresh all documents in the database, by doing this, those two fields will have the document reference instead of blank?
Any input and further clarification on this will be much appreciated.
sjef, I'll keep an eye on the split option next time. Still learning !!
Regards,
Varvoura
I have one question which i have spend all morning debating with my boss. It isn't LS scripting but it is rather a technical question.
FolderReference.
I know that folderreference is picked up from $folderinfo and $folderrefinfo views and are placed on the document in the $FolderRefID and $FolderInfo fields on the document that when the folderreference is enabled on the database.
Now why isn't the FolderReference enabled on every new created database by default? Is there a way that this can be done automatically when a new user starts up and his mailbox is newly created?
Basically what I am trying to do is from now have every user that I'll be creating new account for with folderreference enabled on his/her mailbox, this way, I'll slowly deal with all the other preexisting users that we have by enabling folderreference on their mailboxes. Does this make sense?
Also, what's wrong with lotus? why didn't they create a database property, same like every other properties that they have which enable or disable folderreference with a check mark(same as soft deletion), this way we can enable this function on everyone's mailbox very easily.
Or this is there a function available which I am missing?
Can we maybe modify the memo form and include those two fields ($FolderRefID and $FolderInfo) on it and then try to refresh all documents in the database, by doing this, those two fields will have the document reference instead of blank?
Any input and further clarification on this will be much appreciated.
sjef, I'll keep an eye on the split option next time. Still learning !!
Regards,
Varvoura
Lotus didn't do this by default because I assume they thought it was too resource intensive. The views and fields are created when folderreference is enabled, and I imagine you could add the:
If Not (db.FolderReferencesEnable d) Then
db.FolderReferencesEnabled = True
End If
to the Database PostOpen event in a mail template.
BTW, I wouldn't have added the system folders to the agent.. bad idea. How do you remove something from the inbox and then put it back in again? Why would you? Same for Alarms, Group Calendars, JunkMail.. please don't mess with these on a global level, else you might find your mail files corrupted.
If Not (db.FolderReferencesEnable
db.FolderReferencesEnabled
End If
to the Database PostOpen event in a mail template.
BTW, I wouldn't have added the system folders to the agent.. bad idea. How do you remove something from the inbox and then put it back in again? Why would you? Same for Alarms, Group Calendars, JunkMail.. please don't mess with these on a global level, else you might find your mail files corrupted.
ASKER
I am going to try placing the db.folderreference in the template design to see if it helps.
2) Yup, got stuck with that problem, what a mess that was, just as well I've taken a copy of the mailbox before running the agent.
The funny thing is that I ran the agent on more than 4 databases and I had no problems, once I ran it on the server on one of the mailboxes, it deleted and never bought back any documents to the inbox. Nice one, of course, this mailbox was my manager's. Just as well I had a copy to restore back to server.
So in summary, I won't try this ever again, I am even worried to try running that with system folders now.
Marilyn, you input is always priceless!!
PS. I am trying to mastermy lotusscript skills and that's why I ask too many questions all the time. I know there's a lot of books and resources to learn from. I read so many of those did a 3 level courses in LS. I'll have to say though that the exposure and experience that I am gaining working with (the Experts) is invaluable, probably better than any other LS book that I have ever read.
Thanks,
Varvoura
2) Yup, got stuck with that problem, what a mess that was, just as well I've taken a copy of the mailbox before running the agent.
The funny thing is that I ran the agent on more than 4 databases and I had no problems, once I ran it on the server on one of the mailboxes, it deleted and never bought back any documents to the inbox. Nice one, of course, this mailbox was my manager's. Just as well I had a copy to restore back to server.
So in summary, I won't try this ever again, I am even worried to try running that with system folders now.
Marilyn, you input is always priceless!!
PS. I am trying to mastermy lotusscript skills and that's why I ask too many questions all the time. I know there's a lot of books and resources to learn from. I read so many of those did a 3 level courses in LS. I'll have to say though that the exposure and experience that I am gaining working with (the Experts) is invaluable, probably better than any other LS book that I have ever read.
Thanks,
Varvoura
Is why I did the agent manually to begin with.. :) It should not run on $ or System folders...
I hear you about Lotusscript skills.. unless you work in a really big team, it's hard to know what the expected stuff should look like or the logic behind it. I see you've mastered Rule number one: never assume you know the outcome -- even if you've written the same thing 900 times. So, test and backup (good for you)
I hear you about Lotusscript skills.. unless you work in a really big team, it's hard to know what the expected stuff should look like or the logic behind it. I see you've mastered Rule number one: never assume you know the outcome -- even if you've written the same thing 900 times. So, test and backup (good for you)
ASKER
Marilyn,
1) I don't feel too bad now. I have designed over 20 small apps but I still need that the path to learning is quite long.
I am just glad that I am normal especially that I am the only notes developer/administrator in my company.
In regards to folderreference, could you pls take a look at the code below when you get a chance and advise:
In the postopen event of the database, I have written the following:
source(uidatabase already declared)
'I wrote
dim db as new notesdatabase
set db = source.database
If Not (db.FolderReferencesEnable d) Then
db.FolderReferencesEnabled = True
End If
I won't save, and the first line 'If Not (db.FolderReferencesEnable d) Then is throwing the error and the debugger is not showing or telling me what's causing it.
.
Regards,
Varvoura
1) I don't feel too bad now. I have designed over 20 small apps but I still need that the path to learning is quite long.
I am just glad that I am normal especially that I am the only notes developer/administrator in my company.
In regards to folderreference, could you pls take a look at the code below when you get a chance and advise:
In the postopen event of the database, I have written the following:
source(uidatabase already declared)
'I wrote
dim db as new notesdatabase
set db = source.database
If Not (db.FolderReferencesEnable
db.FolderReferencesEnabled
End If
I won't save, and the first line 'If Not (db.FolderReferencesEnable
.
Regards,
Varvoura
Dim session As NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
If db.IsOpen Then
If Not (db.FolderReferencesEnable d) Then
db.FolderReferencesEnabled = True
End If
End If
Dim db As NotesDatabase
Set db = session.CurrentDatabase
If db.IsOpen Then
If Not (db.FolderReferencesEnable
db.FolderReferencesEnabled
End If
End If
ASKER
Hi Marilyn,
I changed the mail template, then created a new mailbox based on that mail template, when I tested by created a draft document, nothing happens, no $FolderRef fields were added to the document.
So I guess it really doesn't work, although I wish it did.
Marilyn, I am going to be working on the "text import" and the "storing total..." postings, could you please keep an eye to see if you can help there with sjef and the other experts, these are really important as they are critical business apps.
Thank you in advance.
Varvoura
I changed the mail template, then created a new mailbox based on that mail template, when I tested by created a draft document, nothing happens, no $FolderRef fields were added to the document.
So I guess it really doesn't work, although I wish it did.
Marilyn, I am going to be working on the "text import" and the "storing total..." postings, could you please keep an eye to see if you can help there with sjef and the other experts, these are really important as they are critical business apps.
Thank you in advance.
Varvoura
As I did test.. the draft document has to be moved into a folder, the mailbox has to reside on the server, if the db.postopen stuff doesn't run, then the folder reference won't work until you run the action button agent that I originally posted.
if you can store this >>notesDocument.FolderRefe
for question 2..
in R6 when you tick "Click on column header to sort" in the view column header property, you can select a "Secondary sort column"