Anonymous_User Absent Member.
Absent Member.
1403 views

Modifying "contacts" for a ContainerItem in GW8.0.1

Hello,

I am trying to modify the "contacts" for posted task item in my calendar. The existing task has a contact in its contacts list.

I get an in-memory instance of a task and modify it by clearing out the task.contacts collection, and creating a new (empty) collection.

I then add the ID of the new contact to the task.contacts collection, create a modifyItemRequest object with the task object, and call modifyItemRequest().

I don't get an error code back (modifyItemResponse.status.code == 0).

Yet, the contacts collection of the item in GroupWise is not changed at all. If I look at the item via the Win32 client, the old contact is still there, and if I retrieve the item via SOAP, the old contact ID is still in the collection.

Am I doing something wrong, or is it possible that updating the contacts on an item via SOAP is broken?

BTW, I am using GW 8.0.1-87458 with v1.0.2 of the schema.

Any help is appreciated...

Thanks.

--sk.
Labels (1)
0 Likes
7 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Modifying "contacts" for a ContainerItem in GW8.0.1

Here is the test I did:

I first added a contact to a Mail item.(Tasks should be the same.)

private void testContacts() {
FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
"Johnson", null, null );
FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName", null,
"Craig", null, null );
// FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
"Parker", null, null );
// FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",
null, "Jay", null, null );
FilterElement fe[] = new FilterElement[2];
FilterGroup grp = new FilterGroup( FilterOp.and, fe );
Filter flt = new Filter( grp );
GetAddressBookListResponse abresp;
GetItemsResponse resp;
ItemChanges changes = new ItemChanges();
Mail mail = new Mail();
String id = null;
String[] ids = new String[1];
String view = null;

try {

abresp = m_main.getService().getAddressBookListRequest( "Frequent
Contacts", view, m_main.getSessionId(), m_main.getTrace() );
if ( 0 == abresp.getStatus().getCode() ) {
id = abresp.getBooks().getBook()[0].getId();
}
fe[0] = f1;
fe[1] = f2;
resp = m_main.getService().getItemsRequest( id, view, flt,
null, 0, m_main.getSessionId(), m_main.getTrace() );
if ( 0 == resp.getStatus().getCode() && 0 !=
resp.getItems().getItem().length ) {
ids[0] = resp.getItems().getItem()[0].getId();
mail.setContacts( new ContactRefList( ids ) );
changes.setAdd( mail );
// mail = new Mail();
// mail.setContacts( new ContactRefList( null ) );
// changes.setDelete( mail );
m_main.getService().modifyItemRequest( m_mitem.getId(), null, changes,
0, m_main.getSessionId(), m_main.getTrace() );
}
} catch ( Exception e ) {
e.printStackTrace();
}
}

Here is the simplified SOAP request:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope>
<env:Body>
<ns0:modifyItemRequest>

<ns0:id>49EF11C3.domain.PO1.100.1776172.1.CAE4.1@1:7.domain.PO1.100.0.1.0.1@
16</ns0:id>
<ns0:updates>
<ans1:add type="Mail">
<ans1:contacts>

<ans1:contact>478628FF.domain.PO1.104.1776172.1.D6.1@56:45080270.domain.PO1.
104.1776172.1.3.1@53</ans1:contact>
</ans1:contacts>
</ans1:add>
</ns0:updates>
</ns0:modifyItemRequest>
</env:Body>
</env:Envelope>

I then went back, deleted the old contact(s) and added a different one:
private void testContacts() {
// FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
"Johnson", null, null );
// FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",
null, "Craig", null, null );
FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
"Parker", null, null );
FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName", null,
"Jay", null, null );
FilterElement fe[] = new FilterElement[2];
FilterGroup grp = new FilterGroup( FilterOp.and, fe );
Filter flt = new Filter( grp );
GetAddressBookListResponse abresp;
GetItemsResponse resp;
ItemChanges changes = new ItemChanges();
Mail mail = new Mail();
String id = null;
String[] ids = new String[1];
String view = null;

try {

abresp = m_main.getService().getAddressBookListRequest( "Frequent
Contacts", view, m_main.getSessionId(), m_main.getTrace() );
if ( 0 == abresp.getStatus().getCode() ) {
id = abresp.getBooks().getBook()[0].getId();
}
fe[0] = f1;
fe[1] = f2;
resp = m_main.getService().getItemsRequest( id, view, flt,
null, 0, m_main.getSessionId(), m_main.getTrace() );
if ( 0 == resp.getStatus().getCode() && 0 !=
resp.getItems().getItem().length ) {
ids[0] = resp.getItems().getItem()[0].getId();
mail.setContacts( new ContactRefList( ids ) );
changes.setAdd( mail );
mail = new Mail();
mail.setContacts( new ContactRefList( null ) );
changes.setDelete( mail );
m_main.getService().modifyItemRequest( m_mitem.getId(), null, changes,
0, m_main.getSessionId(), m_main.getTrace() );
}
} catch ( Exception e ) {
e.printStackTrace();
}
}

Here is the simplified SOAP trace.

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope>
<env:Body>
<ns0:modifyItemRequest>

<ns0:id>49EF11C3.domain.PO1.100.1776172.1.CAE4.1@1:7.domain.PO1.100.0.1.0.1@
16</ns0:id>
<ns0:updates>
<ans1:add type="Mail">
<ans1:contacts>

<ans1:contact>455C59CA.domain.PO1.104.1776172.1.54.1@56:45080270.domain.PO1.
104.1776172.1.3.1@53</ans1:contact>
</ans1:contacts>
</ans1:add>
<ans1:delete type="Mail">
<ans1:contacts/>
</ans1:delete>
</ns0:updates>
</ns0:modifyItemRequest>
</env:Body>
</env:Envelope>

If you still have problems, it might help if you send the
SOAP trace.

Preston

>>> On Friday, June 05, 2009 at 4:27 PM, Sean

Kirkby<skirkby@armordatasystems.com>
wrote:
> Hello,
>
> I am trying to modify the "contacts" for posted task item in my calendar.


> The existing task has a contact in its contacts list.
>
> I get an in‑memory instance of a task and modify it by clearing out the


> task.contacts collection, and creating a new (empty) collection.
>
> I then add the ID of the new contact to the task.contacts collection,

create
> a modifyItemRequest object with the task object, and call
> modifyItemRequest().
>
> I don't get an error code back (modifyItemResponse.status.code == 0).
>
> Yet, the contacts collection of the item in GroupWise is not changed at

all.
> If I look at the item via the Win32 client, the old contact is still

there,
> and if I retrieve the item via SOAP, the old contact ID is still in the
> collection.
>
> Am I doing something wrong, or is it possible that updating the contacts

on
> an item via SOAP is broken?
>
> BTW, I am using GW 8.0.1‑87458 with v1.0.2 of the schema.
>
> Any help is appreciated...
>
> Thanks.
>
> ‑‑sk.

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Modifying "contacts" for a ContainerItem in GW8.0.1

Thanks, Preston.

I figured out the issue...

I retrieve a task item from GW. I then populate a form with data from the item.

Among the things the user can modify on the form are the subject, the due date, and the contacts.

What I was doing was taking all of the form data (whether or not it had changed), updating the in-memory copy of the task (including the Contacts collection), and assigning my modifyItemRequest.updates.update property to the in-memory task object.

Apparently, when adding a new item to the Contacts list, you can't use modifyItemRequest.updates.update, you have to use modifyItemRequest.updates.add.

Will this be true for ANYTHING that is a container/list of any kind?

Thanks.

--sk.


>>> On 6/8/2009 at 5:31 AM, Preston Stephenson<PStephenson@gw.novell.com> wrote:


Here is the test I did:

I first added a contact to a Mail item.(Tasks should be the same.)

private void testContacts() {
FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
"Johnson", null, null );
FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName", null,
"Craig", null, null );
// FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
"Parker", null, null );
// FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",
null, "Jay", null, null );
FilterElement fe[] = new FilterElement[2];
FilterGroup grp = new FilterGroup( FilterOp.and, fe );
Filter flt = new Filter( grp );
GetAddressBookListResponse abresp;
GetItemsResponse resp;
ItemChanges changes = new ItemChanges();
Mail mail = new Mail();
String id = null;
String[] ids = new String[1];
String view = null;

try {

abresp = m_main.getService().getAddressBookListRequest( "Frequent
Contacts", view, m_main.getSessionId(), m_main.getTrace() );
if ( 0 == abresp.getStatus().getCode() ) {
id = abresp.getBooks().getBook()[0].getId();
}
fe[0] = f1;
fe[1] = f2;
resp = m_main.getService().getItemsRequest( id, view, flt,
null, 0, m_main.getSessionId(), m_main.getTrace() );
if ( 0 == resp.getStatus().getCode() && 0 !=
resp.getItems().getItem().length ) {
ids[0] = resp.getItems().getItem()[0].getId();
mail.setContacts( new ContactRefList( ids ) );
changes.setAdd( mail );
// mail = new Mail();
// mail.setContacts( new ContactRefList( null ) );
// changes.setDelete( mail );
m_main.getService().modifyItemRequest( m_mitem.getId(), null, changes,
0, m_main.getSessionId(), m_main.getTrace() );
}
} catch ( Exception e ) {
e.printStackTrace();
}
}

Here is the simplified SOAP request:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope>
<env:Body>
<ns0:modifyItemRequest>

<ns0:id>49EF11C3.domain.PO1.100.1776172.1.CAE4.1@1:7.domain.PO1.100.0.1.0.1@
16</ns0:id>
<ns0:updates>
<ans1:add type="Mail">
<ans1:contacts>

<ans1:contact>478628FF.domain.PO1.104.1776172.1.D6.1@56:45080270.domain.PO1.
104.1776172.1.3.1@53</ans1:contact>
</ans1:contacts>
</ans1:add>
</ns0:updates>
</ns0:modifyItemRequest>
</env:Body>
</env:Envelope>

I then went back, deleted the old contact(s) and added a different one:
private void testContacts() {
// FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
"Johnson", null, null );
// FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",
null, "Craig", null, null );
FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
"Parker", null, null );
FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName", null,
"Jay", null, null );
FilterElement fe[] = new FilterElement[2];
FilterGroup grp = new FilterGroup( FilterOp.and, fe );
Filter flt = new Filter( grp );
GetAddressBookListResponse abresp;
GetItemsResponse resp;
ItemChanges changes = new ItemChanges();
Mail mail = new Mail();
String id = null;
String[] ids = new String[1];
String view = null;

try {

abresp = m_main.getService().getAddressBookListRequest( "Frequent
Contacts", view, m_main.getSessionId(), m_main.getTrace() );
if ( 0 == abresp.getStatus().getCode() ) {
id = abresp.getBooks().getBook()[0].getId();
}
fe[0] = f1;
fe[1] = f2;
resp = m_main.getService().getItemsRequest( id, view, flt,
null, 0, m_main.getSessionId(), m_main.getTrace() );
if ( 0 == resp.getStatus().getCode() && 0 !=
resp.getItems().getItem().length ) {
ids[0] = resp.getItems().getItem()[0].getId();
mail.setContacts( new ContactRefList( ids ) );
changes.setAdd( mail );
mail = new Mail();
mail.setContacts( new ContactRefList( null ) );
changes.setDelete( mail );
m_main.getService().modifyItemRequest( m_mitem.getId(), null, changes,
0, m_main.getSessionId(), m_main.getTrace() );
}
} catch ( Exception e ) {
e.printStackTrace();
}
}

Here is the simplified SOAP trace.

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope>
<env:Body>
<ns0:modifyItemRequest>

<ns0:id>49EF11C3.domain.PO1.100.1776172.1.CAE4.1@1:7.domain.PO1.100.0.1.0.1@
16</ns0:id>
<ns0:updates>
<ans1:add type="Mail">
<ans1:contacts>

<ans1:contact>455C59CA.domain.PO1.104.1776172.1.54.1@56:45080270.domain.PO1.
104.1776172.1.3.1@53</ans1:contact>
</ans1:contacts>
</ans1:add>
<ans1:delete type="Mail">
<ans1:contacts/>
</ans1:delete>
</ns0:updates>
</ns0:modifyItemRequest>
</env:Body>
</env:Envelope>

If you still have problems, it might help if you send the
SOAP trace.

Preston


>>> On Friday, June 05, 2009 at 4:27 PM, Sean

Kirkby<skirkby@armordatasystems.com>
wrote:

> Hello,
>
> I am trying to modify the "contacts" for posted task item in my calendar.



> The existing task has a contact in its contacts list.
>
> I get an in‑memory instance of a task and modify it by clearing out the



> task.contacts collection, and creating a new (empty) collection.
>
> I then add the ID of the new contact to the task.contacts collection,

create

> a modifyItemRequest object with the task object, and call
> modifyItemRequest().
>
> I don't get an error code back (modifyItemResponse.status.code == 0).
>
> Yet, the contacts collection of the item in GroupWise is not changed at

all.

> If I look at the item via the Win32 client, the old contact is still

there,

> and if I retrieve the item via SOAP, the old contact ID is still in the
> collection.
>
> Am I doing something wrong, or is it possible that updating the contacts

on

> an item via SOAP is broken?
>
> BTW, I am using GW 8.0.1‑87458 with v1.0.2 of the schema.
>
> Any help is appreciated...
>
> Thanks.
>
> ‑‑sk.
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Modifying "contacts" for a ContainerItem in GW8.0.1

BTW, what is the recommended best practice if there are multiple values to update/modify on an item?

Is it best to try to do as much as possible in one request? Or is it more efficient to do them each in their own modifyItemRequest() call?

--sk.


>>> On 6/8/2009 at 5:31 AM, Preston Stephenson<PStephenson@gw.novell.com> wrote:


Here is the test I did:

I first added a contact to a Mail item.(Tasks should be the same.)

private void testContacts() {
FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
"Johnson", null, null );
FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName", null,
"Craig", null, null );
// FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
"Parker", null, null );
// FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",
null, "Jay", null, null );
FilterElement fe[] = new FilterElement[2];
FilterGroup grp = new FilterGroup( FilterOp.and, fe );
Filter flt = new Filter( grp );
GetAddressBookListResponse abresp;
GetItemsResponse resp;
ItemChanges changes = new ItemChanges();
Mail mail = new Mail();
String id = null;
String[] ids = new String[1];
String view = null;

try {

abresp = m_main.getService().getAddressBookListRequest( "Frequent
Contacts", view, m_main.getSessionId(), m_main.getTrace() );
if ( 0 == abresp.getStatus().getCode() ) {
id = abresp.getBooks().getBook()[0].getId();
}
fe[0] = f1;
fe[1] = f2;
resp = m_main.getService().getItemsRequest( id, view, flt,
null, 0, m_main.getSessionId(), m_main.getTrace() );
if ( 0 == resp.getStatus().getCode() && 0 !=
resp.getItems().getItem().length ) {
ids[0] = resp.getItems().getItem()[0].getId();
mail.setContacts( new ContactRefList( ids ) );
changes.setAdd( mail );
// mail = new Mail();
// mail.setContacts( new ContactRefList( null ) );
// changes.setDelete( mail );
m_main.getService().modifyItemRequest( m_mitem.getId(), null, changes,
0, m_main.getSessionId(), m_main.getTrace() );
}
} catch ( Exception e ) {
e.printStackTrace();
}
}

Here is the simplified SOAP request:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope>
<env:Body>
<ns0:modifyItemRequest>

<ns0:id>49EF11C3.domain.PO1.100.1776172.1.CAE4.1@1:7.domain.PO1.100.0.1.0.1@
16</ns0:id>
<ns0:updates>
<ans1:add type="Mail">
<ans1:contacts>

<ans1:contact>478628FF.domain.PO1.104.1776172.1.D6.1@56:45080270.domain.PO1.
104.1776172.1.3.1@53</ans1:contact>
</ans1:contacts>
</ans1:add>
</ns0:updates>
</ns0:modifyItemRequest>
</env:Body>
</env:Envelope>

I then went back, deleted the old contact(s) and added a different one:
private void testContacts() {
// FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
"Johnson", null, null );
// FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",
null, "Craig", null, null );
FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
"Parker", null, null );
FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName", null,
"Jay", null, null );
FilterElement fe[] = new FilterElement[2];
FilterGroup grp = new FilterGroup( FilterOp.and, fe );
Filter flt = new Filter( grp );
GetAddressBookListResponse abresp;
GetItemsResponse resp;
ItemChanges changes = new ItemChanges();
Mail mail = new Mail();
String id = null;
String[] ids = new String[1];
String view = null;

try {

abresp = m_main.getService().getAddressBookListRequest( "Frequent
Contacts", view, m_main.getSessionId(), m_main.getTrace() );
if ( 0 == abresp.getStatus().getCode() ) {
id = abresp.getBooks().getBook()[0].getId();
}
fe[0] = f1;
fe[1] = f2;
resp = m_main.getService().getItemsRequest( id, view, flt,
null, 0, m_main.getSessionId(), m_main.getTrace() );
if ( 0 == resp.getStatus().getCode() && 0 !=
resp.getItems().getItem().length ) {
ids[0] = resp.getItems().getItem()[0].getId();
mail.setContacts( new ContactRefList( ids ) );
changes.setAdd( mail );
mail = new Mail();
mail.setContacts( new ContactRefList( null ) );
changes.setDelete( mail );
m_main.getService().modifyItemRequest( m_mitem.getId(), null, changes,
0, m_main.getSessionId(), m_main.getTrace() );
}
} catch ( Exception e ) {
e.printStackTrace();
}
}

Here is the simplified SOAP trace.

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope>
<env:Body>
<ns0:modifyItemRequest>

<ns0:id>49EF11C3.domain.PO1.100.1776172.1.CAE4.1@1:7.domain.PO1.100.0.1.0.1@
16</ns0:id>
<ns0:updates>
<ans1:add type="Mail">
<ans1:contacts>

<ans1:contact>455C59CA.domain.PO1.104.1776172.1.54.1@56:45080270.domain.PO1.
104.1776172.1.3.1@53</ans1:contact>
</ans1:contacts>
</ans1:add>
<ans1:delete type="Mail">
<ans1:contacts/>
</ans1:delete>
</ns0:updates>
</ns0:modifyItemRequest>
</env:Body>
</env:Envelope>

If you still have problems, it might help if you send the
SOAP trace.

Preston


>>> On Friday, June 05, 2009 at 4:27 PM, Sean

Kirkby<skirkby@armordatasystems.com>
wrote:

> Hello,
>
> I am trying to modify the "contacts" for posted task item in my calendar.



> The existing task has a contact in its contacts list.
>
> I get an in‑memory instance of a task and modify it by clearing out the



> task.contacts collection, and creating a new (empty) collection.
>
> I then add the ID of the new contact to the task.contacts collection,

create

> a modifyItemRequest object with the task object, and call
> modifyItemRequest().
>
> I don't get an error code back (modifyItemResponse.status.code == 0).
>
> Yet, the contacts collection of the item in GroupWise is not changed at

all.

> If I look at the item via the Win32 client, the old contact is still

there,

> and if I retrieve the item via SOAP, the old contact ID is still in the
> collection.
>
> Am I doing something wrong, or is it possible that updating the contacts

on

> an item via SOAP is broken?
>
> BTW, I am using GW 8.0.1‑87458 with v1.0.2 of the schema.
>
> Any help is appreciated...
>
> Thanks.
>
> ‑‑sk.
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Modifying "contacts" for a ContainerItem in GW8.0.1

Sorry, there is not a general rule.
It all depends on who and how the underlying logic
is implemented. I try to pass on the information when
certain fields don't work as expected to be documented.
Unfortunately, I probably forget to make sure that
information is not lost by the time the documentation
is updated. For example, for the most part using rules
you need to delete and add the rule again to modify a
rule. For draft message bodies you need to delete and
add the message body again. I believe the client even
deletes the whole draft item and creates it again when
the user makes a change to a draft message.

Unfortunately, I don't remember all of the exceptions.
I usually have to debug through the code each time to
figure out how it works.

If you have questions about specific parts, I would be
glad to research it for you.

Preston

>>> On Monday, June 08, 2009 at 5:17 PM, Sean

Kirkby<skirkby@armordatasystems.com>
wrote:
> Thanks, Preston.
>
> I figured out the issue...
>
> I retrieve a task item from GW. I then populate a form with data from the


> item.
>
> Among the things the user can modify on the form are the subject, the due


> date, and the contacts.
>
> What I was doing was taking all of the form data (whether or not it had
> changed), updating the in‑memory copy of the task (including the

Contacts
> collection), and assigning my modifyItemRequest.updates.update property to


> the in‑memory task object.
>
> Apparently, when adding a new item to the Contacts list, you can't use
> modifyItemRequest.updates.update, you have to use
> modifyItemRequest.updates.add.
>
> Will this be true for ANYTHING that is a container/list of any kind?
>
> Thanks.
>
> ‑‑sk.
>
>>>> On 6/8/2009 at 5:31 AM, Preston Stephenson<PStephenson@gw.novell.com>

wrote:
>
> Here is the test I did:
>
> I first added a contact to a Mail item.(Tasks should be the same.)
>
> private void testContacts() {
> FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
> "Johnson", null, null );
> FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName", null,
> "Craig", null, null );
> // FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName",

null,
> "Parker", null, null );
> // FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",
> null, "Jay", null, null );
> FilterElement fe[] = new FilterElement[2];
> FilterGroup grp = new FilterGroup( FilterOp.and, fe );
> Filter flt = new Filter( grp );
> GetAddressBookListResponse abresp;
> GetItemsResponse resp;
> ItemChanges changes = new ItemChanges();
> Mail mail = new Mail();
> String id = null;
> String[] ids = new String[1];
> String view = null;
>
> try {
>
> abresp = m_main.getService().getAddressBookListRequest( "Frequent
> Contacts", view, m_main.getSessionId(), m_main.getTrace() );
> if ( 0 == abresp.getStatus().getCode() ) {
> id = abresp.getBooks().getBook()[0].getId();
> }
> fe[0] = f1;
> fe[1] = f2;
> resp = m_main.getService().getItemsRequest( id, view, flt,
> null, 0, m_main.getSessionId(), m_main.getTrace() );
> if ( 0 == resp.getStatus().getCode() && 0 !=
> resp.getItems().getItem().length ) {
> ids[0] = resp.getItems().getItem()[0].getId();
> mail.setContacts( new ContactRefList( ids ) );
> changes.setAdd( mail );
> // mail = new Mail();
> // mail.setContacts( new ContactRefList( null ) );
> // changes.setDelete( mail );
> m_main.getService().modifyItemRequest( m_mitem.getId(), null,

changes,
> 0, m_main.getSessionId(), m_main.getTrace() );
> }
> } catch ( Exception e ) {
> e.printStackTrace();
> }
> }
>
> Here is the simplified SOAP request:
>
> <?xml version="1.0" encoding="UTF‑8"?>
> <env:Envelope>
> <env:Body>
> <ns0:modifyItemRequest>
>
>

<ns0:id>49EF11C3.domain.PO1.100.1776172.1.CAE4.1@1:7.domain.PO1.100.0.1.0.1@

> 16</ns0:id>
> <ns0:updates>
> <ans1:add type="Mail">
> <ans1:contacts>
>
>

<ans1:contact>478628FF.domain.PO1.104.1776172.1.D6.1@56:45080270.domain.PO1.

> 104.1776172.1.3.1@53</ans1:contact>
> </ans1:contacts>
> </ans1:add>
> </ns0:updates>
> </ns0:modifyItemRequest>
> </env:Body>
> </env:Envelope>
>
> I then went back, deleted the old contact(s) and added a different one:
> private void testContacts() {
> // FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName",

null,
> "Johnson", null, null );
> // FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",
> null, "Craig", null, null );
> FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
> "Parker", null, null );
> FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName", null,
> "Jay", null, null );
> FilterElement fe[] = new FilterElement[2];
> FilterGroup grp = new FilterGroup( FilterOp.and, fe );
> Filter flt = new Filter( grp );
> GetAddressBookListResponse abresp;
> GetItemsResponse resp;
> ItemChanges changes = new ItemChanges();
> Mail mail = new Mail();
> String id = null;
> String[] ids = new String[1];
> String view = null;
>
> try {
>
> abresp = m_main.getService().getAddressBookListRequest( "Frequent
> Contacts", view, m_main.getSessionId(), m_main.getTrace() );
> if ( 0 == abresp.getStatus().getCode() ) {
> id = abresp.getBooks().getBook()[0].getId();
> }
> fe[0] = f1;
> fe[1] = f2;
> resp = m_main.getService().getItemsRequest( id, view, flt,
> null, 0, m_main.getSessionId(), m_main.getTrace() );
> if ( 0 == resp.getStatus().getCode() && 0 !=
> resp.getItems().getItem().length ) {
> ids[0] = resp.getItems().getItem()[0].getId();
> mail.setContacts( new ContactRefList( ids ) );
> changes.setAdd( mail );
> mail = new Mail();
> mail.setContacts( new ContactRefList( null ) );
> changes.setDelete( mail );
> m_main.getService().modifyItemRequest( m_mitem.getId(), null,

changes,
> 0, m_main.getSessionId(), m_main.getTrace() );
> }
> } catch ( Exception e ) {
> e.printStackTrace();
> }
> }
>
> Here is the simplified SOAP trace.
>
> <?xml version="1.0" encoding="UTF‑8"?>
> <env:Envelope>
> <env:Body>
> <ns0:modifyItemRequest>
>
>

<ns0:id>49EF11C3.domain.PO1.100.1776172.1.CAE4.1@1:7.domain.PO1.100.0.1.0.1@

> 16</ns0:id>
> <ns0:updates>
> <ans1:add type="Mail">
> <ans1:contacts>
>
>

<ans1:contact>455C59CA.domain.PO1.104.1776172.1.54.1@56:45080270.domain.PO1.

> 104.1776172.1.3.1@53</ans1:contact>
> </ans1:contacts>
> </ans1:add>
> <ans1:delete type="Mail">
> <ans1:contacts/>
> </ans1:delete>
> </ns0:updates>
> </ns0:modifyItemRequest>
> </env:Body>
> </env:Envelope>
>
> If you still have problems, it might help if you send the
> SOAP trace.
>
> Preston
>
>>>> On Friday, June 05, 2009 at 4:27 PM, Sean

> Kirkby<skirkby@armordatasystems.com>
> wrote:
>> Hello,
>>
>> I am trying to modify the "contacts" for posted task item in my calendar.


>
>> The existing task has a contact in its contacts list.
>>
>> I get an in‑memory instance of a task and modify it by clearing out

the
>
>> task.contacts collection, and creating a new (empty) collection.
>>
>> I then add the ID of the new contact to the task.contacts collection,

> create
>> a modifyItemRequest object with the task object, and call
>> modifyItemRequest().
>>
>> I don't get an error code back (modifyItemResponse.status.code == 0).
>>
>> Yet, the contacts collection of the item in GroupWise is not changed at

> all.
>> If I look at the item via the Win32 client, the old contact is still

> there,
>> and if I retrieve the item via SOAP, the old contact ID is still in the
>> collection.
>>
>> Am I doing something wrong, or is it possible that updating the contacts

> on
>> an item via SOAP is broken?
>>
>> BTW, I am using GW 8.0.1‑87458 with v1.0.2 of the schema.
>>
>> Any help is appreciated...
>>
>> Thanks.
>>
>> ‑‑sk.

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Modifying "contacts" for a ContainerItem in GW8.0.1

For the most part, it is advised to reduce the client /
server traffic. If possible you would want to consolidate
all changes in to one request.

Preston

>>> On Monday, June 08, 2009 at 5:32 PM, Sean

Kirkby<skirkby@armordatasystems.com>
wrote:
> BTW, what is the recommended best practice if there are multiple values to


> update/modify on an item?
>
> Is it best to try to do as much as possible in one request? Or is it more


> efficient to do them each in their own modifyItemRequest() call?
>
> ‑‑sk.
>
>>>> On 6/8/2009 at 5:31 AM, Preston Stephenson<PStephenson@gw.novell.com>

wrote:
>
> Here is the test I did:
>
> I first added a contact to a Mail item.(Tasks should be the same.)
>
> private void testContacts() {
> FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
> "Johnson", null, null );
> FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName", null,
> "Craig", null, null );
> // FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName",

null,
> "Parker", null, null );
> // FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",
> null, "Jay", null, null );
> FilterElement fe[] = new FilterElement[2];
> FilterGroup grp = new FilterGroup( FilterOp.and, fe );
> Filter flt = new Filter( grp );
> GetAddressBookListResponse abresp;
> GetItemsResponse resp;
> ItemChanges changes = new ItemChanges();
> Mail mail = new Mail();
> String id = null;
> String[] ids = new String[1];
> String view = null;
>
> try {
>
> abresp = m_main.getService().getAddressBookListRequest( "Frequent
> Contacts", view, m_main.getSessionId(), m_main.getTrace() );
> if ( 0 == abresp.getStatus().getCode() ) {
> id = abresp.getBooks().getBook()[0].getId();
> }
> fe[0] = f1;
> fe[1] = f2;
> resp = m_main.getService().getItemsRequest( id, view, flt,
> null, 0, m_main.getSessionId(), m_main.getTrace() );
> if ( 0 == resp.getStatus().getCode() && 0 !=
> resp.getItems().getItem().length ) {
> ids[0] = resp.getItems().getItem()[0].getId();
> mail.setContacts( new ContactRefList( ids ) );
> changes.setAdd( mail );
> // mail = new Mail();
> // mail.setContacts( new ContactRefList( null ) );
> // changes.setDelete( mail );
> m_main.getService().modifyItemRequest( m_mitem.getId(), null,

changes,
> 0, m_main.getSessionId(), m_main.getTrace() );
> }
> } catch ( Exception e ) {
> e.printStackTrace();
> }
> }
>
> Here is the simplified SOAP request:
>
> <?xml version="1.0" encoding="UTF‑8"?>
> <env:Envelope>
> <env:Body>
> <ns0:modifyItemRequest>
>
>

<ns0:id>49EF11C3.domain.PO1.100.1776172.1.CAE4.1@1:7.domain.PO1.100.0.1.0.1@

> 16</ns0:id>
> <ns0:updates>
> <ans1:add type="Mail">
> <ans1:contacts>
>
>

<ans1:contact>478628FF.domain.PO1.104.1776172.1.D6.1@56:45080270.domain.PO1.

> 104.1776172.1.3.1@53</ans1:contact>
> </ans1:contacts>
> </ans1:add>
> </ns0:updates>
> </ns0:modifyItemRequest>
> </env:Body>
> </env:Envelope>
>
> I then went back, deleted the old contact(s) and added a different one:
> private void testContacts() {
> // FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName",

null,
> "Johnson", null, null );
> // FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",
> null, "Craig", null, null );
> FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
> "Parker", null, null );
> FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName", null,
> "Jay", null, null );
> FilterElement fe[] = new FilterElement[2];
> FilterGroup grp = new FilterGroup( FilterOp.and, fe );
> Filter flt = new Filter( grp );
> GetAddressBookListResponse abresp;
> GetItemsResponse resp;
> ItemChanges changes = new ItemChanges();
> Mail mail = new Mail();
> String id = null;
> String[] ids = new String[1];
> String view = null;
>
> try {
>
> abresp = m_main.getService().getAddressBookListRequest( "Frequent
> Contacts", view, m_main.getSessionId(), m_main.getTrace() );
> if ( 0 == abresp.getStatus().getCode() ) {
> id = abresp.getBooks().getBook()[0].getId();
> }
> fe[0] = f1;
> fe[1] = f2;
> resp = m_main.getService().getItemsRequest( id, view, flt,
> null, 0, m_main.getSessionId(), m_main.getTrace() );
> if ( 0 == resp.getStatus().getCode() && 0 !=
> resp.getItems().getItem().length ) {
> ids[0] = resp.getItems().getItem()[0].getId();
> mail.setContacts( new ContactRefList( ids ) );
> changes.setAdd( mail );
> mail = new Mail();
> mail.setContacts( new ContactRefList( null ) );
> changes.setDelete( mail );
> m_main.getService().modifyItemRequest( m_mitem.getId(), null,

changes,
> 0, m_main.getSessionId(), m_main.getTrace() );
> }
> } catch ( Exception e ) {
> e.printStackTrace();
> }
> }
>
> Here is the simplified SOAP trace.
>
> <?xml version="1.0" encoding="UTF‑8"?>
> <env:Envelope>
> <env:Body>
> <ns0:modifyItemRequest>
>
>

<ns0:id>49EF11C3.domain.PO1.100.1776172.1.CAE4.1@1:7.domain.PO1.100.0.1.0.1@

> 16</ns0:id>
> <ns0:updates>
> <ans1:add type="Mail">
> <ans1:contacts>
>
>

<ans1:contact>455C59CA.domain.PO1.104.1776172.1.54.1@56:45080270.domain.PO1.

> 104.1776172.1.3.1@53</ans1:contact>
> </ans1:contacts>
> </ans1:add>
> <ans1:delete type="Mail">
> <ans1:contacts/>
> </ans1:delete>
> </ns0:updates>
> </ns0:modifyItemRequest>
> </env:Body>
> </env:Envelope>
>
> If you still have problems, it might help if you send the
> SOAP trace.
>
> Preston
>
>>>> On Friday, June 05, 2009 at 4:27 PM, Sean

> Kirkby<skirkby@armordatasystems.com>
> wrote:
>> Hello,
>>
>> I am trying to modify the "contacts" for posted task item in my calendar.


>
>> The existing task has a contact in its contacts list.
>>
>> I get an in‑memory instance of a task and modify it by clearing out

the
>
>> task.contacts collection, and creating a new (empty) collection.
>>
>> I then add the ID of the new contact to the task.contacts collection,

> create
>> a modifyItemRequest object with the task object, and call
>> modifyItemRequest().
>>
>> I don't get an error code back (modifyItemResponse.status.code == 0).
>>
>> Yet, the contacts collection of the item in GroupWise is not changed at

> all.
>> If I look at the item via the Win32 client, the old contact is still

> there,
>> and if I retrieve the item via SOAP, the old contact ID is still in the
>> collection.
>>
>> Am I doing something wrong, or is it possible that updating the contacts

> on
>> an item via SOAP is broken?
>>
>> BTW, I am using GW 8.0.1‑87458 with v1.0.2 of the schema.
>>
>> Any help is appreciated...
>>
>> Thanks.
>>
>> ‑‑sk.

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Modifying "contacts" for a ContainerItem in GW8.0.1

Thanks, Preston.

Regarding modifying message bodies for draft items, does that apply to posted items as well?

(If so, and the Win32 client deletes/recreates as you say, I assume it does so while maintaining the message ID?)

What is the best way to "delete" a message body? Do I need to create an item with the EXACT same text as the message body, and assign it to an ItemChanges.delete property, and pass it in a modifyItemRequest call?

I am having a problem where I am unable to modify the message body of a posted task, and I suspect it may be the issue you brought up here, but I am not sure how to actually fix it...

Thanks.

--sk.


>>> On 6/9/2009 at 4:37 AM, Preston Stephenson<PStephenson@gw.novell.com> wrote:


Sorry, there is not a general rule.
It all depends on who and how the underlying logic
is implemented. I try to pass on the information when
certain fields don't work as expected to be documented.
Unfortunately, I probably forget to make sure that
information is not lost by the time the documentation
is updated. For example, for the most part using rules
you need to delete and add the rule again to modify a
rule. For draft message bodies you need to delete and
add the message body again. I believe the client even
deletes the whole draft item and creates it again when
the user makes a change to a draft message.

Unfortunately, I don't remember all of the exceptions.
I usually have to debug through the code each time to
figure out how it works.

If you have questions about specific parts, I would be
glad to research it for you.

Preston


>>> On Monday, June 08, 2009 at 5:17 PM, Sean

Kirkby<skirkby@armordatasystems.com>
wrote:

> Thanks, Preston.
>
> I figured out the issue...
>
> I retrieve a task item from GW. I then populate a form with data from the



> item.
>
> Among the things the user can modify on the form are the subject, the due



> date, and the contacts.
>
> What I was doing was taking all of the form data (whether or not it had
> changed), updating the in‑memory copy of the task (including the

Contacts

> collection), and assigning my modifyItemRequest.updates.update property to



> the in‑memory task object.
>
> Apparently, when adding a new item to the Contacts list, you can't use
> modifyItemRequest.updates.update, you have to use
> modifyItemRequest.updates.add.
>
> Will this be true for ANYTHING that is a container/list of any kind?
>
> Thanks.
>
> ‑‑sk.
>

>>>> On 6/8/2009 at 5:31 AM, Preston Stephenson<PStephenson@gw.novell.com>

wrote:

>
> Here is the test I did:
>
> I first added a contact to a Mail item.(Tasks should be the same.)
>
> private void testContacts() {
> FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
> "Johnson", null, null );
> FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName", null,
> "Craig", null, null );
> // FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName",

null,

> "Parker", null, null );
> // FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",
> null, "Jay", null, null );
> FilterElement fe[] = new FilterElement[2];
> FilterGroup grp = new FilterGroup( FilterOp.and, fe );
> Filter flt = new Filter( grp );
> GetAddressBookListResponse abresp;
> GetItemsResponse resp;
> ItemChanges changes = new ItemChanges();
> Mail mail = new Mail();
> String id = null;
> String[] ids = new String[1];
> String view = null;
>
> try {
>
> abresp = m_main.getService().getAddressBookListRequest( "Frequent
> Contacts", view, m_main.getSessionId(), m_main.getTrace() );
> if ( 0 == abresp.getStatus().getCode() ) {
> id = abresp.getBooks().getBook()[0].getId();
> }
> fe[0] = f1;
> fe[1] = f2;
> resp = m_main.getService().getItemsRequest( id, view, flt,
> null, 0, m_main.getSessionId(), m_main.getTrace() );
> if ( 0 == resp.getStatus().getCode() && 0 !=
> resp.getItems().getItem().length ) {
> ids[0] = resp.getItems().getItem()[0].getId();
> mail.setContacts( new ContactRefList( ids ) );
> changes.setAdd( mail );
> // mail = new Mail();
> // mail.setContacts( new ContactRefList( null ) );
> // changes.setDelete( mail );
> m_main.getService().modifyItemRequest( m_mitem.getId(), null,

changes,

> 0, m_main.getSessionId(), m_main.getTrace() );
> }
> } catch ( Exception e ) {
> e.printStackTrace();
> }
> }
>
> Here is the simplified SOAP request:
>
> <?xml version="1.0" encoding="UTF‑8"?>
> <env:Envelope>
> <env:Body>
> <ns0:modifyItemRequest>
>
>

<ns0:id>49EF11C3.domain.PO1.100.1776172.1.CAE4.1@1:7.domain.PO1.100.0.1.0.1@


> 16</ns0:id>
> <ns0:updates>
> <ans1:add type="Mail">
> <ans1:contacts>
>
>

<ans1:contact>478628FF.domain.PO1.104.1776172.1.D6.1@56:45080270.domain.PO1.


> 104.1776172.1.3.1@53</ans1:contact>
> </ans1:contacts>
> </ans1:add>
> </ns0:updates>
> </ns0:modifyItemRequest>
> </env:Body>
> </env:Envelope>
>
> I then went back, deleted the old contact(s) and added a different one:
> private void testContacts() {
> // FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName",

null,

> "Johnson", null, null );
> // FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",
> null, "Craig", null, null );
> FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
> "Parker", null, null );
> FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName", null,
> "Jay", null, null );
> FilterElement fe[] = new FilterElement[2];
> FilterGroup grp = new FilterGroup( FilterOp.and, fe );
> Filter flt = new Filter( grp );
> GetAddressBookListResponse abresp;
> GetItemsResponse resp;
> ItemChanges changes = new ItemChanges();
> Mail mail = new Mail();
> String id = null;
> String[] ids = new String[1];
> String view = null;
>
> try {
>
> abresp = m_main.getService().getAddressBookListRequest( "Frequent
> Contacts", view, m_main.getSessionId(), m_main.getTrace() );
> if ( 0 == abresp.getStatus().getCode() ) {
> id = abresp.getBooks().getBook()[0].getId();
> }
> fe[0] = f1;
> fe[1] = f2;
> resp = m_main.getService().getItemsRequest( id, view, flt,
> null, 0, m_main.getSessionId(), m_main.getTrace() );
> if ( 0 == resp.getStatus().getCode() && 0 !=
> resp.getItems().getItem().length ) {
> ids[0] = resp.getItems().getItem()[0].getId();
> mail.setContacts( new ContactRefList( ids ) );
> changes.setAdd( mail );
> mail = new Mail();
> mail.setContacts( new ContactRefList( null ) );
> changes.setDelete( mail );
> m_main.getService().modifyItemRequest( m_mitem.getId(), null,

changes,

> 0, m_main.getSessionId(), m_main.getTrace() );
> }
> } catch ( Exception e ) {
> e.printStackTrace();
> }
> }
>
> Here is the simplified SOAP trace.
>
> <?xml version="1.0" encoding="UTF‑8"?>
> <env:Envelope>
> <env:Body>
> <ns0:modifyItemRequest>
>
>

<ns0:id>49EF11C3.domain.PO1.100.1776172.1.CAE4.1@1:7.domain.PO1.100.0.1.0.1@


> 16</ns0:id>
> <ns0:updates>
> <ans1:add type="Mail">
> <ans1:contacts>
>
>

<ans1:contact>455C59CA.domain.PO1.104.1776172.1.54.1@56:45080270.domain.PO1.


> 104.1776172.1.3.1@53</ans1:contact>
> </ans1:contacts>
> </ans1:add>
> <ans1:delete type="Mail">
> <ans1:contacts/>
> </ans1:delete>
> </ns0:updates>
> </ns0:modifyItemRequest>
> </env:Body>
> </env:Envelope>
>
> If you still have problems, it might help if you send the
> SOAP trace.
>
> Preston
>

>>>> On Friday, June 05, 2009 at 4:27 PM, Sean

> Kirkby<skirkby@armordatasystems.com>
> wrote:

>> Hello,
>>
>> I am trying to modify the "contacts" for posted task item in my calendar.



>

>> The existing task has a contact in its contacts list.
>>
>> I get an in‑memory instance of a task and modify it by clearing out

the

>

>> task.contacts collection, and creating a new (empty) collection.
>>
>> I then add the ID of the new contact to the task.contacts collection,

> create

>> a modifyItemRequest object with the task object, and call
>> modifyItemRequest().
>>
>> I don't get an error code back (modifyItemResponse.status.code == 0).
>>
>> Yet, the contacts collection of the item in GroupWise is not changed at

> all.

>> If I look at the item via the Win32 client, the old contact is still

> there,

>> and if I retrieve the item via SOAP, the old contact ID is still in the
>> collection.
>>
>> Am I doing something wrong, or is it possible that updating the contacts

> on

>> an item via SOAP is broken?
>>
>> BTW, I am using GW 8.0.1‑87458 with v1.0.2 of the schema.
>>
>> Any help is appreciated...
>>
>> Thanks.
>>
>> ‑‑sk.
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Modifying "contacts" for a ContainerItem in GW8.0.1

On the delete and new create of a draft item,
the messageId is not maintained.

For modifying the message body on a personal
item, the message body needs to come in the
update element.

You should be able to delete the message body
on a posted item, In that case you just pass
the message element in the item element in the
delete element. There are issues deleting
attachments on an item. There are certain
fields, for example, the size element, that doesn't
get updated when you delete the message body.

I believe all of the fixes for deleting / updating
appointments and message bodies are only in 8.0.1.

If you need, I can send you some example code and
SOAP traces. Just let me know which examples you
need. Keep in mind producing examples is lower on
my priority of things I need to do.

If you need a current 8.0.1 development build, just
reply to me directly and I can give you a link to
a build.

Preston

>>> On Tuesday, June 09, 2009 at 1:06 PM, Sean

Kirkby<skirkby@armordatasystems.com>
wrote:
> Thanks, Preston.
>
> Regarding modifying message bodies for draft items, does that apply to
> posted items as well?
>
> (If so, and the Win32 client deletes/recreates as you say, I assume it

does
> so while maintaining the message ID?)
>
> What is the best way to "delete" a message body? Do I need to create an
> item with the EXACT same text as the message body, and assign it to an
> ItemChanges.delete property, and pass it in a modifyItemRequest call?
>
> I am having a problem where I am unable to modify the message body of a
> posted task, and I suspect it may be the issue you brought up here, but I

am
> not sure how to actually fix it...
>
> Thanks.
>
> ‑‑sk.
>
>>>> On 6/9/2009 at 4:37 AM, Preston Stephenson<PStephenson@gw.novell.com>

wrote:
>
> Sorry, there is not a general rule.
> It all depends on who and how the underlying logic
> is implemented. I try to pass on the information when
> certain fields don't work as expected to be documented.
> Unfortunately, I probably forget to make sure that
> information is not lost by the time the documentation
> is updated. For example, for the most part using rules
> you need to delete and add the rule again to modify a
> rule. For draft message bodies you need to delete and
> add the message body again. I believe the client even
> deletes the whole draft item and creates it again when
> the user makes a change to a draft message.
>
> Unfortunately, I don't remember all of the exceptions.
> I usually have to debug through the code each time to
> figure out how it works.
>
> If you have questions about specific parts, I would be
> glad to research it for you.
>
> Preston
>
>>>> On Monday, June 08, 2009 at 5:17 PM, Sean

> Kirkby<skirkby@armordatasystems.com>
> wrote:
>> Thanks, Preston.
>>
>> I figured out the issue...
>>
>> I retrieve a task item from GW. I then populate a form with data from

the
>
>> item.
>>
>> Among the things the user can modify on the form are the subject, the

due
>
>> date, and the contacts.
>>
>> What I was doing was taking all of the form data (whether or not it had
>> changed), updating the in‑memory copy of the task (including the

> Contacts
>> collection), and assigning my modifyItemRequest.updates.update property

to
>
>> the in‑memory task object.
>>
>> Apparently, when adding a new item to the Contacts list, you can't use
>> modifyItemRequest.updates.update, you have to use
>> modifyItemRequest.updates.add.
>>
>> Will this be true for ANYTHING that is a container/list of any kind?
>>
>> Thanks.
>>
>> ‑‑sk.
>>
>>>>> On 6/8/2009 at 5:31 AM, Preston Stephenson<PStephenson@gw.novell.com>

> wrote:
>>
>> Here is the test I did:
>>
>> I first added a contact to a Mail item.(Tasks should be the same.)
>>
>> private void testContacts() {
>> FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
>> "Johnson", null, null );
>> FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",

null,
>> "Craig", null, null );
>> // FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName",

> null,
>> "Parker", null, null );
>> // FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",
>> null, "Jay", null, null );
>> FilterElement fe[] = new FilterElement[2];
>> FilterGroup grp = new FilterGroup( FilterOp.and, fe );
>> Filter flt = new Filter( grp );
>> GetAddressBookListResponse abresp;
>> GetItemsResponse resp;
>> ItemChanges changes = new ItemChanges();
>> Mail mail = new Mail();
>> String id = null;
>> String[] ids = new String[1];
>> String view = null;
>>
>> try {
>>
>> abresp = m_main.getService().getAddressBookListRequest( "Frequent
>> Contacts", view, m_main.getSessionId(), m_main.getTrace() );
>> if ( 0 == abresp.getStatus().getCode() ) {
>> id = abresp.getBooks().getBook()[0].getId();
>> }
>> fe[0] = f1;
>> fe[1] = f2;
>> resp = m_main.getService().getItemsRequest( id, view, flt,
>> null, 0, m_main.getSessionId(), m_main.getTrace() );
>> if ( 0 == resp.getStatus().getCode() && 0 !=
>> resp.getItems().getItem().length ) {
>> ids[0] = resp.getItems().getItem()[0].getId();
>> mail.setContacts( new ContactRefList( ids ) );
>> changes.setAdd( mail );
>> // mail = new Mail();
>> // mail.setContacts( new ContactRefList( null ) );
>> // changes.setDelete( mail );
>> m_main.getService().modifyItemRequest( m_mitem.getId(), null,

> changes,
>> 0, m_main.getSessionId(), m_main.getTrace() );
>> }
>> } catch ( Exception e ) {
>> e.printStackTrace();
>> }
>> }
>>
>> Here is the simplified SOAP request:
>>
>> <?xml version="1.0" encoding="UTF‑8"?>
>> <env:Envelope>
>> <env:Body>
>> <ns0:modifyItemRequest>
>>
>>

>

<ns0:id>49EF11C3.domain.PO1.100.1776172.1.CAE4.1@1:7.domain.PO1.100.0.1.0.1@

>
>> 16</ns0:id>
>> <ns0:updates>
>> <ans1:add type="Mail">
>> <ans1:contacts>
>>
>>

>

<ans1:contact>478628FF.domain.PO1.104.1776172.1.D6.1@56:45080270.domain.PO1.

>
>> 104.1776172.1.3.1@53</ans1:contact>
>> </ans1:contacts>
>> </ans1:add>
>> </ns0:updates>
>> </ns0:modifyItemRequest>
>> </env:Body>
>> </env:Envelope>
>>
>> I then went back, deleted the old contact(s) and added a different one:
>> private void testContacts() {
>> // FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName",

> null,
>> "Johnson", null, null );
>> // FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",
>> null, "Craig", null, null );
>> FilterEntry f1 = new FilterEntry( FilterOp.eq, "lastName", null,
>> "Parker", null, null );
>> FilterEntry f2 = new FilterEntry( FilterOp.eq, "firstName",

null,
>> "Jay", null, null );
>> FilterElement fe[] = new FilterElement[2];
>> FilterGroup grp = new FilterGroup( FilterOp.and, fe );
>> Filter flt = new Filter( grp );
>> GetAddressBookListResponse abresp;
>> GetItemsResponse resp;
>> ItemChanges changes = new ItemChanges();
>> Mail mail = new Mail();
>> String id = null;
>> String[] ids = new String[1];
>> String view = null;
>>
>> try {
>>
>> abresp = m_main.getService().getAddressBookListRequest( "Frequent
>> Contacts", view, m_main.getSessionId(), m_main.getTrace() );
>> if ( 0 == abresp.getStatus().getCode() ) {
>> id = abresp.getBooks().getBook()[0].getId();
>> }
>> fe[0] = f1;
>> fe[1] = f2;
>> resp = m_main.getService().getItemsRequest( id, view, flt,
>> null, 0, m_main.getSessionId(), m_main.getTrace() );
>> if ( 0 == resp.getStatus().getCode() && 0 !=
>> resp.getItems().getItem().length ) {
>> ids[0] = resp.getItems().getItem()[0].getId();
>> mail.setContacts( new ContactRefList( ids ) );
>> changes.setAdd( mail );
>> mail = new Mail();
>> mail.setContacts( new ContactRefList( null ) );
>> changes.setDelete( mail );
>> m_main.getService().modifyItemRequest( m_mitem.getId(), null,

> changes,
>> 0, m_main.getSessionId(), m_main.getTrace() );
>> }
>> } catch ( Exception e ) {
>> e.printStackTrace();
>> }
>> }
>>
>> Here is the simplified SOAP trace.
>>
>> <?xml version="1.0" encoding="UTF‑8"?>
>> <env:Envelope>
>> <env:Body>
>> <ns0:modifyItemRequest>
>>
>>

>

<ns0:id>49EF11C3.domain.PO1.100.1776172.1.CAE4.1@1:7.domain.PO1.100.0.1.0.1@

>
>> 16</ns0:id>
>> <ns0:updates>
>> <ans1:add type="Mail">
>> <ans1:contacts>
>>
>>

>

<ans1:contact>455C59CA.domain.PO1.104.1776172.1.54.1@56:45080270.domain.PO1.

>
>> 104.1776172.1.3.1@53</ans1:contact>
>> </ans1:contacts>
>> </ans1:add>
>> <ans1:delete type="Mail">
>> <ans1:contacts/>
>> </ans1:delete>
>> </ns0:updates>
>> </ns0:modifyItemRequest>
>> </env:Body>
>> </env:Envelope>
>>
>> If you still have problems, it might help if you send the
>> SOAP trace.
>>
>> Preston
>>
>>>>> On Friday, June 05, 2009 at 4:27 PM, Sean

>> Kirkby<skirkby@armordatasystems.com>
>> wrote:
>>> Hello,
>>>
>>> I am trying to modify the "contacts" for posted task item in my

calendar.
>
>>
>>> The existing task has a contact in its contacts list.
>>>
>>> I get an in‑memory instance of a task and modify it by clearing out

> the
>>
>>> task.contacts collection, and creating a new (empty) collection.
>>>
>>> I then add the ID of the new contact to the task.contacts collection,

>> create
>>> a modifyItemRequest object with the task object, and call
>>> modifyItemRequest().
>>>
>>> I don't get an error code back (modifyItemResponse.status.code == 0).
>>>
>>> Yet, the contacts collection of the item in GroupWise is not changed at

>> all.
>>> If I look at the item via the Win32 client, the old contact is still

>> there,
>>> and if I retrieve the item via SOAP, the old contact ID is still in the


>>> collection.
>>>
>>> Am I doing something wrong, or is it possible that updating the

contacts
>> on
>>> an item via SOAP is broken?
>>>
>>> BTW, I am using GW 8.0.1‑87458 with v1.0.2 of the schema.
>>>
>>> Any help is appreciated...
>>>
>>> Thanks.
>>>
>>> ‑‑sk.

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.