?
Solved

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

Posted on 2006-05-17
10
Medium Priority
?
246 Views
Last Modified: 2013-12-18
Hi experts, I need your help please.  I need to amend the UserID field in all users location documents in their address book - id files are being moved from h:\notes\data\ to y:\notes\data\  My code is sorta working, but instead of replacing h:\notes\data\xxxxx.id I end up with only y:\notes\data when I need to keep the same id file name too......

Sub Click(Source As Button)
      Dim session As New notessession
    ' 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)
                              Call doc.replaceitemvalue ("userid","Y:\NOTES\DATA")        
                    '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
  • 5
  • 4
10 Comments
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 2000 total points
ID: 16698274
It now gets the current content of the userid-field, clips the last word, to be attached to the new folder's name

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
 

Author Comment

by:Idltd
ID: 16698380
Thanks, its perfect.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16698432
:)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 18

Expert Comment

by:marilyng
ID: 16704924
Ohh.. not fair!!  duplicate question! fowl! foul! fooey!  Deja vois? Anyone? :))
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16706720
Ah, no, not duplicate, there are (subtle) differences... :P

Et c'est quoi ça: "Deja vois"??
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16714244
My french is lousy, Ok, you're forcing me to look it up.. deja vu << correct?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16715909
Fantastique! Il ne manque que les accents...
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16722294
Non ho idea di che cosa avete detto appena!
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16722442
Scusi... Only the accents are missing: déjà vu.

Was that BabelFish or you yourself??
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16722732
I cannot lie.. bablefish..my italian is as bad as my french.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
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…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

864 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