Hi,

Below is code to read first 100 contacts from the address book :


gwWB.createCursorRequest gwCreateCursorReq = new gwWB.createCursorRequest();
gwWB.createCursorResponse gwCreateCursorResp = new gwWB.createCursorResponse();
gwWB.readCursorRequest gwReadCursorReq = new gwWB.readCursorRequest();
gwWB.readCursorResponse gwReadCursorResp = new gwWB.readCursorResponse();
gwWB.destroyCursorRequest gwDestroyCursorReq = new gwWB.destroyCursorRequest();
gwWB.destroyCursorResponse gwDestroyCursorResp = new gwWB.destroyCursorResponse();
string gwView;
gwView = "default id container @type members visibility ";
gwCreateCursorReq.view = gwView;
gwCreateCursorReq.container = AddBook.id;
gwCreateCursorResp = ws.createCursorRequest(gwCreateCursorReq);
if(gwCreateCursorResp.status.code != 0 || gwCreateCursorResp.cursorSpecified == false)
{
MessageBox.Show("Problem creating cursor for: " );
}
gwReadCursorReq.cursor = gwCreateCursorResp.cursor;
gwReadCursorReq.position = gwWB.CursorSeek.current;
gwReadCursorReq.container = AddBook.id;
gwReadCursorReq.count = 100;
gwReadCursorResp = ws.readCursorRequest(gwReadCursorReq);
if(gwReadCursorResp.status.code != 0)
{
MessageBox.Show("Error in Read cursor response : " );
}
else
{
while((gwReadCursorResp.items != null)&(gwReadCursorResp.status.code != 0) & (gwReadCursorResp.items.count > 0)) {
MessageBox.Show(iCnt.ToString());
try
{
gwReadCursorReq.position = gwWB.CursorSeek.current;
gwReadCursorResp = ws.readCursorRequest(gwReadCursorReq);
MessageBox.Show(gwReadCursorReq.cursor.ToString()) ;
if (gwReadCursorResp.status.code != 0)
{
MessageBox.Show("Problem reading cursor for: ");
}
}
catch
{
}
}
}
if(gwCreateCursorResp.cursorSpecified == true)
{
gwDestroyCursorReq.cursor = gwCreateCursorResp.cursor;
gwDestroyCursorReq.container = AddBook.id;
gwDestroyCursorResp = ws.destroyCursorRequest(gwDestroyCursorReq);
if(gwDestroyCursorResp.status.code != 0 )
{
MessageBox.Show("Problem destroying cursor for: " );
}
}


There are few questions specific to this code :

i) The gwReadCursorResp.status.code and gwReadCursorResp.items.count is always 0. Due to this the code, the program is unable to get the contacts in the AddressBook.
How can i fix that?


ii) Lets take an example, Suppose we have 1000contacts in AddressBook. Here through this code i can iterate only to first 100 contacts .
How can i get the next 90 contacts in the AddressBook.