KlausIgel Absent Member.
Absent Member.
1832 views

Move an address book to a folder

Hi,

I've added an AddressBook programatically to the AddressBookEntriesCollection. In GW8 this AddressBook is displayed by default under Frequent Contacts. I've also created 'normal' folder. How can I move the AddressBook to that specific folder by using the Object API. This works only if I move the AddressBook manually within the GroupWise client.

Thanks in advance.
Labels (1)
0 Likes
6 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Move an address book to a folder

I get the Folder object (gwDest) of the destination folder
I iterated the folders under the FrequentContacts folder.
I get the Folder object (gwFolder) of the address book I
want to move. I then call gwFolder.Move(gwDest).

Let me know if you have problems.

Preston

>>> On Monday, May 04, 2009 at 3:26 PM,

KlausIgel<KlausIgel@no-mx.forums.novell.com> wrote:

> Hi,
>
> I've added an AddressBook programatically to the
> AddressBookEntriesCollection. In GW8 this AddressBook is displayed by
> default under Frequent Contacts. I've also created 'normal' folder. How
> can I move the AddressBook to that specific folder by using the Object
> API. This works only if I move the AddressBook manually within the
> GroupWise client.
>
> Thanks in advance.

0 Likes
KlausIgel Absent Member.
Absent Member.

Re: Move an address book to a folder

Thanks for your answer! The question I still face is how to retrieve the Folder object of the address book. My code snippet looks as follows:


Dim destFolder As Folder5
Set destFolder = <existingFolder>

Dim adb As AddressBook3
Dim adbs As AddressBooks2
Set adbs = objGroupWiseProxy.AddressBooks

Set adb = adbs.Add("Test")
adb.SortOrder = egwAscending
adb.Refresh


'How to retrieve the gwFolder Object from adb?

Thanks for your support!

Preston Stephenson;1785718 wrote:
I get the Folder object (gwDest) of the destination folder
I iterated the folders under the FrequentContacts folder.
I get the Folder object (gwFolder) of the address book I
want to move. I then call gwFolder.Move(gwDest).

Let me know if you have problems.

Preston
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Move an address book to a folder

Here is the test that I wrote:

Private Sub btnTest_Click()
Dim gwAcct As Account9
Dim gwApp As Application5
Dim gwBook As AddressBook4
Dim gwBooks As AddressBooks2
Dim gwFolder As Folder7
Dim gwFC As Folder7
Dim gwCabinet As Folder7
Dim gwFolders As Folders
Dim count
Dim i
Dim str As String
str = "/ipa-" + txtServer.Text + " /ipp-" + txtPort.Text

Set gwApp = CreateObject("NovellGroupwareSession")
Set gwAcct = gwApp.MultiLogin(txtUserId.Text, str, txtPassword.Text)
gwAcct.MultiLoginAddressBookSupport = True
Set gwBooks = gwAcct.AddressBooks
count = gwBooks.count
For i = 1 To count
Set gwBook = gwBooks.Item(i)
If gwBook.Name = "Testing" Then
Exit For
End If
Set gwBook = Nothing
Next
If gwBook Is Nothing Then
Set gwBook = gwBooks.Add("Testing")
End If
Set gwBook = Nothing
Set gwBooks = Nothing
Call gwAcct.Refresh

Set gwCabinet = gwAcct.Cabinet
Set gwFolders = gwAcct.AllFolders
count = gwFolders.count
For i = 1 To count
Set gwFolder = gwFolders.Item(i)
If gwFolder.Name = "Contacts" Then
Set gwFC = gwFolder
Set gwFolder = Nothing
Exit For
End If
Set gwFolder = Nothing
Next
Set gwFolders = gwFC.AllFolders
count = gwFolders.count
For i = 1 To count
Set gwFolder = gwFolders.Item(i)
If gwFolder.Name = "Testing" Then Exit For
Set gwFolder = Nothing
Next
If Not gwFolder Is Nothing Then
Call gwFolder.Move(gwCabinet)
End If
Set gwFolder = Nothing
Set gwFolders = Nothing
Set gwFC = Nothing
Set gwCabinet = Nothing
Set gwAcct = Nothing
Set gwApp = Nothing
End Sub

You may have some issues with it.

Preston

>>> On Tuesday, May 05, 2009 at 7:16 AM,

KlausIgel<KlausIgel@no-mx.forums.novell.com> wrote:

> Thanks for your answer! The question I still face is how to retrieve the
> Folder object of the address book. My code snippet looks as follows:
>
>
> Dim destFolder As Folder5
> Set destFolder = <existingFolder>
>
> Dim adb As AddressBook3
> Dim adbs As AddressBooks2
> Set adbs = objGroupWiseProxy.AddressBooks
>
> Set adb = adbs.Add("Test")
> adb.SortOrder = egwAscending
> adb.Refresh
>
> 'How to retrieve the gwFolder Object from adb?
>
> Thanks for your support!
>
> Preston Stephenson;1785718 Wrote:
>> I get the Folder object (gwDest) of the destination folder
>> I iterated the folders under the FrequentContacts folder.
>> I get the Folder object (gwFolder) of the address book I
>> want to move. I then call gwFolder.Move(gwDest).
>>
>> Let me know if you have problems.
>>
>> Preston
>>

0 Likes
KlausIgel Absent Member.
Absent Member.

Re: Move an address book to a folder

Hi Preston,

thanks a lot for your help, everything works now! I've searched a method like "getFolder" on the AddressBook and haven't considered that I've to iterate through the AllFolders collections to retrieve the folder object.

Great support!
0 Likes
ukdtom Absent Member.
Absent Member.

Re: Move an address book to a folder

Preston Stephenson wrote:

> Set gwCabinet = gwAcct.Cabinet
> Set gwFolders = gwAcct.AllFolders
> count = gwFolders.count
> For i = 1 To count
> Set gwFolder = gwFolders.Item(i)
> If gwFolder.Name = "Contacts" Then
> Set gwFC = gwFolder
> Set gwFolder = Nothing
> Exit For
> End If
> Set gwFolder = Nothing
> Next


Might be faster, and not language dependent, to use the
Account.Contacts to retrieve the Contacts object, or ?

--
Tommy Mikkelsen
IT Quality A/S, Denmark
Novell Support Forums SYSOP

Sorry, but no support through email
Be a GroupWiseR, go http://www.groupwiser.net

Best Regards Tommy Mikkelsen Denmark Please Report back any success or failure, That way we all learn Sorry, but no support through email "I hate bugs".......Tommy Lee Jones, MIB
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Move an address book to a folder

That would be true.

>>> On Sunday, May 10, 2009 at 5:16 PM, Tommy Mikkelsen<tm@NoSpAmitq.dk>

wrote:
> Preston Stephenson wrote:
>
>> Set gwCabinet = gwAcct.Cabinet
>> Set gwFolders = gwAcct.AllFolders
>> count = gwFolders.count
>> For i = 1 To count
>> Set gwFolder = gwFolders.Item(i)
>> If gwFolder.Name = "Contacts" Then
>> Set gwFC = gwFolder
>> Set gwFolder = Nothing
>> Exit For
>> End If
>> Set gwFolder = Nothing
>> Next

>
> Might be faster, and not language dependent, to use the
> Account.Contacts to retrieve the Contacts object, or ?

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.