<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>lekkimworld.comlocation_document</title>
    <link>http://lekkimworld.com/tags/location_document/</link>
    <description>IBM Lotus Notes/Domino, Websphere, IBM Connections, mobile, web, JavaScript, Java...</description>
    <language>en</language>
    <copyright>Mikkel Flindt Heisterberg (mh [at] intravision [dot] dk</copyright>
    <pubDate>Sat, 19 May 2012 06:50:25 GMT</pubDate>
    <dc:creator>Mikkel Flindt Heisterberg (mh [at] intravision [dot] dk</dc:creator>
    <dc:date>2012-05-19T06:50:25Z</dc:date>
    <dc:language>en</dc:language>
    <dc:rights>Mikkel Flindt Heisterberg (mh [at] intravision [dot] dk</dc:rights>
    <image>
      <title>lekkimworld.comlocation_document</title>
      <url>http://lekkimworld.com/tags/location_document/</url>
    </image>
    <item>
      <title>LocationDocument LotusScript class updated</title>
      <link>http://lekkimworld.com/2007/09/10/locationdocument_lotusscript_class_updated.html</link>
      <content:encoded>&lt;p&gt;
I updated my &lt;a href="/2005/03/22/1111473875190.html"&gt;LocationDocument LotusScript class&lt;/a&gt; again for Location type (Local Area Network, No connection etc.) and for mail server name. It makes it really easy to quickly get at location document information from script.
&lt;/p&gt;
&lt;p&gt;
See the original post for usage. 
&lt;/p&gt;
&lt;p&gt;
&lt;pre&gt;
'/**
' * LotusScript class for interacting with location documents 
' * in the personal name and address book.
' */
Public Class LocationDocument
   'declarations
   Private pSession As NotesSession
   Private pDb As NotesDatabase
   Private pDoc As NotesDocument
   
   '/**
   ' * Constructor
   ' */
   Public Sub New(get_location As String)
      'declarations
      Dim viewNab As NotesView
      Dim nn As NotesName
      Dim ini_location As String
      Dim location As String
      Dim comma As Integer
      
      'get session
      Set Me.pSession = New NotesSession()
      
      If get_location = "" Then
         'get the location from notes.ini
         ini_location = Me.pSession.GetEnvironmentString("Location", True)
         
         'parse out the location name if none specifed in the constructor
         comma = Instr(1, ini_location, ",")
         location = Mid$(ini_location, 1, comma-1)
      Else
         'use supplied location name
         location = get_location
      End If
      
      'abbreviate the name
      Set nn = New NotesName(location)
      location = nn.Abbreviated
      
      'get database and view
      Set Me.pDb = Me.pSession.GetDatabase("", "names.nsf")
      Set viewNab = Me.pDb.GetView("Locations")
      
      'lookup location document
      Set Me.pDoc = viewNab.GetDocumentByKey(location, True)
      If Me.pDoc Is Nothing Then
         Error 9999, "Location document not found in names.nsf"
      End If
   End Sub
   
   '/**
   ' * Saves.
   ' */
   Public Sub Save()
      Call Me.pDoc.Save(False, False)
   End Sub
   
   '/**
   ' * Property to get the backend document.
   ' */
   Public Property Get Document As NotesDocument
      Set Document = Me.pDoc
   End Property
   
   '/**
   ' * Property to get the e-mail address.
   ' */
   Public Property Get EmailAddress As String
      EmailAddress = Me.pDoc.GetItemValue("ImailAddress")(0)
   End Property
   
   '/**
   ' * Returns the name of the directory server.
   ' */
   Public Property Get DirectoryServer As NotesName
      If Me.LocationType = "3" Then
         Set DirectoryServer = Nothing
      Else
         Dim nn As New NotesName(Me.pDoc.GetItemValue("DirectoryServer")(0))
         Set DirectoryServer = nn
      End If
   End Property
   
   '/**
   ' * Sets the name of the directory server.
   ' */
   Public Property Set DirectoryServer As NotesName
      Call Me.pDoc.ReplaceItemValue("DirectoryServer", DirectoryServer.Canonical)
   End Property
   
   '/**
   ' * Returns the name of the Sametime server.
   ' */
   Public Property Get SametimeServer As NotesName
      If Me.LocationType = "3" Then
         Set SametimeServer = Nothing
      Else
         Set SametimeServer = New NotesName(Me.pDoc.GetItemValue("SametimeServer")(0))
      End If
   End Property
   
   '/**
   ' * Sets the name of the Sametime server.
   ' */
   Public Property Set SametimeServer As NotesName
      Call Me.pDoc.ReplaceItemValue("SametimeServer", SametimeServer.Canonical)
   End Property
   
   '/**
   ' * Returns the name of the mail server.
   ' */
   Public Property Get MailServer As NotesName
      If Me.LocationType = "3" Then
         Set MailServer = Nothing
      Else
         Set MailServer = New NotesName(Me.pDoc.GetItemValue("MailServer")(0))
      End If
   End Property
   
   '/**
   ' * Sets the name of the mail server.
   ' */
   Public Property Set MailServer As NotesName
      Call Me.pDoc.ReplaceItemValue("MailServer", MailServer.Canonical)
   End Property
   
   '/**
   ' * Returns the location type.
   ' * &lt;br&gt;
   ' * Local Area Network = "0"
   ' * Notes Direct Dialup = "1"
   ' * Network Dialup = "4"
   ' * Custom = "2"
   ' * No connection = "3"
   ' */
   Public Property Get LocationType As String
      LocationType = Me.pDoc.GetItemValue("LocationType")(0)
   End Property
End Class
&lt;/pre&gt;
&lt;/p&gt;</content:encoded>
      <category domain="http://lekkimworld.com/categories/ls/">LotusScript</category>
      <category domain="http://lekkimworld.com/tags/class/">class</category>
      <category domain="http://lekkimworld.com/tags/location_document/">location_document</category>
      <category domain="http://lekkimworld.com/tags/lotusscript/">lotusscript</category>
      <pubDate>Mon, 10 Sep 2007 12:30:00 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2007-09-10:default/1189427400000</guid>
      <dc:date>2007-09-10T12:30:00Z</dc:date>
    </item>
  </channel>
</rss>


