[My Environment] 

  • Windows XP
  • Notes Client 5.0.13
  • Dot Net framework 2.0
  • PowerShell V1.0

[Before you run the code]
making sure that the path of your notes id file is correct.
=>you can check it in the note.ini file : KeyFilename=the direcory containing the id file\yourID.id

[Generate the Domino.dll file]
PS C:\Lotus\NotesR5> regsvr32 "nlsxbe.dll"
PS C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin> ./tlbimp "C:\Lotus\NotesR5\domobj.tlb "
then you can see that the the Domino.dll is generated in the same directory:
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\Domino.dll

[Connect to the DB, Get View and Get the Doc]
#including the Domino.dll
$dllPath="C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\Domino.dll"
$SampleAssembly = [Reflection.Assembly]::LoadFrom($dllPath) ;

#Specifying the Password
$NotesPassword = "PASSWORD";

#Specifying the Server Name
$NotesHost = "SERVER_NAME";

#Specifying the DB Name
$Database = "DB_NAME.nsf";

#Create Session
$Session = New-Object Domino.NotesSessionClass;

#Initialize the Session

#Get the DB
$db = $Session.GetDatabase($NotesHost, $Database, $true);

#Show the DB name

#Get View
$view = $db.GetView("VIEW_NAME");

#Show the number of Doc in the View

#Get the doc by searching the view
$doc = $view.GetDocumentByKey("KEYWORD")

#Check whether you can get the doc by searching the view with keyword

if($doc -eq $Null)
  "No Doc Found"
  "You get it"

#Show the value of the field in the Doc




ayowu 發表在 痞客邦 PIXNET 留言(0) 人氣()