Use(getItemsRequest)cannot response the full list of library

I want to get the items' total count of library. But some library can count the full list, some library just only count one record. I have no idea what is the problem. Here is the coding.

WebReference.getItemsRequest req = new WebReference.getItemsRequest();
WebReference.getItemsResponse resp;
req.container = ((LibItem)listLibraries.SelectedItem).ID;
libname = ((LibItem)listLibraries.SelectedItem).Name;
domain = ((LibItem)listLibraries.SelectedItem).Domain;
postOffice = ((LibItem)listLibraries.SelectedItem).PostOffice;
resp = ws.getItemsRequest(req);
if (0 == resp.status.code)
{
if (null != resp.items)
{
listBoxFiles.Items.Clear();
foreach (WebReference.Document itemobj in resp.items)
{
FileItem tmpinfo = new FileItem();
tmpinfo.Name = itemobj.name;
tmpinfo.ID = itemobj.id;
tmpinfo.Version = itemobj.version;
tmpinfo.Lib_DisplayName = itemobj.library.displayName;
tmpinfo.Lib_email = itemobj.library.email;
tmpinfo.Subject = itemobj.subject;
tmpinfo.Author_DisplayName = itemobj.author.displayName;
tmpinfo.Author_email = itemobj.author.email;
tmpinfo.Created = itemobj.created;
tmpinfo.currentVersion = itemobj.currentVersion;
tmpinfo.documentNumber = itemobj.documentNumber;
tmpinfo.documentTypeName = itemobj.documentTypeName;
tmpinfo.officialVersion = itemobj.officialVersion;
tmpinfo.RetrievedDate = itemobj.modified;
listBoxFiles.Items.Add(tmpinfo);
count ;
}
LogMessage("GetLibItems success" " count=" count);

}

Anyone would be help me to solve this problem?

Thank you
  • There is not a good way to get a count of items in a document library.
    You could try using the cursor calls.

    Preston

    >>> On Monday, August 06, 2012 at 4:36 AM,

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

    > I want to get the items' total count of library. But some library can
    > count the full list, some library just only count one record. I have no
    > idea what is the problem. Here is the coding.
    >
    > WebReference.getItemsRequest req = new
    > WebReference.getItemsRequest();
    > WebReference.getItemsResponse resp;
    > req.container =
    > ((LibItem)listLibraries.SelectedItem).ID;
    > libname = ((LibItem)listLibraries.SelectedItem).Name;
    > domain = ((LibItem)listLibraries.SelectedItem).Domain;
    > postOffice =
    > ((LibItem)listLibraries.SelectedItem).PostOffice;
    > resp = ws.getItemsRequest(req);
    > if (0 == resp.status.code)
    > {
    > if (null != resp.items)
    > {
    > listBoxFiles.Items.Clear();
    > foreach (WebReference.Document itemobj in
    > resp.items)
    > {
    > FileItem tmpinfo = new FileItem();
    > tmpinfo.Name = itemobj.name;
    > tmpinfo.ID = itemobj.id;
    > tmpinfo.Version = itemobj.version;
    > tmpinfo.Lib_DisplayName =
    > itemobj.library.displayName;
    > tmpinfo.Lib_email = itemobj.library.email;
    > tmpinfo.Subject = itemobj.subject;
    > tmpinfo.Author_DisplayName =
    > itemobj.author.displayName;
    > tmpinfo.Author_email =
    > itemobj.author.email;
    > tmpinfo.Created = itemobj.created;
    > tmpinfo.currentVersion =
    > itemobj.currentVersion;
    > tmpinfo.documentNumber =
    > itemobj.documentNumber;
    > tmpinfo.documentTypeName =
    > itemobj.documentTypeName;
    > tmpinfo.officialVersion =
    > itemobj.officialVersion;
    > tmpinfo.RetrievedDate = itemobj.modified;
    > listBoxFiles.Items.Add(tmpinfo);
    > count ;
    > }
    > LogMessage("GetLibItems success" " count="
    > count);
    >
    > }
    >
    > Anyone would be help me to solve this problem?
    >
    > Thank you

  • Preston,

    Thank you for taking the time to respond. I have tried the cursor calls. But it still not work.

    I have seen some of thread about cursor. I haven't use positionCursorRequest and position element of readCursorRequest.

    It still return null to me. The following is my coding.

    Jimmy


    WebReference.createCursorRequest createCursorReq = new WebReference.createCursorRequest();
    WebReference.createCursorResponse createCursorResp;

    WebReference.readCursorRequest readCursorReq = new WebReference.readCursorRequest();
    WebReference.readCursorResponse readCursorResp;

    WebReference.destroyCursorRequest destroyCursorReq = new WebReference.destroyCursorRequest();
    WebReference.destroyCursorResponse destroyCursorResp;

    WebReference.getItemsRequest getItemsReq = new WebReference.getItemsRequest();
    WebReference.getItemsResponse getItemsResp;

    createCursorReq.container = ((LibItem)listLibraries.SelectedItem).ID;
    createCursorResp = ws.createCursorRequest(createCursorReq);
    if (createCursorResp.status.code == 0 || createCursorResp.cursorSpecified == true)
    {
    readCursorReq.container = ((LibItem)listLibraries.SelectedItem).ID;
    readCursorReq.cursor = createCursorResp.cursor;
    readCursorReq.forward = true;
    readCursorResp = ws.readCursorRequest(readCursorReq);

    if ((readCursorResp.status.code == 0)/*