@updateviewdesign

weird – I have an agent (many thanks to the people in this forum) that is supposed to update the folder design for the private folders but it’s modifying the actual main ‘source’ folder instead. How can I get it to update the shared private on first use folder?

Sub Initialize

Dim s As New NotesSession

Dim workspace As New NotesUIWorkspace

Dim uiview As NotesUIView

Dim db As NotesDatabase

Dim view As notesview	



Set db=s.CurrentDatabase

Set uiview = workspace.CurrentView



Set view = db.GetView(uiview.ViewName )

’ Messagebox view.ViewName

If view.IsFolder= False Then

	Msgbox "Operation canceled - only valid for folders"

	Exit Sub

End If



Call UpgradeHandling(uiview.ViewName , uiview.ViewName )

End Sub

Sub UpgradeHandling(folder As String, source As String)

'// This function will upgrade folder design

Dim functionName As String

'Start additional code section 1:

Dim s2 As New notessession

Dim db2 As NotesDatabase

Dim view As NotesView

Dim viewdoc As NotesDocument

Dim savename As String

Set db2=s2.CurrentDatabase

'End of additional code section 1

functionName = "UpgradeHandling"

On Error Goto TrapError

'Start additional code section 2:

'The code in the IF section checks for starting and ending quotes in the name

'and temporarily swaps the trailing quote, upgrades the design,

'and changes the view name back to the original.

If Left(folder, 1)=|"| And Right(folder, 1)=|"| Then

	savename=folder

	folder= "begin" & Mid$(folder, 2, Len(folder)-2) & "end"

	Set view=db2.getview(savename)

	view.name=folder

	Evaluate(|@UpdateViewDesign("|& folder & |";"| & Source & |")|)

'reset name back to original

	view.name=savename

	Set viewdoc=db2.getdocumentbyunid(view.universalid)

	Call viewdoc.sign

	Call viewdoc.save(True, True)

Else

'End of additional code section 2

'Performs the design upgrade for views/folders that don’t contain a quote in the name.

	Evaluate(|@UpdateViewDesign("|& folder & |";"| & Source & |")|)

'Start of additional code section 3

End If

'End of code section 3

Exit Sub

TrapError:

Msgbox "Error on " & functionName & " >> " & (Err & ": " & Error$)

Exit Sub

End Sub

Subject: @updateviewdesign

I think this is the problem:

Call UpgradeHandling(uiview.ViewName , uiview.ViewName )

Without getting to far into your code why are you passing the same parameter twice. Are you updating the design of the view with the same view?

Subject: RE: @updateviewdesign

Thanks so much!

The name is the same because it’s a shared folder, private on first use. so you have the main folder and then the private folder that gets created, right? how do you update the design of that private folder without losing all the docs in it?

I have 2 shared, private on first use folders. When you click on it, it creates the new personal folder – it’s that personal folder I would like to update using the design which is by the same name… should I create another hidden design folder for it to inherit from?

How do I update the folder that’s now private? Loop through all ‘views’ by that name and update them?

It there another way to accomplish the same thing as private on first use folders without using folders?

Subject: RE: @updateviewdesign

Hi,

maybe it can help:

Determine If A Private View Is Out Of Date

http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256B880071F14F

JYR

Subject: RE: @updateviewdesign

That is very cool…

I’ll let you know what I come up with.

Thanks

Subject: Is this a lame post? A really dumb question?

Subject: + Don’t forget to add…

support for Sub-folders… Just spent a while working out why sub-folders kept failing to upgrade.

M.

http://www-10.lotus.com/ldd/46dom.nsf/0/b09694a590e9a66185256d0300484019?OpenDocument




'We do this next bit so slashes don't get stripped out of the view name when passed to UpdateViewDesign

slashpos = Instr( view_name, "\" )



While slashpos

view_name = Left(view_name, slashpos) & "\" & Right( view_name, _

Len(view_name) - slashpos)

slashpos = Instr(slashpos+2, view_name, "\" )

Wend