Get archive dbpath from maildb?

Hello

I need to get from script the dbpath of the mail user archive.

From notespeek I can see that we have much profile that I’m waiting for :

“default for last modified”

“default for expired”

“archive database profile”

“archive profile”

Which profile I have to use each time I need the path of configured archive (by policies)?

Thanks by advance for your help.

Subject: Use ArchLastRunDestDBs field in ArchiveProfile

This should contain the correct information.

For server based archiving it will be somtheing like CN=Server/OU=orgunit/O=Organisation!!Archive\a_yourmail.nsf

However when a user has never accessed his/her archive/archive settings there will not be an archiveprofile and the archiving process will not create one.

http://www-01.ibm.com/support/docview.wss?rs=899&uid=swg21390893

We had received a hotfix for this before and needed the following ini setting (I’m not sure if it’s still required):

COMPACT_FIX_ARCH_PROF=1

Subject: not at all…

no trace of this line in profiles list

I tried to build the path dynamically from policies;

At the begining I tried to get the assigned policies to a user with this code but the doc is null.

Sub Initialize

Dim session As New NotesSession

Dim doc,doc1,doc2,doc3 As NotesDocument

Dim msg As String

Set doc = session.GetUserPolicySettings(“CN=SERVER/O=ORG”, “CN=Alban TURET/O=ORG”, 0 )

End Sub

Subject: here’s a script

This is a button script to read all the user mailfiles and tell you the filename and the archive path/filename. You can modify it to do what you need. you would put this script under a button in an email or a rich text field in a document. This assumes you have manager access to all the mailfiles.

Sub Click(Source As Button)

On Error Resume Next

'this script asks you what server, then lists all the databases on that server

Dim session As New NotesSession	

Dim db As notesdatabase

Dim db1 As NotesDatabase 'poll thru databases

Dim counter As Integer

Dim myserver As Variant

Dim uidoc As NotesUIDocument

Dim NewList As String

Dim result As Variant

Set ws = New NotesUIWorkspace

Set uidoc=ws.CurrentDocument

Dim dc As NotesDocumentCollection

Dim doc As NotesDocument

Dim createDate As Variant



myserver = Split(Inputbox$("List servers separated by commas and no spaces."), ",")

NewList = ""

Forall srvr In myserver

	Dim dbdir As New notesdbdirectory(srvr)		

	Set db1 = dbdir.getfirstdatabase(DATABASE)

	While Not(db1 Is Nothing)

		If Left(db1.FilePath,5) = "mail\" Then 'only if it is in mail directory 'IT IS A MAILFILE

			dbname = db1.Filepath			

			Set db=session.GetDatabase(srvr,dbname)

			Set arcdoc=db.GetProfileDocument("Archive Profile")

			arcfile = arcdoc.ArchivePath(0)

			newlist = db.title + " : " + arcfile

			Call uidoc.FieldAppendText("Body",newlist+ Chr$(10))

		End If 'IT IS A MAILFILE

		Set db1 = dbdir.getnextdatabase

	Wend

End Forall

Call uidoc.refresh	

Messagebox("done")

End Sub

Subject: not working

Thank you for your code but in this case it’s not working.Archive settings are pushed from policies.

to get the profile “archive profile” could be empty or store a bad path for the real user archive…

I tried to get the policy information from ls function GetUserPolicySettings, but system returns a null profile doc…

Subject: if you are pushing it via policy, then don’t you already know what it is?

Subject: I use this script

Create an empty database and add a form called “Log” with the following fields

Name

MailServer

MailFile

dbList

Create a view to display the docs created with this form. Add a scheduled agent with the below code …

Sub Initialize

Dim ns As New NotesSession

Dim db As NotesDatabase

Dim nab As NotesDatabase

Set db = ns.CurrentDatabase

Set nab = ns.GetDatabase(db.Server, "names.nsf")

Dim ndb As NotesDatabase

Dim ndc As NotesDocumentCollection

Dim doc As NotesDocument

Dim note As NotesDocument

' get mail file collection

Dim pdocs As NotesDocumentCollection

Dim pdoc As NotesDocument

Dim archdblist ( ) As String

sf$ = | SELECT Type = "Person" & MailServer != "" & !@IsAvailable($Conflict) |

Set pdocs = nab.Search(sf$, Nothing, 0)

If pdocs.Count > 1 Then

	Set pdoc = pdocs.GetFirstDocument

	While Not pdoc Is Nothing

		Print "processing: " & pdoc.LastName(0) & ", " & pdoc.FirstName(0)

		serv$ = pdoc.MailServer(0)

		file$ = pdoc.MailFile(0)

		Set ndb = ns.GetDatabase( serv$, file$ )

		If Not ndb.IsOpen Then

			Goto nxtdb

		End If

		Set ndc = ndb.GetProfileDocCollection( "archive profile" )

		Set doc = ndc.GetFirstDocument

		While Not doc Is Nothing

			If doc.HasItem("ArchLastRunDestDbs") Then

				If doc.ArchLastRunDestDbs(0) <> "" Then

					count% = 0

					Forall n In doc.ArchLastRunDestDBs

						count% = count% + 1

					End Forall

					Redim archdblist ( 1 To count% ) As String

					Forall a In doc.ArchLastRunDestDBs

						archdblist(count%) = a

						count% = count% - 1

					End Forall

					Set note = db.CreateDocument

					With note

						.Form = "Log"

						.Name = pdoc.FullName(0)

						.MailServer = serv$

						.MailFile = file$

						.dbList = archdblist

					End With

					Call note.Save(True, False)

				End If

			End If

			Set doc = ndc.GetNextDocument(doc)

		Wend

nxtdb:

		Set pdoc = pdocs.GetNextDocument(pdoc)

	Wend

End If

End Sub