Delete privete view

Hi.I have problem with private views. Is there any way to delete private view all users database? I have a lot of users in my company. If there is some changes making in private view, the users have to delete their database from workspace and reopen. Can I delete their view form my computer without his ID? I am the administrator.

Subject: Delete privete view

Look at this code…it may use for you…

Add this code to the Query Close event of the Other->Database Script->Query Close event :

’ This code checks to se if the private views need deleting.

’ Change the LastViewChange date below when ever a shared, private on first use

'  view is changed to force the views to be deleted on the user's machine

’ See http://www.notesninjas.com/#UpdatePrivateViews for full details

’ 8 May 2003 Adam Foster

on error resume next

’ Set this to today’s date when you change a Shared, private on first view

’ Format should be: LastViewChange = “Sep 20, 1969”

LastViewChange = “May 7, 2003”

'Uncomment the next line if you prefer the private views to be deleted everytime (slow)

’ LastViewChange= “”

Dim monthabbr (1 To 12) As String

monthabbr(1) = “Jan”

monthabbr(2) = “Feb”

monthabbr(3) = “Mar”

monthabbr(4) = “Apr”

monthabbr(5) = “May”

monthabbr(6) = “Jun”

monthabbr(7) = “Jul”

monthabbr(8) = “Aug”

monthabbr(9) = “Sep”

monthabbr(10) = “Oct”

monthabbr(11) = “Nov”

monthabbr(12) = “Dec”

Dim session As New notessession

Dim db As notesdatabase

Set db = session.currentdatabase

If LastViewChange=“” Or _

Cdat(session.getenvironmentvalue(“DeletedPrivateViews” & db.filepath) ) <Cdat( LastViewChange) Then

'delete the private views

Print “Starting removing private views stored in database…”

Dim ndd As notesdocument

Forall v In Db.Views

Set ndd = db.getdocumentbyunid(v.universalid)

If ndd.hasitem(“$Flags”) Then

If ndd.~$flags(0) = “PV” Then ’ a normal private view that a user has created, best not to delete it!

'Msgbox "normal private view -not removing it"

Elseif ndd.~$flags(0) = “pYV” Then ’ YES - the shared database private view

Print “Deleting:” & v.name

Call v.Remove

End If

End If

End Forall

'include db.filepath in environment variable so that multiple database can use this code

Call session.setenvironmentvar(“DeletedPrivateViews” & db.filepath, _

monthabbr(Month(Now)) & " " & Day(Now) & ", " & Year(Now))

Else

Print "Private views not deleted as " & _

session.getenvironmentvalue(“DeletedPrivateViews” & db.filepath) & " > " & LastViewChange

End If

If you need to add a button to a help document that will allow users to delete their own

private views (born from shared views), because they have become corrupted etc.

Put this code into a button:

’ This code deletes private views born from shared views

’ See http://www.notesninjas.com/#UpdatePrivateViews for full details

’ 8 May 2003 Adam Foster

’ Make sure the button is not on a view that is a private view as it will throw up

’ an active view error

Dim session As New notessession

Dim db As notesdatabase

Set db = session.currentdatabase

Dim ndd As notesdocument

Forall v In Db.Views

Set ndd = db.getdocumentbyunid(v.universalid)

If ndd.hasitem(“$Flags”) Then

If ndd.~$flags(0) = “PV” Then ’ a normal private view that a user has created, best not to delete it!

'Msgbox "normal private view -not removing it"

Elseif ndd.~$flags(0) = “pYV” Then ’ YES - the shared database private view

Print “Deleting:” & v.name

Call v.Remove

End If

End If

End Forall

Thanks

Sree

Subject: The solution runs great!

Ok. The code runs greate. I have some problem with my provate view. I deleted all provate view and created new one and one all is ok. Thanx for solution!

Subject: RE: Delete privete view

HiThanx for solution. I put this code, but when I close my database, private views are not deleting. If I do some changes in base private view, there are not display aftre closed database.

Any sugestions?