[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Find & Replace problem with UserID field in local address books - via button - PART 2

Posted on 2006-05-17
3
Medium Priority
?
244 Views
Last Modified: 2013-12-18
sjef_bosman updated my code and it works great - thanks Sjef.  But now I need it to check if the USERID field is in h:\notes\data before changing it to y:\notes\data, otherwise my laptop users will be in big trouble!

 Sub Click(Source As Button)
      Dim session As New notessession
      Dim s As String
      
    ' For The Current User in The Current Session, Get All The NABs
      Forall books In session.addressbooks                        
          'Check If The Current NAB is Private or Public
          'If The NAB Is Private, Than It Should Be Your Personal NAB          
            If books.isprivateaddressbook Then                      
               'Verify if The NAB is Open, If Not, Open it
                  If Not(Books.isopen) Then
                        Call Books.open("",books.filename)
               'Now Get All The Documents in The Location View  
                        Set view = books.getview("Locations")          
                        Set doc = view.getfirstdocument                    
               'For All The Documents in The View
                        While Not (doc Is Nothing)                                
                     ' Get The userid Field and Modify it to)
                              s= doc.GetItemValue("Userid")(0)
                              s= Strrightback(s, "\")
                              Call doc.replaceitemvalue ("userid","Y:\NOTES\DATA\" + s)        
                    'Save Document
                              Call doc.save (True,True)                                      
                    'Get Next document
                              Set doc = view.getnextdocument(doc)                  
                        Wend
                  End If
            End If  
      End Forall
End Sub
0
Comment
Question by:Idltd
  • 2
3 Comments
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 2000 total points
ID: 16698818
Sorry, I assumed all users had H:.... in their user-id. How 'bout this change:

Sub Click(Source As Button)
     Dim session As New notessession
     Dim s As String
     
    ' For The Current User in The Current Session, Get All The NABs
     Forall books In session.addressbooks                        
          'Check If The Current NAB is Private or Public
          'If The NAB Is Private, Than It Should Be Your Personal NAB          
          If books.isprivateaddressbook Then                      
               'Verify if The NAB is Open, If Not, Open it
               If Not(Books.isopen) Then
                    Call Books.open("",books.filename)
               'Now Get All The Documents in The Location View  
                    Set view = books.getview("Locations")          
                    Set doc = view.getfirstdocument                    
               'For All The Documents in The View
                    While Not (doc Is Nothing)                                
                     ' Get The userid Field and Modify it to)
                         s= doc.GetItemValue("Userid")(0)
                         ' if the current user-id starts with H:
                         If Ucase(Left(s, 2))= "H:" Then
                             s= Strrightback(s, "\")
                             Call doc.replaceitemvalue ("userid","Y:\NOTES\DATA\" + s)        
                        'Save Document
                             Call doc.save (True,True)                                      
                          End If
                    'Get Next document
                         Set doc = view.getnextdocument(doc)                  
                    Wend
               End If
          End If  
     End Forall
End Sub
0
 

Author Comment

by:Idltd
ID: 16699166
WOW, your good.  Thanks for all your help.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16699309
:)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question