Autor Thema: Neues Dokument direkt in Ordner erstellen  (Gelesen 2554 mal)

Offline JimKnopf

  • Frischling
  • *
  • Beiträge: 32
  • Geschlecht: Männlich
  • Der Groschen fällt... manchmal Pfennigweise
Neues Dokument direkt in Ordner erstellen
« am: 03.07.03 - 13:44:06 »
Hallo,

als Anfänger, versuche ich mich nach und nach an der "Notes-Denkweise" in Bezug auf Arbeitsorga.

Mein Frage: Ich habe einen Ordner geöffnet, und möchte nun mittels "compose" (oder es wird eben nach dem speichern verschoben)  das das Dokument auch direkt in diesem Ordner auftaucht. Könnte mir da jemand helfen?Bisher ist es so, das neue Dokumente immer nur in "Alle Dokumente" auftauchen.  ???

Super wäre es, wenn ich gleich auch erfahren könnte, wo diese Information (also zu welchen/m Order(n) ein Doku gehört) im "Datensatz" angespeichert wird.

Für eine Hilfestellung bin ich sehr dankbar!  :D

Viele Grüße
Arne

Glombi

  • Gast
Re:Neues Dokument direkt in Ordner erstellen
« Antwort #1 am: 03.07.03 - 13:56:01 »
Hi,
ich fürchte so einfach geht das nicht. Meines Wissens nach ist eine programmtechnische Lösung per Script nötig.

1.) Um bei einem Dokument zu ermitteln, über welchem Folder es erstellt wurde, geht so:
Erstelle ein Feld (Text, Berechnet beim Anlegen) mit der Formel @ViewTitle.
Dort steht dann der Ansichts-/Ordnername drin.

Beim Speichern des Dokuments dann mit Script in den Folder kopieren.

Beispiel: Im Feld ViewTitle steht mit obiger Formel der Foldername:
Dim doc As NotesDocument
'...set value of doc...
Call doc.PutInFolder( doc.ViewTitle(0) )

2.)
Um rauszukriegen, in welchen Ordnern ein Dokument ist, gibt es Script Methoden:
Auszug aus der Lotus Notes KBase (# 180681):


LotusScript FolderReferences Property Helps Determine in Which Folders a Document is Stored

Problem:

Is there any way to determine in which folder(s) a document is stored?

Solution:

Notes Release R5 contains the LotusScript FolderReferences property (of the NotesDocument Class) which is designed to quickly return which folder(s) a document is in.  

In order to use the FolderReferences property in a database, you must copy two internal views from the Mail Template: ($FolderInfo) and ($FolderRefInfo).  Additionally, the LotusScript FolderReferencesEnabled property (of the NotesDatabase class) must be enabled.  This can only be done programmatically, there is no User Interface equivalent.

A suggested way to enable the FolderReferencesEnabled property is within the PostOpen event for the Database.  This event is found in the Design category "Other", and within the "Database Script" design element.  For example:

Sub Postopen(Source As Notesuidatabase)
   Dim DB As NotesDatabase
   Set DB=Source.Database
   If Not DB.FolderReferencesEnabled Then DB.FolderReferencesenabled=True
End Sub

Below is information from the on-line help on the FolderReferences property, the FolderReferencesEnabled property, and the example script from the properties.



Read only. Shows what folders have references to a particular document.
Note  This property is new with Release 5.
Defined in
NotesDocument
Data type
Array of strings
Syntax
To get: StringArray = notesDocument.FolderReferences
Usage
Note  The database must have the $FolderRef and $FolderRefInfo hidden views to support folder references. These views can be copied from the Release 5 mail template. Also, this property does not return view references.
Not all databases support folder references, so prior to getting the folder references for a document in the database, you should make sure that the database supports folder references by making a call to db.FolderReferencesEnabled.


Read-write. Determines what folders, if any, a document is in.
Note  This property is new with Release 5.
Defined in
NotesDatabase
Data type
Boolean
Syntax
To get: flag  = notesDatabase.FolderReferencesEnabled
To set: notesDatabase.FolderReferencesEnabled = flag
Usage
Not all databases support folder references, so you should first test (using db.FolderReferencesEnabled) to make sure that the database supports folder references, prior to getting the folder references for a document in the database.
Note  The database must have the $FolderRef and $FolderRefInfo hidden views to support folder references. These views can be copied from the Release 5 mail template. Also, this property does not return view references.



The following script creates a new document in the database, puts it into "view1", "view2", and "view3" folders, then prints out all folder references and a count for each document.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = session.CurrentDatabase
If(db.FolderReferencesEnabled) Then
   Messagebox ("Folder references enabled")
Else
   Messagebox("Folder references are not enabled")
   Messagebox("Enabling folder references")
   db.FolderReferencesEnabled = True
End If
db.FolderReferencesEnabled = True
Set doc = db.CreateDocument
If Not(doc Is Nothing) Then
   Call doc.AppendItemValue("To", "Test Document Name")
   Call doc.AppendItemValue("Subject", "Test Document Topic")
   Call doc.Save(True, True)
   Messagebox ("Adding document to views")
   doc.PutInFolder("view1")
   doc.PutInFolder("view2")
   doc.PutInFolder("view3")
   Call doc.Save(True, True)
End If
Dim doccoll As NotesDocumentCollection
Set doccoll = db.AllDocuments
Set doc = doccoll.GetFirstDocument
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(doc)
 Wend

Note:   There is a reported issue where the FolderReferences property causes an error to occur when the property is applied to a document that has been placed within another user's Private folder.  For more information on this topic, refer to document 187281 (),  'FolderReferences Property Returns Error: "You Are Not Authorized to Perform That Operation"'

Supporting Information:

In Notes Release R4, you can code a LotusScript agent to search through all folders in the database to determine whether or not a document is present within any folders.   This type of agent, depending on the number of folders and documents, can take some time to run.  

For example, below is an example of an agent which returns, into an array, all of the folders in which the selected document is located.  The agent must be designed to act on selected documents, and only one document will be acted upon by the agent.   The agent is designed to return all of the document's folders in a String array called FoundInFolder.  The code is not able to search within the Private folders that belong to other users.

Note:   This script is meant as an example only.  Lotus Support is not available to further customize the code within it.

Sub initialize
   Dim s As New NotesSession
   Dim db As NotesDatabase
   Dim dc As NotesDocumentCollection
   Dim doc As NotesDocument
   Dim key As String
   Dim FoundInFolder ( ) As String
   
   Set db = s.CurrentDatabase
   Set dc = db.UnprocessedDocuments
   Set doc = dc.GetFirstDocument
   key = doc.NoteID
   i=0
   
   Forall nv In db.Views
      On Error 4005 Goto PrivateOnFirstUse
'Error 4005 will occur when accessing the "Shared, Private on First use" design element
' stub.  The above On Error call causes this element to be skipped      
      If nv.IsFolder  Then
         On Error 4005 Goto 0
         Set doc = nv.GetFirstDocument
         If Not (doc Is Nothing) Then         
            Do
               If (key = doc.NoteID) Then
                  Redim Preserve foundinfolder(i)
                  Foundinfolder(i)=nv.name
                  i=i+1                  
               End If
               Set doc = nv.Getnextdocument(doc)
            Loop Until (doc Is Nothing)                  
         End If         
      End If
PrivateOnFirstUse:   
   End Forall
End Sub

Offline JimKnopf

  • Frischling
  • *
  • Beiträge: 32
  • Geschlecht: Männlich
  • Der Groschen fällt... manchmal Pfennigweise
Re:Neues Dokument direkt in Ordner erstellen
« Antwort #2 am: 03.07.03 - 14:06:41 »
Hallo Glombi,

na kein Wunder, dass ich trotz intensiver Suche keine Lösung gefunden habe.

Ist zwar nicht so einfach wie ich dachte aber ich glaube, dass bekomme ich dank Deiner Antwort hin.

Vielen Dank für die schnelle Antwort und noch einen schönen Tag!

Gruß
Arne

Offline Meff

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 2.095
  • Geschlecht: Männlich
  • Das Denken der Zukunft muß Kriege unmöglich machen
    • apparet id etiam caeco
Re:Neues Dokument direkt in Ordner erstellen
« Antwort #3 am: 03.07.03 - 15:25:38 »
Wenn ich gleich mit so einer Problematik bzw. Lösung konfrontiert worden wäre, hätte ich mich wahrscheinlich doch eher für Exchange interessiert ;D ;D ;D

Meff
"Zwei Dinge sind zu unserer Arbeit nötig: Unermüdliche Ausdauer und die Bereitschaft, etwas, in das man viel Zeit und Arbeit gesteckt hat, wieder wegzuwerfen."
Albert Einstein

Offline JimKnopf

  • Frischling
  • *
  • Beiträge: 32
  • Geschlecht: Männlich
  • Der Groschen fällt... manchmal Pfennigweise
Re:Neues Dokument direkt in Ordner erstellen
« Antwort #4 am: 03.07.03 - 15:30:39 »
 >:( Du willst mir aber den Spass auch nicht gönnen was...  ;)

Nein, ist schon okay... ich lerne gerade einige Stärken von Notes zu lieben und die schwächen, äähh Features zu programmieren  ;)

und Mails verschicken kann ich auch mit GMX....   8)

Aber ist schon ziemlich kalt --- das Wasser!!!!!  :-\


 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz