How to hide view from Web+Mobile using script

I have a script which creates views using db.CreateView. Even if the specified template view is hidden from Web and Mobile clients, the resulting view is always VISIBLE to Web and Mobile clients. How do you hide it ?? From reading previous posts it has something to do with the $Flags item on the view …

Anyone? Bueller… Bueller…

Subject: How to hide view from Web+Mobile using script

Some very basic testing in Designer shows that:1) A view hidden from web browsers have a ‘w’ in the $Flags item

  1. A view hidden from mobile clients have a ‘1’ in the $Flags item

In LotusScript, all you should need to do is:

Dim docDesign As NotesDocument

Dim strFlags As String

'-- Get a reference to docDesign (= the view)

'-- Get the $Flags item.

strFlags = docDesign.GetItemValue(“$Flags”)(0)

'-- To add the ‘Hide from web browsers’ flag.

If Instr(1, strFlags, “w”) = 0 Then strFlags = strFlags & “w”

'-- To add the ‘Hide from Mobile Clients’ flag.

If Instr(1, strFlags, “1”) = 0 Then strFlags = strFlags & “1”

'-- To remove the ‘Hide from web browsers’ flag:

strFlags = Replace(strFlags, “w”, “”)

'-- To remove the ‘Hide from Mobile Client’ flag:

strFlags = Replace(strFlags, “1”, “”)

'-- Update the design element (= the view)

Call docDesign.ReplaceItemValue(“$Flags”, strFlags)

Call docDesign.Save(False, False)

Hope this helps

Ken Haggman, http://www.noteshound.com